frontend-dev
Frontend development skill for React, Next.js, Tailwind CSS, and TypeScript. Use when implementing web frontend features.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Frontend development skill for React, Next.js, Tailwind CSS, and TypeScript. Use when implementing web frontend features.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Orchestrates the async development workflow (design → develop → review → QA). Handles phase transitions when triggered by workflow-continue hook.
Autonomous development workflow that proactively asks questions, verifies implementation with tools, and auto-fixes linter errors. Use when implementing features to ensure quality through self-driven verification.
Backend development skill for Cloudflare Workers, D1 database, and REST API. Use when implementing API features.
iOS development skill for Swift, SwiftUI, Live Activities, WidgetKit, and XCTest. Use when implementing iOS features.
Core orchestration skill for the Claude Organization. Manages async sub-agents, worktrees, daily logs, and context handoff. This skill defines how the main Claude Code instance operates as Secretary to the CEO.
This skill should be used when the user asks about "refactoring", "code smells", "extract method", "extract class", "rename refactoring", "move method", or when improving code structure without changing behavior. Provides Martin Fowler's refactoring catalog and code smell detection.
| name | frontend-dev |
| description | Frontend development skill for React, Next.js, Tailwind CSS, and TypeScript. Use when implementing web frontend features. |
Platform-specific knowledge for web frontend development.
| Component | Technology |
|---|---|
| Framework | Next.js 14+ (App Router) |
| Language | TypeScript (strict mode) |
| Styling | Tailwind CSS |
| State | React hooks, Zustand (if needed) |
| Testing | Vitest, Playwright |
| Deployment | Cloudflare Pages |
PascalCasekebab-case.tsx or PascalCase.tsx (follow project)camelCaseSCREAMING_SNAKE_CASE// 1. External imports
import { useState } from 'react'
import { clsx } from 'clsx'
// 2. Internal imports
import { Button } from '@/components/ui/button'
import { useUser } from '@/hooks/use-user'
// 3. Types
interface Props {
title: string
onSubmit: () => void
}
// 4. Component
export function FeatureCard({ title, onSubmit }: Props) {
const [isOpen, setIsOpen] = useState(false)
return (
// ...
)
}
// Prefer composition over props drilling
export function Card({ children }: { children: React.ReactNode }) {
return <div className="rounded-lg border p-4">{children}</div>
}
Card.Header = function CardHeader({ children }: { children: React.ReactNode }) {
return <div className="font-bold">{children}</div>
}
Card.Body = function CardBody({ children }: { children: React.ReactNode }) {
return <div className="mt-2">{children}</div>
}
// Use clsx for conditional classes
import { clsx } from 'clsx'
<button
className={clsx(
'rounded px-4 py-2',
isActive ? 'bg-blue-500 text-white' : 'bg-gray-200'
)}
/>
// Extract common patterns
const buttonVariants = {
primary: 'bg-blue-500 text-white hover:bg-blue-600',
secondary: 'bg-gray-200 text-gray-800 hover:bg-gray-300',
}
# Install dependencies
pnpm install # or npm install
# Development
pnpm dev
# Type check
pnpm typecheck # or tsc --noEmit
# Lint
pnpm lint
# Build
pnpm build
# Test
pnpm test
app/
├── layout.tsx # Root layout
├── page.tsx # Home page
├── (marketing)/ # Route group (no URL segment)
│ ├── about/
│ │ └── page.tsx
│ └── pricing/
│ └── page.tsx
├── dashboard/
│ ├── layout.tsx # Dashboard layout
│ └── page.tsx
└── api/
└── route.ts # API route
// Server Component (default) - no 'use client'
async function ServerComponent() {
const data = await fetch('...') // Can fetch directly
return <div>{data}</div>
}
// Client Component - needs interactivity
'use client'
import { useState } from 'react'
function ClientComponent() {
const [count, setCount] = useState(0)
return <button onClick={() => setCount(c => c + 1)}>{count}</button>
}
// Server Component
async function Page() {
const data = await fetch('https://api.example.com/data', {
next: { revalidate: 60 } // ISR: revalidate every 60s
})
return <div>{data}</div>
}
// Client Component with SWR
'use client'
import useSWR from 'swr'
function ClientPage() {
const { data, error } = useSWR('/api/data', fetcher)
if (error) return <div>Error</div>
if (!data) return <div>Loading...</div>
return <div>{data}</div>
}
import { describe, it, expect } from 'vitest'
import { render, screen } from '@testing-library/react'
import { Button } from './button'
describe('Button', () => {
it('renders children', () => {
render(<Button>Click me</Button>)
expect(screen.getByText('Click me')).toBeInTheDocument()
})
})
import { test, expect } from '@playwright/test'
test('home page', async ({ page }) => {
await page.goto('/')
await expect(page.getByRole('heading', { name: 'Welcome' })).toBeVisible()
})
suppressHydrationWarning for dynamic contentcontent paths in tailwind.config.js