AGENT SKILL

tdd-workflow

Test-Driven Development workflow for Claude Code. Use when implementing features with TDD, writing tests first, or need Red-Green-Refactor discipline. Triggers on TDD, test-driven, red-green-refactor, test first, or write tests before code keywords.

License 许可
MIT
最近更新
2026-05-18
Stars
★ 0
Forks
0

01 前言 Front Matter

name
tdd-workflow
description
Test-Driven Development workflow for Claude Code. Use when implementing features with TDD, writing tests first, or need Red-Green-Refactor discipline. Triggers on TDD, test-driven, red-green-refactor, test first, or write tests before code keywords.

03 SKILL.md 正文

TDD Workflow

Strict Red-Green-Refactor cycle for Test-Driven Development.

Phases

RED: Write a failing test

  1. Identify the smallest unit of behavior to implement
  2. Write a test that describes the expected behavior
  3. Run the test — it MUST fail
  4. If it passes, the test is wrong or the feature already exists
// Vitest pattern for Aurion
import { describe, it, expect } from 'vitest';

describe('featureName', () => {
  it('should [expected behavior] when [condition]', () => {
    // Arrange
    const input = /* ... */;
    
    // Act
    const result = featureUnderTest(input);
    
    // Assert
    expect(result).toBe(/* expected */);
  });
});

GREEN: Make it pass

  1. Write the MINIMUM code to make the test pass
  2. No optimization, no elegance — just make it work
  3. Run the test — it MUST pass
  4. If it fails, fix the implementation (not the test)

Rules:

  • TypeScript strict, zero any
  • Hardcoded values are OK in this phase
  • Don't write more code than needed

REFACTOR: Clean up

  1. Improve the code without changing behavior
  2. ALL tests must still pass after refactoring
  3. Remove duplication
  4. Improve naming
  5. Apply Aurion patterns (Tailwind, Framer Motion, etc.)

Checklist:

  • [ ] All tests still pass
  • [ ] No duplicate code
  • [ ] TypeScript strict compliance
  • [ ] Aurion conventions followed

Cycle

RED → GREEN → REFACTOR → RED → GREEN → REFACTOR → ...

Repeat for each behavior. Build up complexity gradually.

Running Tests

# Single test file
npx vitest run path/to/test.test.ts

# Watch mode during development
npx vitest --watch path/to/test.test.ts

# With coverage
npx vitest run --coverage

Aurion Test Patterns

  • Mock Supabase: vi.mock('@supabase/supabase-js')
  • Mock Clerk: vi.mock('@clerk/clerk-react')
  • Mock fetch: vi.stubGlobal('fetch', vi.fn())
  • React Testing Library for components
  • Playwright for E2E

04 同仓库更多 Skills

aicreator350
aicreator350/aurionOFFICIELLE

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

★ 0
aicreator350
aicreator350/aurionOFFICIELLE

web-design-guidelines

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

★ 0
aicreator350
aicreator350/aurionOFFICIELLE

vercel-react-view-transitions

Guide for implementing smooth, native-feeling animations using React's View Transition API (`<ViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter/exit of components, animate list reorder, implement directional (forward/back) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.

★ 0
aicreator350
aicreator350/aurionOFFICIELLE

vercel-react-best-practices

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

★ 0
aicreator350
aicreator350/aurionOFFICIELLE

vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

★ 0
aicreator350
aicreator350/aurionOFFICIELLE

vercel-cli-with-tokens

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

★ 0