From gdd
Implement a feature guided by GDD diagrams — extract design constraints from flowcharts and architecture diagrams before writing code
How this command is triggered — by the user, by Claude, or both
Slash command
/gdd:code <feature or task description>This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
<objective> Implement a feature or task by first extracting implementation constraints from the GDD diagrams, then writing code that strictly adheres to those constraints. The diagrams are the source of truth. If the code needs to deviate from the diagrams, that deviation must be recorded — NOT silently done. Diagram updates happen through `/gdd:plan`, not during coding. </objective> <process> ## Step 1: GDD Completeness Check 1. Verify `docs/gdd/` exists with at least one `flow-*.md` and one `arch-*.md` 2. Check `docs/gdd/drafts/` for unreviewed drafts **If GDD is not initialized:** ...
The diagrams are the source of truth. If the code needs to deviate from the diagrams, that deviation must be recorded — NOT silently done. Diagram updates happen through /gdd:plan, not during coding.
docs/gdd/ exists with at least one flow-*.md and one arch-*.mddocs/gdd/drafts/ for unreviewed draftsIf GDD is not initialized:
GDD diagrams are missing or incomplete.
Run /gdd:init to generate the initial diagram set, then:
- If this is a new requirement: run /gdd:plan to update diagrams
- Run /gdd:plan-review to validate
- Then return to /gdd:code
STOP.
If deviation records exist:
Note: Unresolved deviation records exist in docs/gdd/drafts/:
- draft-deviation-<timestamp>.md — recorded during a prior coding session
These deviations mean the diagrams may not match the current code.
Consider running /gdd:plan to update the diagrams before proceeding.
Continuing with the current diagrams...
Continue with a note, do not block.
If /gdd:plan was just approved in this conversation (the plan content contains Before/After Mermaid diffs), apply those diagram changes to docs/gdd/ before coding:
For each "Modifying: <filename.md>" entry in the approved plan:
**Last Updated** date to todayWriteFor each "New File: <filename.md>" entry in the approved plan:
docs/gdd/ using the standard diagram file formatWriteOutput confirmation before proceeding:
Applied diagram changes from approved plan:
- Updated: flow-request.md
- Created: flow-auth.md
Proceeding with implementation...
If no plan was recently approved (this is a standalone coding task), skip this step.
Parse $ARGUMENTS — the feature or task to implement. If unclear, ask one focused clarifying question before proceeding.
Read all relevant diagram files. For each relevant diagram, extract specific implementation constraints:
Extract:
Extract:
Produce an internal constraint checklist before writing any code:
GDD Implementation Constraints for: <task name>
MODULE BOUNDARIES:
- This feature belongs in: <module/file>
- Must NOT import from: <list of modules outside the boundary>
- May depend on: <list of allowed dependencies>
EXECUTION ORDER (from flow diagrams):
1. Step A must happen before Step B
2. If condition X, branch to path Y
3. On error at Step C, do D (not E)
DATA CONTRACTS:
- Input: <data shape coming in>
- Output: <data shape going out>
- State mutations: <what state changes are expected>
EXTERNAL SYSTEM INTERACTIONS:
- Call System X at step N with payload Y
- Do NOT call System Z (not in the diagram for this flow)
Before writing any production code, write one failing test per decision point extracted in Step 3.
Name each test after its diagram node:
test("<DiagramFile> → <NodeLabel>: <scenario>", ...)
Examples:
test("flow-request.md → AuthCheck: returns 401 when token is missing", ...)
test("flow-request.md → AuthCheck: continues to Process when token is valid", ...)
test("flow-data.md → Rollback: rolls back transaction when DB write fails", ...)
For each decision node (two or more outgoing edges): one test per branch. For each error path: one test that triggers the error condition and asserts the error behavior. For each external system interaction: one test that stubs the external system and asserts the correct payload.
Skip simple pass-through nodes (one ingoing, one outgoing, no branching logic).
Run the tests. They must ALL FAIL before proceeding to Step 5. A test that passes before any production code exists is testing nothing — rewrite or delete it.
TDD Gate: N tests written, N failing — proceeding to implementation
Do not proceed to Step 5 until this gate is cleared.
Implement the feature following the constraints. The tests written in Step 4 are the acceptance criteria.
Create a todo list covering both test-writing and implementation:
TDD todos:
[ ] Test: Validate input — flow-request.md → Validate node (write failing test)
[ ] Test: Auth success path — flow-request.md → AuthCheck node (write failing test)
[ ] Test: Auth failure → 401 — flow-request.md → Error node (write failing test)
[ ] Test: DB write failure → Rollback — flow-data.md → Rollback node (write failing test)
[ ] Run tests — verify all fail (TDD gate)
[ ] Implement: Validate input
[ ] Implement: Check authorization
[ ] Implement: Execute business logic
[ ] Implement: Persist result
[ ] Implement: Return response
[ ] Run tests — verify all pass
If during implementation you discover that the diagram is inaccurate, incomplete, or impractical:
Do NOT silently fix the diagram or deviate without recording.
Instead, record the deviation in a docs/gdd/drafts/draft-deviation-<timestamp>.md file:
# Diagram Deviation Record
> **Recorded**: <timestamp>
> **Task**: <task name>
> **Status**: PENDING_DIAGRAM_UPDATE
## Deviation #1
**Diagram**: flow-request.md
**Node/Path**: ErrorHandler → RetryQueue
**What the diagram says**: On validation error, send to RetryQueue
**What was actually implemented**: Return 400 immediately (no retry queue)
**Reason**: The RetryQueue service does not exist in the codebase and
adding it is out of scope for this task.
**Required diagram update**: Remove RetryQueue node from flow-request.md,
replace with direct 400 response path.
**Action needed**: Run /gdd:plan to update the diagram
After recording, continue implementing the practical solution.
After completing implementation, output:
GDD Implementation Complete
Task: <task name>
Files modified: N files
Constraint compliance:
- Module boundaries: FOLLOWED / N DEVIATIONS (see docs/gdd/drafts/)
- Flow execution order: FOLLOWED / N DEVIATIONS
- Error paths: FOLLOWED / N DEVIATIONS
- TDD coverage: N failing tests written, N passing after implementation (N diagram decision points)
Deviations recorded:
- docs/gdd/drafts/draft-deviation-<timestamp>.md (2 deviations)
Starting automated code review...
After completing implementation, spawn a subagent to run the code review. Repeat until the verdict is APPROVED or APPROVED_WITH_WARNINGS.
Use the Agent tool to invoke the gdd:code-review skill as a subagent:
Invoke the `gdd:code-review` skill via the Agent tool.
Pass the list of code files modified during Step 5 as the argument.
If verdict is NEEDS_WORK:
[CRITICAL] issues directly in the code filesgdd:plan first, then continueAPPROVED or APPROVED_WITH_WARNINGSIf verdict is APPROVED or APPROVED_WITH_WARNINGS:
Output the final summary:
GDD Code Review: APPROVED [/ APPROVED_WITH_WARNINGS]
Files reviewed: <list of code files>
Diagrams compared: <list of diagram files>
Issues found: N critical (fixed), N warnings, N suggestions
<If APPROVED_WITH_WARNINGS, list the warnings here>
Implementation complete. If deviations were recorded, run /gdd:plan to update diagrams.
Then wait for the user to confirm there are no further issues.
- The diagrams are the contract. If reality doesn't match, record the gap — don't silently bridge it - Extract constraints BEFORE writing code — never start coding and then check the diagram - Tests come before code: write failing tests for every decision point before any production code; the TDD gate in Step 4 is not optional - Deviation records are not failures — they are valuable feedback that improves the diagrams - If you find yourself writing code for a module that doesn't appear in any diagram, that's a signal: either the diagram is incomplete (record it) or you're going out of scopenpx claudepluginhub vivaxy/claude-code-plugins-vivaxy/codeImplements a feature via multi-agent workflow, producing implementation plan, complete code, integration guide, testing strategy, and next actions.
/codeForces explicit assumption-stating, edge case consideration, and condition verification before generating code for the request.
/codeBootstraps ClosedLoop orchestrator for coding sessions in a working directory. Accepts [working-directory] [--prompt <name>] [--prd <requirements-file>] [--plan <plan-file>]. Starts with TodoWrite delegation.
/codeLaunches a code-mode agent team with configurable tier and research settings. Guides through outcomes, team setup, confirmation, and launch.