一键导入
frontend-developer
Use when building web UI, designing component architecture, or reviewing frontend code — regardless of framework (React, Vue, Svelte, etc.)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when building web UI, designing component architecture, or reviewing frontend code — regardless of framework (React, Vue, Svelte, etc.)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Use when implementing any feature or bugfix, before writing implementation code
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Use when you have a spec or requirements for a multi-step task, before touching code
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
| name | frontend-developer |
| description | Use when building web UI, designing component architecture, or reviewing frontend code — regardless of framework (React, Vue, Svelte, etc.) |
Philosophy: Component-first. User-perception-first. Accessibility is not optional. Performance is felt by users, not measured in isolation.
If the stack is unspecified, DO NOT default to Create React App. Ask:
| What | Why it matters |
|---|---|
| Framework? React / Vue / Svelte / vanilla | Determines patterns, tooling, idioms |
| Rendering? CSR / SSR / SSG / ISR | SEO and performance strategy |
| Design system? Custom / Tailwind / MUI / shadcn | Styling approach and constraints |
| Target browsers? Modern / IE support? | Determines APIs and CSS you can use |
When stack is unspecified, assume React + TypeScript + Next.js (App Router).
| Metric | Good | Needs Improvement | Poor |
|---|---|---|---|
| LCP (Largest Contentful Paint) | < 2.5s | 2.5–4s | > 4s |
| INP (Interaction to Next Paint) | < 200ms | 200–500ms | > 500ms |
| CLS (Cumulative Layout Shift) | < 0.1 | 0.1–0.25 | > 0.25 |
| FCP (First Contentful Paint) | < 1.8s | 1.8–3s | > 3s |
| TTFB (Time to First Byte) | < 800ms | 800ms–1.8s | > 1.8s |
| Bundle | Target | Action needed |
|---|---|---|
| Main JS (gzipped) | < 200KB | > 400KB: audit imports, code-split |
| Per-route chunk | < 50KB | > 100KB: lazy load heavy deps |
| CSS (gzipped) | < 50KB | > 100KB: purge unused styles |
| Images (hero) | < 200KB | Use next/image or WebP + lazy load |
| ❌ NEVER DO | Why | ✅ DO INSTEAD |
|---|---|---|
| Skip loading/error/empty states | User thinks the app is broken | Always handle all 3 async states |
onClick only (no keyboard handler) | Keyboard users excluded | Use <button>; it's free keyboard support |
Index as list key in dynamic lists | Reorder causes state and animation bugs | Unique stable ID from data |
Images without alt or explicit dimensions | Screen reader fail + CLS score hit | alt always; width/height or aspect-ratio always |
<div> for interactive elements | Not focusable, not semantic, no ARIA | Use <button>, <a>, or explicit role + tabIndex |
Sequential await for independent fetches | Each waits on the previous (waterfall) | Promise.all([fetchA(), fetchB()]) |
Barrel exports in app code (index.ts) | Defeats tree-shaking, slow cold start | Import directly from the source file |
| Import entire library for one function | Bundle bloat (e.g., import _ from 'lodash') | Named import or specific entry (lodash/debounce) |
| Client fetch where SSR/SSG would work | Slower FCP, worse SEO | Server-render or static-generate whenever possible |
| Rule | Detail |
|---|---|
| Color contrast (normal text) | ≥ 4.5:1 against background (WCAG AA) |
| Color contrast (large text, ≥18pt) | ≥ 3:1 against background |
| Touch / click target size | ≥ 44×44px (WCAG 2.5.5, Level AAA) |
| Focus indicator | Must be visible; outline: none without replacement is a violation |
| Form inputs | Must have <label> (associated via for/id or wrapping) |
| Images | Decorative → alt="", informative → descriptive alt |
| Interactive elements order | DOM order must match visual order for keyboard users |
When planning UI:
When reviewing components:
<label>?Must fix:
alt text or explicit dimensions (CLS risk)<label> elementsShould fix:
outline: none without visible focus replacementSlow initial load → Check bundle size, server render, remove unused deps
Layout shift (CLS) → Set image dimensions, avoid injecting content above fold
Janky interaction → Use CSS transforms, avoid forced layout (getBoundingClientRect in loops)
Too many re-renders → React DevTools Profiler → memo, useMemo, useCallback
Slow data fetch → Parallel with Promise.all(), SWR/React Query for cache
Large images → WebP format, srcset for responsive, lazy loading
When this skill is invoked, detect the project's framework and read
the matching reference file(s) from references/ before proceeding:
| Stack indicator | Reference file |
|---|---|
next.config.js/ts or react in deps | references/react-nextjs.md |
nuxt.config.ts or vue in deps | references/vue-nuxt.md |
svelte.config.js or svelte in deps | references/svelte-sveltekit.md |
| No framework deps / plain HTML | references/vanilla.md |
If the stack is unclear, ask the user which framework they're using.
For React/Next.js projects, references/react-rules/ contains 66
individual rule files from Vercel's agent-skills.
Each rule covers one specific pattern with incorrect/correct code examples.
Read references/react-rules/_sections.md for the full index
organized by priority (CRITICAL → LOW). Reference individual rules
when working on specific areas (waterfalls, bundle size, re-renders, SSR, etc.).
For Vue/Nuxt projects, references/vue-rules/ contains 44 individual
rule files from antfu/skills
(sourced from vuejs-ai/skills),
organized into three sub-directories:
best-practices/ — Components, reactivity, composables, performance (22 files)router/ — Vue Router guards, navigation, lifecycle gotchas (8 files)testing/ — Vitest, composable testing, Pinia setup, async patterns (11 files)Read the _index.md in each sub-directory for an overview.