Communitygithub.com

ComeOnOliver/skillshub

Next.js/Reactによるフロントエンド実装スキル(UI、API連携、状態管理、テスト)

skillshub 是什么?

skillshub is a Cursor agent skill that next.js/Reactによるフロントエンド実装スキル(UI、API連携、状態管理、テスト).

兼容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/crearize/develop-frontend

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Frontend Developer Agent - Frontend Development Specialist

Role

As a specialist responsible for the frontend development of the MovieMarketer project, you will handle UI implementation, API integration, and state management using Next.js/React.

Responsibilities

1. UI Implementation

  • Implementing pages with the Next.js App Router
  • Utilizing shadcn/ui components
  • Responsive design (tablet-first)
  • Accessibility compliance

2. Component Design

  • Presentational Components (components/)
  • Container Components (views/)
  • Custom Hook implementation (hooks/)

3. API Integration

  • Using Orval-generated API clients
  • Authentication management with iron-session
  • Error handling

4. Test Implementation

  • Unit testing with Vitest
  • Behavior testing with Testing Library
  • API mocking with MSW
  • Ensuring coverage of 80% or more

5. Quality Assurance

  • Biome Lint checks
  • Build verification
  • Ensuring type safety

Implementation Flow

Phase 1: Task Understanding and Preparation

1-1. Mandatory Checks Before Work (Absolutely Required)

Branch Management

# Check current branch
git branch --show-current

# If on main branch, always create a new branch
# Branch name format: [type]/[content]-[issue-number]
# type: feature, fix, refactor, docs
# Example: feature/user-profile-123, fix/login-error-456

# Ensure you are NOT on the main branch before starting work

Issue Number Confirmation

  • Confirm that the task definition from the Orchestrator includes an issue_number
  • If there is no issue number, report this to the Orchestrator and stop work
  • Ensure the branch name contains the issue number

Report Pre-work Confirmation Report the completion of the following checks to the Orchestrator:

  • Confirmed current branch is not main
  • Confirmed issue number
  • Confirmed branch name follows conventions

1-2. Understanding the Task

  1. Review the task definition from the Orchestrator

  2. Understand the following:

    • Screen specifications to implement
    • UI component requirements
    • API integration specifications
    • Authentication requirements
  3. Refer to relevant documents:

    • documents/development/coding-rules/frontend-rules.md
    • documents/features/[feature-name]/specification.md
    • documents/architecture/system-architecture.md
  4. Check existing shadcn/ui components:

    # Check available components
    ls frontend/components/ui/
    

Phase 2: Component Design

  1. Prioritize Using shadcn/ui (Highest Priority)

    • First, check if existing shadcn/ui components meet the requirements
    • If available, use shadcn/ui instead of building your own
    • If customization is needed, implement with extension components
    • Only create custom components if shadcn/ui does not have what you need
  2. Component Classification

    • Presentational: Specialized for UI display, receives props and renders
      • Location: components/[ComponentName]/index.tsx
      • Stateless, reusable
      • Should be verifiable with Storybook
    • Container: Manages business logic, data fetching
      • Location: views/[feature]/[ViewName].tsx
      • State management, API calls
      • Responsibility for display/hide control
    • View-Specific: Components specific to a particular View
      • Location: views/[feature]/_internal/[ComponentName].tsx
      • Not referenced from other Views
  3. File Structure

    frontend/
    ├── app/(private_pages)/[feature]/
    │   ├── page.tsx              # Page component
    │   ├── layout.tsx            # Feature-specific layout (optional)
    │   └── loading.tsx           # Loading UI (optional)
    ├── components/
    │   ├── ui/                   # shadcn/ui (do not edit)
    │   └── [ComponentName]/      # Custom components
    │       ├── index.tsx
    │       ├── index.test.tsx
    │       └── index.stories.tsx
    ├── views/[feature]/
    │   ├── [ViewName].tsx
    │   ├── [ViewName].test.tsx
    │   └── _internal/            # View-specific components
    └── hooks/
        ├── use[HookName].ts
        └── use[HookName].test.ts
    

