write-code
Write production-ready code end-to-end via a full TDD lifecycle (design, skeleton, implement, test, refactor). Triggers when: "write a function", "implement this feature", "build a new module", "add a feature". Also use when: starting a new component from scratch, turning a spec or ticket into working code, creating a CLI or API endpoint with tests. Examples: "write a function that parses dates", "implement user authentication", "build a rate limiter module".
What this skill does
# Write Code
Orchestrates the complete TDD lifecycle by composing atomic skills into a sequential pipeline, taking a feature instruction and driving it through project setup, design discovery, skeleton drafting, implementation, test fixing, optimization, and refactoring to produce production-ready, fully tested code. **Coherence Mandate.** Every edit must produce one continuous, deliberate work. Rewrite over restructure, restructure over integrate, never append. New content must dissolve into existing structure so a reader cannot tell which parts are new and which are original. Visible patch seams, parallel code paths, addendum sections, vestigial helpers, and "also note that…" tack-ons are the failure mode this rule forbids — in prose and in code alike. Because this orchestrator threads work through skeleton, implementation, fix, and refactor in turn, each downstream pass must absorb the previous one rather than sit beside it — the finished module should read as if a single author had written it in one sitting, with no archaeology of the staged passes visible in its surface.
## Purpose & Scope
**What this command does NOT do**:
- Create only a skeleton without implementation (use `/coding:draft-code`)
- Complete only TODO-marked placeholders (use `/coding:complete-code`)
- Fix only test/lint/type issues (use `/coding:fix`)
- Refactor without the full lifecycle (use `/coding:refactor`)
- Perform code review (use `/coding:review`)
**When to REJECT**:
- If the user only wants a scaffold/skeleton -> tell them to use `/coding:draft-code`
- If the user only wants to complete existing TODOs -> tell them to use `/coding:complete-code`
- If the user only wants to fix failing tests/lint/types -> tell them to use `/coding:fix`
- If the user has explicitly asked for a stack and only a stack (no implementation) -> redirect them to `/coding:commit --create-pr` directly
- If the instruction is too vague to define acceptance criteria
- If the target project has no testing framework configured
## Composition Structure
This is a **composite skill** that orchestrates the following atomic skills in sequence. Each child skill runs in `context: fork` and receives the `--from-composite` flag to suppress redundant confirmation gates.
```
write-code (this orchestrator)
|
|-- 1. Skill: coding:setup-project (conditional: only if no project exists)
|-- 2. Skill: coding:draft-code (Steps 0-1: design discovery + skeleton)
|-- 3. Skill: coding:complete-code (Step 2: implementation / green phase)
|-- 4. Skill: coding:fix (Steps 3-4: fix issues + optimize fixtures)
|-- 5. Skill: coding:refactor (Step 5: refactor + documentation)
|-- 6. Skill: coding:commit --create-pr (conditional: only if change is large or upstream stack exists)
```
### State Handover Between Steps
State is passed between child skills via handover documents (CONTEXT.md, NOTES.md, PLAN.md). Each child skill reads these documents for context and updates them upon completion.
### Resume Support
When `--resume` is provided, the orchestrator reads handover documents to determine which step to resume from:
- Files with `need-draft` -> resume from `coding:draft-code`
- Files with `need-completion` -> resume from `coding:complete-code`
- Files with `need-fixing` -> resume from `coding:fix`
- Files with `need-refactoring` -> resume from `coding:refactor`
### Composite Convention
When calling child skills, this orchestrator passes `--from-composite` as an argument. Child skills receiving this flag suppress their own confirmation gates and trust the orchestrator to handle user interaction.
## Workflow
ultrathink: you'd perform the following steps
### Step 1: Parse Arguments
1. **Extract Instruction**
- Parse `<instruction>` from $ARGUMENTS
- Identify feature requirements, scope, and acceptance criteria
- If instruction is ambiguous, ask for clarification before proceeding
2. **Detect Resume Mode**
- Check if `--resume` flag is present in $ARGUMENTS
- If `--resume`:
- Search for handover documents (CONTEXT.md, NOTES.md, PLAN.md) in the working directory
- Parse file substates from CONTEXT.md to determine which skill to resume from
- Extract change direction from PLAN.md next steps or NOTES.md open questions
- If handover files are missing, reject with: "No handover files found. Create them first with `/coding:handover`"
### Step 2: Conditional Project Setup
Check if the target project has essential structure (package.json, source directories, test framework).
- **If project is NOT set up**: Invoke `coding:setup-project` with the target path and `--from-composite`
- **If project IS set up**: Skip this step
### Step 3: Draft Code Skeleton (design + skeleton)
Invoke `coding:draft-code` with the parsed instruction and `--from-composite`.
This skill handles:
- Design direction discovery (searching for DESIGN.md, handover docs)
- Code skeleton creation with TODO placeholders
- Test structure creation with describe.todo/it.todo patterns
- TypeScript and lint validation of the skeleton
**Interactive gate**: After this skill completes, present the user with options:
1. Proceed to implementation
2. Request changes to the skeleton (re-run draft-code with change direction)
3. Resume from a different step
4. Pause and create handover documentation
### Step 4: Implementation (green phase)
Invoke `coding:complete-code` with the target area and `--from-composite`.
This skill handles:
- Replacing TODO placeholders with minimal working implementations
- TDD Green phase: implementing just enough code to make tests pass
- Continuous test execution to verify progress
**Interactive gate**: After this skill completes, present the user with options:
1. Proceed to fixing
2. Request changes to implementation (re-run complete-code with direction)
3. Resume from a different step
4. Pause and create handover documentation
### Step 5: Fix Issues and Optimize (fix + optimize)
Invoke `coding:fix` with the target area and `--from-composite`.
This skill handles:
- Fixing test issues and standards compliance
- Critical root cause analysis for test failures
- Optimizing test fixtures and mocks
- Batch processing for large file sets (>25 files)
**Interactive gate**: After this skill completes, present the user with options:
1. Proceed to refactoring
2. Request changes to fixes (re-run fix with specific notes)
3. Resume from a different step
4. Pause and create handover documentation
### Step 6: Refactor and Document
Invoke `coding:refactor` with the target area and `--from-composite`.
This skill handles:
- Code structure improvements without changing functionality
- Naming convention enforcement
- Comprehensive JSDoc documentation
- Final quality validation (tests, lint, types, coverage)
**Interactive gate**: After this skill completes, present the user with options:
1. Complete the workflow
2. Request changes to refactoring (re-run refactor with focus)
3. Resume from a different step
4. Pause and create handover documentation
### Step 7: Conditional Stack Split
After refactor lands and BEFORE reporting, decide whether the resulting change should be sliced into a stack of ordered draft PRs, or whether an existing open stack needs restacking. The orchestrator NEVER invokes `jj split` / `gh pr create` directly -- it always delegates to `coding:commit --create-pr`.
1. **Compute change size** via `jj diff --summary --stat` (preferred when the working copy is jj-colocated) or `git diff --shortstat HEAD` as fallback. Capture: changed-file count and LOC diff.
2. **Detect open stack**: scan for bookmarks matching `<branch-prefix>/NN-<scope>` (e.g. `jj bookmark list` / `git branch --list '*/[0-9][0-9]-*'`).
3. **Apply triggers**:
- **Large change** -- `>5 changed files OR >300 LOC diff OR multiple loosely-coupled domains`. Dispatch `coding:commit --create-pr --from-composite` (split + stacked-PR flow) to slice the working copy into reviewable, 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.