test-driven-development
Red-green-refactor discipline for writing code driven by tests. Covers the TDD cycle, test quality, mocking boundaries, and design for testability. Use when: implementing features, fixing bugs, refactoring existing code, designing module interfaces, or working within vertical slices from a tracer-bullets workflow.
What this skill does
# Test-Driven Development Write one failing test that describes the next behavior, write the minimal code to pass it, then refactor while green. Every production change starts with a test that proves the need exists. This is the discipline within each vertical slice — not framework syntax, but when and why to write tests. Skip for exploratory prototyping, config-only changes (environment variables, feature flags), visual/CSS-only tweaks, and one-off scripts that won't be maintained. ## Quick Reference — TDD Cycle | Phase | Action | Rule | | -------- | ------------------------------------------------ | ------------------------------------------- | | RED | Write one test that fails for the right reason | No production code without a failing test | | GREEN | Write the simplest code that makes the test pass | Resist the urge to generalize prematurely | | REFACTOR | Improve structure while all tests stay green | Never change behavior and structure at once | ## Quick Reference — Principles | Principle | Practice | | ---------------------------- | ---------------------------------------------------------------------------------- | | One test at a time | Complete the full red-green-refactor cycle before writing the next test | | Behavior over implementation | Test what code does, not how it does it; assert outputs and side effects | | Vertical slices | TDD one end-to-end behavior at a time, not one layer at a time | | Mock at boundaries | Mock I/O, network, filesystem, clock. Never mock internal collaborators | | Deep modules | Design small interfaces with rich internals; fewer tests cover more behavior | | Refactor only when green | All tests pass before touching structure; refactoring under red hides new bugs | | Design through tests | The first test IS the API design decision; awkward tests signal awkward interfaces | | Failing test for every bug | Reproduce the bug as a failing test before writing the fix | ## Planning Before Coding | Step | Action | Output | | ---- | ------------------------ | ------------------------------------------------------ | | 1 | Identify behaviors | List of observable behaviors the feature must exhibit | | 2 | Order by dependency | Sequence where each test builds on prior passing tests | | 3 | Design the interface | Function signatures, parameter types, return types | | 4 | Identify mock boundaries | External dependencies that need test doubles | ## Common Mistakes | Mistake | Correct Pattern | | ---------------------------------- | ---------------------------------------------------------------------------- | | Writing all tests first | One test at a time. Complete the cycle before starting the next | | Testing private methods | Test through the public interface; private methods are implementation detail | | Mocking internal collaborators | Only mock at I/O boundaries; trust your own code | | Writing code before a failing test | RED first. The failing test proves the behavior is missing | | Refactoring while tests are red | Get to GREEN first, then refactor with confidence | | Tests coupled to call sequences | Assert on outputs and state, not on which internal methods were called | | Skipping the refactor phase | GREEN is not done. Clean up duplication and naming before moving on | | Hardcoding expected values | Use triangulation: add a second test case to force the general solution | | One giant test per feature | One test per behavior — small, focused, independently meaningful | ## Delegation - **Slice decomposition**: If the `tracer-bullets` skill is available, use it to decompose features into vertical slices before applying TDD within each slice - **Test framework syntax**: Delegate framework-specific patterns to `vitest-testing`, `e2e-testing`, or `api-testing` skills - **Feature planning**: If the `plan-first-development` skill is available, use it for upfront planning before entering the TDD cycle - **Individual TDD cycles**: Delegate each red-green-refactor cycle to a `Task` subagent to keep context focused ## References - [Test Quality](references/test-quality.md) — good vs bad tests, what to test, naming, triangulation, refactoring signals - [Mocking Boundaries](references/mocking-boundaries.md) — boundary rule, test doubles, dependency injection, anti-patterns - [Design for Testability](references/design-for-testability.md) — deep modules, interface-first design, pure functions, computation vs I/O
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.