[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-da3c8756-1871-45c2-84ad-f12a58e1559f":3,"$fT_PMFP91B0HS5rEYWvgz4hywRTeXmSyk7zJmmiiyb1w":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"da3c8756-1871-45c2-84ad-f12a58e1559f","senior-frontend","React、Next.js、TypeScript和Tailwind CSS应用程序的前端开发技能。用于构建React组件、优化Next.js性能、分析包大小、搭建前端项目、实现可访问性或审查前端代码质量时使用。","cat_coding_frontend","mod_coding","sickn33,coding","---\nname: senior-frontend\ndescription: Frontend development skill for React, Next.js, TypeScript, and Tailwind CSS applications. Use when building React components, optimizing Next.js performance, analyzing bundle sizes, scaffolding frontend projects, implementing accessibility, or reviewing frontend code quality.\nrisk: safe\nsource: https:\u002F\u002Fgithub.com\u002Falirezarezvani\u002Fclaude-skills\ndate_added: \"2026-03-07\"\n---\n\n# Senior Frontend\n\nFrontend development patterns, performance optimization, and automation tools for React\u002FNext.js applications.\n\n## When to Use\n- Use when scaffolding a new React or Next.js project with TypeScript and Tailwind CSS.\n- Use when generating new components or custom hooks.\n- Use when analyzing and optimizing bundle sizes for frontend applications.\n- Use to implement or review advanced React patterns like Compound Components or Render Props.\n- Use to ensure accessibility compliance and implement robust testing strategies.\n\n## Table of Contents\n\n- [Project Scaffolding](#project-scaffolding)\n- [Component Generation](#component-generation)\n- [Bundle Analysis](#bundle-analysis)\n- [React Patterns](#react-patterns)\n- [Next.js Optimization](#nextjs-optimization)\n- [Accessibility and Testing](#accessibility-and-testing)\n\n---\n\n## Project Scaffolding\n\nGenerate a new Next.js or React project with TypeScript, Tailwind CSS, and best practice configurations.\n\n### Workflow: Create New Frontend Project\n\n1. Run the scaffolder with your project name and template:\n\n   ```bash\n   python scripts\u002Ffrontend_scaffolder.py my-app --template nextjs\n   ```\n\n2. Add optional features (auth, api, forms, testing, storybook):\n\n   ```bash\n   python scripts\u002Ffrontend_scaffolder.py dashboard --template nextjs --features auth,api\n   ```\n\n3. Navigate to the project and install dependencies:\n\n   ```bash\n   cd my-app && npm install\n   ```\n\n4. Start the development server:\n   ```bash\n   npm run dev\n   ```\n\n### Scaffolder Options\n\n| Option               | Description                                       |\n| -------------------- | ------------------------------------------------- |\n| `--template nextjs`  | Next.js 14+ with App Router and Server Components |\n| `--template react`   | React + Vite with TypeScript                      |\n| `--features auth`    | Add NextAuth.js authentication                    |\n| `--features api`     | Add React Query + API client                      |\n| `--features forms`   | Add React Hook Form + Zod validation              |\n| `--features testing` | Add Vitest + Testing Library                      |\n| `--dry-run`          | Preview files without creating them               |\n\n### Generated Structure (Next.js)\n\n```\nmy-app\u002F\n├── app\u002F\n│   ├── layout.tsx        # Root layout with fonts\n│   ├── page.tsx          # Home page\n│   ├── globals.css       # Tailwind + CSS variables\n│   └── api\u002Fhealth\u002Froute.ts\n├── components\u002F\n│   ├── ui\u002F               # Button, Input, Card\n│   └── layout\u002F           # Header, Footer, Sidebar\n├── hooks\u002F                # useDebounce, useLocalStorage\n├── lib\u002F                  # utils (cn), constants\n├── types\u002F                # TypeScript interfaces\n├── tailwind.config.ts\n├── next.config.js\n└── package.json\n```\n\n---\n\n## Component Generation\n\nGenerate React components with TypeScript, tests, and Storybook stories.\n\n### Workflow: Create a New Component\n\n1. Generate a client component:\n\n   ```bash\n   python scripts\u002Fcomponent_generator.py Button --dir src\u002Fcomponents\u002Fui\n   ```\n\n2. Generate a server component:\n\n   ```bash\n   python scripts\u002Fcomponent_generator.py ProductCard --type server\n   ```\n\n3. Generate with test and story files:\n\n   ```bash\n   python scripts\u002Fcomponent_generator.py UserProfile --with-test --with-story\n   ```\n\n4. Generate a custom hook:\n   ```bash\n   python scripts\u002Fcomponent_generator.py FormValidation --type hook\n   ```\n\n### Generator Options\n\n| Option          | Description                                  |\n| --------------- | -------------------------------------------- |\n| `--type client` | Client component with 'use client' (default) |\n| `--type server` | Async server component                       |\n| `--type hook`   | Custom React hook                            |\n| `--with-test`   | Include test file                            |\n| `--with-story`  | Include Storybook story                      |\n| `--flat`        | Create in output dir without subdirectory    |\n| `--dry-run`     | Preview without creating files               |\n\n### Generated Component Example\n\n```tsx\n\"use client\";\n\nimport { useState } from \"react\";\nimport { cn } from \"@\u002Flib\u002Futils\";\n\ninterface ButtonProps {\n  className?: string;\n  children?: React.ReactNode;\n}\n\nexport function Button({ className, children }: ButtonProps) {\n  return \u003Cdiv className={cn(\"\", className)}>{children}\u003C\u002Fdiv>;\n}\n```\n\n---\n\n## Bundle Analysis\n\nAnalyze package.json and project structure for bundle optimization opportunities.\n\n### Workflow: Optimize Bundle Size\n\n1. Run the analyzer on your project:\n\n   ```bash\n   python scripts\u002Fbundle_analyzer.py \u002Fpath\u002Fto\u002Fproject\n   ```\n\n2. Review the health score and issues:\n\n   ```\n   Bundle Health Score: 75\u002F100 (C)\n\n   HEAVY DEPENDENCIES:\n     moment (290KB)\n       Alternative: date-fns (12KB) or dayjs (2KB)\n\n     lodash (71KB)\n       Alternative: lodash-es with tree-shaking\n   ```\n\n3. Apply the recommended fixes by replacing heavy dependencies.\n\n4. Re-run with verbose mode to check import patterns:\n   ```bash\n   python scripts\u002Fbundle_analyzer.py . --verbose\n   ```\n\n### Bundle Score Interpretation\n\n| Score  | Grade | Action                         |\n| ------ | ----- | ------------------------------ |\n| 90-100 | A     | Bundle is well-optimized       |\n| 80-89  | B     | Minor optimizations available  |\n| 70-79  | C     | Replace heavy dependencies     |\n| 60-69  | D     | Multiple issues need attention |\n| 0-59   | F     | Critical bundle size problems  |\n\n### Heavy Dependencies Detected\n\nThe analyzer identifies these common heavy packages:\n\n| Package       | Size  | Alternative                    |\n| ------------- | ----- | ------------------------------ |\n| moment        | 290KB | date-fns (12KB) or dayjs (2KB) |\n| lodash        | 71KB  | lodash-es with tree-shaking    |\n| axios         | 14KB  | Native fetch or ky (3KB)       |\n| jquery        | 87KB  | Native DOM APIs                |\n| @mui\u002Fmaterial | Large | shadcn\u002Fui or Radix UI          |\n\n---\n\n## React Patterns\n\nReference: `references\u002Freact_patterns.md`\n\n### Compound Components\n\nShare state between related components:\n\n```tsx\nconst Tabs = ({ children }) => {\n  const [active, setActive] = useState(0);\n  return (\n    \u003CTabsContext.Provider value={{ active, setActive }}>\n      {children}\n    \u003C\u002FTabsContext.Provider>\n  );\n};\n\nTabs.List = TabList;\nTabs.Panel = TabPanel;\n\n\u002F\u002F Usage\n\u003CTabs>\n  \u003CTabs.List>\n    \u003CTabs.Tab>One\u003C\u002FTabs.Tab>\n    \u003CTabs.Tab>Two\u003C\u002FTabs.Tab>\n  \u003C\u002FTabs.List>\n  \u003CTabs.Panel>Content 1\u003C\u002FTabs.Panel>\n  \u003CTabs.Panel>Content 2\u003C\u002FTabs.Panel>\n\u003C\u002FTabs>;\n```\n\n### Custom Hooks\n\nExtract reusable logic:\n\n```tsx\nfunction useDebounce\u003CT>(value: T, delay = 500): T {\n  const [debouncedValue, setDebouncedValue] = useState(value);\n\n  useEffect(() => {\n    const timer = setTimeout(() => setDebouncedValue(value), delay);\n    return () => clearTimeout(timer);\n  }, [value, delay]);\n\n  return debouncedValue;\n}\n\n\u002F\u002F Usage\nconst debouncedSearch = useDebounce(searchTerm, 300);\n```\n\n### Render Props\n\nShare rendering logic:\n\n```tsx\nfunction DataFetcher({ url, render }) {\n  const [data, setData] = useState(null);\n  const [loading, setLoading] = useState(true);\n\n  useEffect(() => {\n    fetch(url)\n      .then((r) => r.json())\n      .then(setData)\n      .finally(() => setLoading(false));\n  }, [url]);\n\n  return render({ data, loading });\n}\n\n\u002F\u002F Usage\n\u003CDataFetcher\n  url=\"\u002Fapi\u002Fusers\"\n  render={({ data, loading }) =>\n    loading ? \u003CSpinner \u002F> : \u003CUserList users={data} \u002F>\n  }\n\u002F>;\n```\n\n---\n\n## Next.js Optimization\n\nReference: `references\u002Fnextjs_optimization_guide.md`\n\n### Server vs Client Components\n\nUse Server Components by default. Add 'use client' only when you need:\n\n- Event handlers (onClick, onChange)\n- State (useState, useReducer)\n- Effects (useEffect)\n- Browser APIs\n\n```tsx\n\u002F\u002F Server Component (default) - no 'use client'\nasync function ProductPage({ params }) {\n  const product = await getProduct(params.id); \u002F\u002F Server-side fetch\n\n  return (\n    \u003Cdiv>\n      \u003Ch1>{product.name}\u003C\u002Fh1>\n      \u003CAddToCartButton productId={product.id} \u002F> {\u002F* Client component *\u002F}\n    \u003C\u002Fdiv>\n  );\n}\n\n\u002F\u002F Client Component\n(\"use client\");\nfunction AddToCartButton({ productId }) {\n  const [adding, setAdding] = useState(false);\n  return \u003Cbutton onClick={() => addToCart(productId)}>Add\u003C\u002Fbutton>;\n}\n```\n\n### Image Optimization\n\n```tsx\nimport Image from 'next\u002Fimage';\n\n\u002F\u002F Above the fold - load immediately\n\u003CImage\n  src=\"\u002Fhero.jpg\"\n  alt=\"Hero\"\n  width={1200}\n  height={600}\n  priority\n\u002F>\n\n\u002F\u002F Responsive image with fill\n\u003Cdiv className=\"relative aspect-video\">\n  \u003CImage\n    src=\"\u002Fproduct.jpg\"\n    alt=\"Product\"\n    fill\n    sizes=\"(max-width: 768px) 100vw, 50vw\"\n    className=\"object-cover\"\n  \u002F>\n\u003C\u002Fdiv>\n```\n\n### Data Fetching Patterns\n\n```tsx\n\u002F\u002F Parallel fetching\nasync function Dashboard() {\n  const [user, stats] = await Promise.all([getUser(), getStats()]);\n  return \u003Cdiv>...\u003C\u002Fdiv>;\n}\n\n\u002F\u002F Streaming with Suspense\nasync function ProductPage({ params }) {\n  return (\n    \u003Cdiv>\n      \u003CProductDetails id={params.id} \u002F>\n      \u003CSuspense fallback={\u003CReviewsSkeleton \u002F>}>\n        \u003CReviews productId={params.id} \u002F>\n      \u003C\u002FSuspense>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n---\n\n## Accessibility and Testing\n\nReference: `references\u002Ffrontend_best_practices.md`\n\n### Accessibility Checklist\n\n1. **Semantic HTML**: Use proper elements (`\u003Cbutton>`, `\u003Cnav>`, `\u003Cmain>`)\n2. **Keyboard Navigation**: All interactive elements focusable\n3. **ARIA Labels**: Provide labels for icons and complex widgets\n4. **Color Contrast**: Minimum 4.5:1 for normal text\n5. **Focus Indicators**: Visible focus states\n\n```tsx\n\u002F\u002F Accessible button\n\u003Cbutton\n  type=\"button\"\n  aria-label=\"Close dialog\"\n  onClick={onClose}\n  className=\"focus-visible:ring-2 focus-visible:ring-blue-500\"\n>\n  \u003CXIcon aria-hidden=\"true\" \u002F>\n\u003C\u002Fbutton>\n\n\u002F\u002F Skip link for keyboard users\n\u003Ca href=\"#main-content\" className=\"sr-only focus:not-sr-only\">\n  Skip to main content\n\u003C\u002Fa>\n```\n\n### Testing Strategy\n\n```tsx\n\u002F\u002F Component test with React Testing Library\nimport { render, screen } from \"@testing-library\u002Freact\";\nimport userEvent from \"@testing-library\u002Fuser-event\";\n\ntest(\"button triggers action on click\", async () => {\n  const onClick = vi.fn();\n  render(\u003CButton onClick={onClick}>Click me\u003C\u002FButton>);\n\n  await userEvent.click(screen.getByRole(\"button\"));\n  expect(onClick).toHaveBeenCalledTimes(1);\n});\n\n\u002F\u002F Test accessibility\ntest(\"dialog is accessible\", async () => {\n  render(\u003CDialog open={true} title=\"Confirm\" \u002F>);\n\n  expect(screen.getByRole(\"dialog\")).toBeInTheDocument();\n  expect(screen.getByRole(\"dialog\")).toHaveAttribute(\"aria-labelledby\");\n});\n```\n\n---\n\n## Quick Reference\n\n### Common Next.js Config\n\n```js\n\u002F\u002F next.config.js\nconst nextConfig = {\n  images: {\n    remotePatterns: [{ hostname: \"cdn.example.com\" }],\n    formats: [\"image\u002Favif\", \"image\u002Fwebp\"],\n  },\n  experimental: {\n    optimizePackageImports: [\"lucide-react\", \"@heroicons\u002Freact\"],\n  },\n};\n```\n\n### Tailwind CSS Utilities\n\n```tsx\n\u002F\u002F Conditional classes with cn()\nimport { cn } from \"@\u002Flib\u002Futils\";\n\n\u003Cbutton\n  className={cn(\n    \"px-4 py-2 rounded\",\n    variant === \"primary\" && \"bg-blue-500 text-white\",\n    disabled && \"opacity-50 cursor-not-allowed\",\n  )}\n\u002F>;\n```\n\n### TypeScript Patterns\n\n```tsx\n\u002F\u002F Props with children\ninterface CardProps {\n  className?: string;\n  children: React.ReactNode;\n}\n\n\u002F\u002F Generic component\ninterface ListProps\u003CT> {\n  items: T[];\n  renderItem: (item: T) => React.ReactNode;\n}\n\nfunction List\u003CT>({ items, renderItem }: ListProps\u003CT>) {\n  return \u003Cul>{items.map(renderItem)}\u003C\u002Ful>;\n}\n```\n\n---\n\n## Resources\n\n- React Patterns: `references\u002Freact_patterns.md`\n- Next.js Optimization: `references\u002Fnextjs_optimization_guide.md`\n- Best Practices: `references\u002Ffrontend_best_practices.md`\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,139,1925,"2026-05-16 13:38:44",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"前端开发","frontend","mdi-language-html5","HTML\u002FCSS\u002FJavaScript\u002F框架相关",1,96,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"a3bb54a5-2402-4e3e-916b-6f6f3b95419d","1.0.0","senior-frontend.zip",37871,"uploads\u002Fskills\u002Fda3c8756-1871-45c2-84ad-f12a58e1559f\u002Fsenior-frontend.zip","e2cb5cdcde8ce5a08fd4ea36c24c784b665860994066f026a92b4e87b8c830f2","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":12485},{\"path\":\"references\u002Ffrontend_best_practices.md\",\"isDirectory\":false,\"size\":19783},{\"path\":\"references\u002Fnextjs_optimization_guide.md\",\"isDirectory\":false,\"size\":15123},{\"path\":\"references\u002Freact_patterns.md\",\"isDirectory\":false,\"size\":17341},{\"path\":\"scripts\u002Fbundle_analyzer.py\",\"isDirectory\":false,\"size\":13339},{\"path\":\"scripts\u002Fcomponent_generator.py\",\"isDirectory\":false,\"size\":8684},{\"path\":\"scripts\u002Ffrontend_scaffolder.py\",\"isDirectory\":false,\"size\":27981}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]