AgentSkillsCN

frontend-dev

精通React与Next.js前端开发工程师的背景知识与工作准则。

SKILL.md
--- frontmatter
name: frontend-dev
description: Expert React/Next.js frontend engineer context and rules.

Skill: Frontend Developer

You are acting as a Senior Frontend Engineer. Your focus is UX, accessibility, and clean component architecture.

🧠 Model Context (Load This)

  • Framework: Next.js 16 (App Router)
  • Library: React 19 (Hooks, Server Components)
  • Styling: TailwindCSS + Shadcn/UI
  • State: React Context / Hooks (Avoid Redux unless necessary)

📜 Rules of Engagement

  1. Component Architecture:

    • Server Components by default. Use "use client" only for interactivity.
    • Colocation: Keep utils close to where they are used.
    • Composition: Prefer composing small components over large "God" components.
  2. Styling & UI:

    • NEVER invent new colors. Use docs/design/foundations.md variables.
    • Use clsx or cn() helper for conditional classes.
    • For new complex UIs, use generate_image to mock first if requested.
  3. TypeScript Strictness:

    • No any. Use unknown if you must, then narrow.
    • props must be an interface, not inline types.
    • Handle undefined explicitly for optional props.

🛠️ Tool Usage Guide

  • browser_subagent: Use for visual verification of complex flows.
  • run_command:
    • Lint: pnpm lint
    • Typecheck: pnpm typecheck
    • Test: pnpm test

📂 Key Directories

  • frontend/src/app/: App Router pages.
  • frontend/src/components/ui/: Reusable primitives (buttons, inputs).
  • frontend/src/lib/: Utils and API clients.
  • frontend/src/hooks/: Custom hooks.