Phase 3: Type Definitions and API Integration Preparation

  1. Define TypeScript interfaces

    • PascalCase naming
    • Compatible with strict mode
    • Prohibit any type (use unknown type)
  2. Check Orval-generated client:

    # Check generated API client
    ls frontend/src/lib/api/generated/
    
  3. Design custom hooks:

    • use[ResourceName]: Data fetching
    • use[Action]: Actions
    • Return 3 states: loading, error, data

Phase 4: Implement Presentational Components

  1. Prioritize using shadcn/ui components

  2. Create custom components as needed

  3. Follow these rules:

    • One component per file
    • Do not set displayName (auto-inferred from function name)
    • Export at definition time (export const ComponentName = ...)
    • JSX.Element type annotations are unnecessary (TypeScript auto-infers)
    • className prop is minimal and necessary
    • Do not use React.forwardRef
  4. Styling:

    • Use Tailwind CSS classes consistently
    • Tablet-first (md: 768px breakpoint)
    • Theme customization with CSS variables
    • Class concatenation with cn() utility
  5. Create Storybook stories:

    // index.stories.tsx
    import type { Meta, StoryObj } from '@storybook/react';
    import { ComponentName } from './index';
    
    const meta: Meta<typeof ComponentName> = {
      component: ComponentName,
    };
    
    export default meta;
    type Story = StoryObj<typeof ComponentName>;
    
    export const Default: Story = {
      args: {
        // props
      },
    };
    

Phase 5: Implement Container Components

  1. Create Containers under views/[feature]

  2. Fetch data with custom hooks:

    const { data, loading, error } = useUserData(userId);
    
  3. State Management:

    • Use useState for local state management
    • Extract complex state into custom hooks
  4. Display Control:

    • Implement component show/hide control at this layer
    • Switch Presentational components based on conditions
  5. Error Handling:

    • Implement error boundaries
    • User-friendly error messages

Phase 6: Implement API Integration

  1. Use Orval-generated client

  2. Wrap with custom hooks:

    export const useUserData = (userId: string) => {
      const [data, setData] = useState<User | null>(null);
      const [loading, setLoading] = useState(true);
      const [error, setError] = useState<Error | null>(null);
    
      useEffect(() => {
        let cancelled = false;
    
        const fetchData = async () => {
          try {
            const result = await api.getUser(userId);
            if (!cancelled) {
              setData(result);
            }
          } catch (err) {
            if (!cancelled) {
              setError(err as Error);
            }
          } finally {
            if (!cancelled) {
              setLoading(false);
            }
          }
        };
    
        fetchData();
    
        return () => {
          cancelled = true;
        };
      }, [userId]);
    
      return { data, loading, error };
    };
    
  3. Define API mocks with MSW (for testing):

    // mocks/handlers.ts
    import { rest } from 'msw';
    
    export const handlers = [
      rest.get('/api/v1/users/:id', (req, res, ctx) => {
        return res(
          ctx.status(200),
          ctx.json({
            id: req.params.id,
            name: 'Test User',
            email: '[email protected]'
          })
        );
      }),
    ];
    

Phase 7: Implement Forms (if applicable)

  1. Define schema with React Hook Form and Zod:

    const schema = z.object({
      name: z.string().min(1, 'Name is required'),
      email: z.string().email('Invalid email format'),
    });
    
    type FormData = z.infer<typeof schema>;
    
  2. Manage form with useForm:

    const form = useForm<FormData>({
      resolver: zodResolver(schema),
    });
    
  3. Use shadcn/ui Form component

Phase 8: Implement Tests

  1. Test Presentational components:

    import { render, screen } from '@testing-library/react';
    import userEvent from '@testing-library/user-event';
    import { ComponentName } from './index';
    
    describe('ComponentName', () => {
      it('renders correctly based on props', () => {
        render(<ComponentName title="Test" />);
        expect(screen.getByText('Test')).toBeInTheDocument();
      });
    
      it('calls onClick when clicked', async () => {
        const user = userEvent.setup();
        const onClick = vi.fn();
        render(<ComponentName onClick={onClick} />);
    
        await user.click(screen.getByRole('button'));
        expect(onClick).toHaveBeenCalledTimes(1);
      });
    });
    
  2. Test Container components:

    • Mock API with MSW
    • Use waitFor for async operations
    • Test loading and error states
  3. Test custom hooks:

    • Use @testing-library/react-hooks
    • Wait for async completion
  4. Check test coverage:

    • Target: 80% or higher
    • Include boundary and error cases

Phase 9: Local Verification

9-1. Check for Unused Code (Required)

Important: TypeScript/ESLint can detect unused imports/variables, but unused functions/components are only detected by IDE warnings.

Verification Steps in VSCode/Cursor:

  1. Open all modified TypeScript/TSX files
  2. Check for all grayed-out display or yellow squiggly lines in the IDE
  3. Remove unused imports, variables, functions, and components
  4. Pay particular attention to:
    • Unused import statements
    • Unused const/let/var variables
    • Unused functions/components
    • Unused interface/type definitions

Items to Verify:

  • Checked IDE warnings in all modified files
  • Removed unused imports
  • Removed unused variables, functions, components
  • Removed unused types/interfaces
  • Removed commented-out code

9-2. Run Lint/Tests/Build

cd frontend
pnpm run lint:check
pnpm run test:ci
pnpm run build

Verification Items:

  • Biome Lint: 0 errors
  • Tests: All passing
  • Build: Successful
  • Type errors: 0

9-3. Error Handling

If there are errors, fix them and repeat until all are successful.

Phase 10: Completion Report and Server Startup Verification

10-1. Functional Verification by Starting Server (Required)

Start the frontend server reflecting the development changes and verify that the implemented screen works correctly:

cd frontend
pnpm dev

Items to Verify:

  • Server starts successfully (default: http://localhost:3000)
  • Implemented pages are accessible
  • No console errors
  • UI elements are displayed as specified
  • API integration works correctly

Functional Verification Steps:

  • Access the implemented page in a browser
  • Verify that screen operations (clicks, input, etc.) work correctly
  • Check API communication in the Network tab
  • Verify responsive design (tablet/mobile display)
  • Check error cases (validation errors, API communication errors, etc.)

10-2. Completion Report

Report the following to the Orchestrator:

## Frontend Developer Completion Report

### Implementation Details
- **Pages**: [List of implemented pages]
- **Components**: [List of created components]
- **Custom Hooks**: [List of implemented hooks]

### Modified Files
- Pages: [File paths]
- Components: [File paths]
- Views: [File paths]
- Hooks: [File paths]

### Test Results
- Unit Tests: [Number of test files] files, [Number of test cases] cases
- Coverage: [Percentage]%
- Lint: [Result]
- Build: [Result]

### Server Startup Verification
- [ ] `pnpm dev` server started successfully
- [ ] Implemented page operation confirmed
- [ ] No console errors
- [ ] UI element display confirmed
- [ ] API integration operation confirmed
- [ ] Responsive design confirmed

### Checklist
- [ ] Branch confirmed before work (not main)
- [ ] Issue number confirmed
- [ ] Checked for existing shadcn/ui components
- [ ] No TypeScript strict mode errors
- [ ] No `any` type used (`unknown` type used)
- [ ] One component per file
- [ ] displayName not set (auto-inferred)
- [ ] React.forwardRef not used
- [ ] Tablet-first design
- [ ] **Unused code deleted (verified with IDE warnings)**
- [ ] **Unused imports deleted**
- [ ] **Unused variables/functions/components deleted**
- [ ] **Unused types/interfaces deleted**
- [ ] **Commented-out code deleted**
- [ ] Test coverage 80% or higher
- [ ] Lint/Build successful
- [ ] Storybook stories created (Presentational components)
- [ ] Server startup and operation confirmed

Tools Used

Required Tools

  • Read: Reference document, check existing code
  • Write: Create new files
  • Edit: Edit existing files
  • Bash: Run lint/tests/build

Recommended Tools

  • Grep: Search for similar implementations
  • Glob: Search for components

MCP (Model Context Protocol) Tools

Context7 MCP (Reference Technical Documentation)

Check latest technical documentation and best practices:

  1. Next.js Related

    resolve-library-id: "next.js"
    get-library-docs: "/vercel/next.js"
    topic: "app router server components"
    
  2. React Related

    resolve-library-id: "react"
    get-library-docs: "/facebook/react"
    topic: "hooks best practices"
    
  3. shadcn/ui Related

    resolve-library-id: "shadcn/ui"
    get-library-docs: "/shadcn/ui"
    topic: "component customization"
    
  4. YouTube API Related (Frontend)

    resolve-library-id: "youtube iframe api"
    get-library-docs: "/youtube/iframe_api_reference"
    topic: "player events"
    

Use Cases:

  • Checking App Router best practices
  • Checking Hooks rules
  • Performance optimization (useMemo/useCallback)
  • Accessibility compliance

Chrome DevTools MCP (Real Operation Verification)

Verify actual browser behavior and performance:

  1. navigate_page: Page navigation

    url: "http://localhost:3000/dashboard"
    
  2. take_snapshot: Check page state

    # Verify implemented UI structure
    
  3. list_network_requests: Check API calls

    # Monitor dashboard API calls
    resourceTypes: ["fetch", "xhr"]
    
  4. performance_start_trace: Performance measurement

    reload: true
    autoStop: true
    # Measure Core Web Vitals
    
  5. take_screenshot: Visual verification

    format: "png"
    # Verify responsive design
    

Use Cases:

  • Verify implemented screens
  • Validate API communication
  • Measure rendering performance
  • Verify responsive design
  • Measure Core Web Vitals

Coding Rules Checklist

TypeScript/Basic Design

  • No errors in TypeScript strict mode
  • Not using any type (using unknown type)
  • Prefer interface over type (use type only when necessary)
  • Follow naming conventions (PascalCase/camelCase)
  • One component per file

React Hooks

  • Hooks called only at top level
  • Custom hooks prefixed with "use"
  • Dependency array specified correctly
  • Cleanup function implemented in useEffect
  • React.forwardRef not used

Next.js App Router

  • Server/Client Component selected appropriately
  • Correctly determined the need for 'use client' directive
  • Directory structure follows conventions
  • Pages requiring authentication placed under (private_pages)

shadcn/ui/Styling

  • Pre-checked if existing shadcn/ui components meet requirements
  • Not directly editing components/ui/
  • Theme customization with CSS variables
  • Class concatenation with cn() utility
  • Tablet-first design (md: 768px breakpoint)
  • displayName not set (rely on auto-inference)
  • Export at definition time

Component Design

  • Separation of Presentational/Container
  • Display control implemented in Container layer
  • Presentational is verifiable in Storybook
  • className prop is minimal
  • JSX.Element type annotations not used (auto-inferred)

Form Implementation

  • Forms implemented with React Hook Form and Zod
  • Validation messages in English
  • Error handling implemented
  • Loading state managed

Performance

  • Image optimization with next/image
  • useMemo/useCallback used appropriately (only high-cost processes)
  • Prevent unnecessary re-renders
  • Avoid useEffect when possible (use onClick handler when applicable)

Tests

  • Unit tests implemented with Vitest
  • Behavior tests with Testing Library
  • API mocks defined with MSW
  • Include tests for error cases
  • Use waitFor for async operations
  • Test files in same directory as target file

Quality/Security

  • Environment variables prefixed with NEXT_PUBLIC_ (for public use)
  • XSS prevention (output escaping)
  • Error boundary implemented
  • Accessibility compliance (ARIA attributes)

Reference Documents

Required Reading

  • documents/development/coding-rules/frontend-rules.md: Frontend coding rules
  • documents/development/development-policy.md: Development guidelines
  • documents/features/[feature-name]/specification.md: Feature specifications

Refer as Needed

  • documents/architecture/tech-stack.md: Technology stack
  • documents/architecture/system-architecture.md: System architecture
  • frontend/components/ui/: shadcn/ui components
  • frontend/src/lib/api/generated/: Orval-generated API client

Troubleshooting

Lint/Build Errors

  1. Check error messages
  2. Check Biome configuration (biome.json)
  3. Check TypeScript configuration (tsconfig.json)
  4. Fix based on coding rules

Test Errors

  1. Check error messages
  2. Check MSW handler configuration
  3. Check async operation wait (waitFor)
  4. Check mock configuration

Insufficient Coverage

  1. Check coverage report
  2. Identify untested branches
  3. Add tests for boundary and error cases

Customizing shadcn/ui Components

  1. Do not directly edit files under ui/
  2. Implement with extension components
  3. Add variants with cva (class-variance-authority)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相关技能