Skip to content
Development
Command

/code-prd

4-phase Context Engineering workflow with guided implementation

From plugin
claude-plugin-prd-workflow
1227 skills17 agents27 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/code-prd

Context preview

What this command does when you run it.

4-phase Context Engineering workflow with guided implementation

Command definition

code-prd.md
name: code-prd
description: 4-phase Context Engineering workflow with guided implementation
category: PRD Management
version: 0.4.2

Code PRD Command

Guided implementation using 4-phase Context Engineering workflow.

Purpose

Bridge PRD to implementation with:

  • **Context management**: Never exceed 60% context for quality
  • **4-Phase workflow**: Research → Plan → Implement → Validate
  • **Persistent memory**: Thoughts saved in `.prds/thoughts/`
  • **Incremental progress**: Clear checkpoints and validation
  • **Quality assurance**: Continuous alignment with PRD

Workflow

Phase 1: Research (Context Gathering)

**Goal**: Deep codebase understanding before writing code.

**Activities**:

  • Read PRD acceptance criteria and technical design
  • Explore relevant codebase areas
  • Identify existing patterns and conventions
  • Find dependencies and integration points
  • Note architectural constraints
  • Document unknowns and questions

**Output**: Research summary saved in `.prds/thoughts/research/PRD-XXX-research.md`

**Key questions**:

  • Where does this feature fit in the codebase?
  • What patterns/conventions should I follow?
  • What dependencies exist?
  • What could go wrong?

Phase 2: Plan (Task Breakdown)

**Goal**: Detailed implementation plan with tasks and estimates.

**Activities**:

  • Break down PRD into concrete tasks
  • Identify task dependencies
  • Estimate effort per task
  • Plan testing strategy
  • Define validation checkpoints
  • Risk mitigation planning

**Output**: Implementation plan saved in `.prds/thoughts/plans/PRD-XXX-plan.md`

**Plan structure**:

  • Task list with estimates
  • Dependency graph
  • Critical path identified
  • Testing approach
  • Validation criteria

Phase 3: Implement (Guided Development)

**Goal**: Execute plan incrementally with continuous validation.

**Activities**:

  • Work task-by-task from plan
  • Checkpoint after each major task
  • Validate against acceptance criteria
  • Adapt plan based on learnings
  • Document decisions and trade-offs
  • Keep context under 60%

**Checkpoints**:

  • After each task: Does it work? Tests pass? Aligned with PRD?
  • Before next task: Context cleanup if needed
  • Major milestones: User validation opportunity

**Best practices**:

  • Small commits with clear messages
  • Test as you go
  • Document non-obvious decisions
  • Ask user if stuck or uncertain

Phase 4: Validate (Quality Assurance)

**Goal**: Ensure implementation meets all PRD requirements.

**Activities**:

  • Run full test suite
  • Verify all acceptance criteria met
  • Check code quality and patterns
  • Security review
  • Performance check
  • Documentation updated

**Output**: Validation report in `.prds/thoughts/validation/PRD-XXX-validation.md`

**Validation checklist**:

  • ✅ All acceptance criteria met
  • ✅ Tests passing (unit, integration, e2e)
  • ✅ No security issues
  • ✅ Performance acceptable
  • ✅ Code quality good
  • ✅ Documentation complete

Final: Create PR

**After validation passes**:

  • Commit all changes
  • Create pull request
  • Link to PRD
  • Add PR number to PRD metadata
  • Move PRD to `03-in-progress/`

Flags & Options

**Quick mode** (`--quick`):

  • Skip research and planning phases
  • Direct implementation (legacy behavior)
  • Use for: Tiny changes, bug fixes

**Skip phases**:

  • `--skip-research`: Start with planning
  • `--skip-plan`: Direct implementation with research
  • `--manual-checkpoints`: User approves each checkpoint

**Examples**:

/code-prd PRD-007                    # Full 4-phase workflow
/code-prd PRD-007 --quick            # Legacy quick mode
/code-prd PRD-007 --skip-research    # Plan + Implement + Validate
/code-prd PRD-007 --manual-checkpoints  # User approval at each phase

Context Engineering Principles

**60% Rule**:

  • Never let context exceed 60% capacity
  • Clear context between phases
  • Persist learnings in thoughts/ directory
  • Quality degrades beyond 60%

**Incremental Progress**:

  • Small, validated steps
  • Checkpoint frequently
  • Adapt plan based on reality
  • User can jump in anytime

**Persistent Memory**:

  • Research findings saved
  • Plan documented
  • Decisions recorded
  • Learnings preserved for team

**Validation First**:

  • Test continuously
  • Validate against PRD
  • Catch issues early
  • User feedback integrated

Directory Structure

.prds/
├── thoughts/
│   ├── research/
│   │   └── PRD-XXX-research.md    # Phase 1 output
│   ├── plans/
│   │   └── PRD-XXX-plan.md        # Phase 2 output
│   └── validation/
│       └── PRD-XXX-validation.md  # Phase 4 output

Configuration

{
  "context_engineering": {
    "enabled": true,
    "max_context_threshold": 0.60,
    "checkpoint_frequency": "per_task",
    "auto_save_thoughts": true
  },
  "prd_workflow": {
    "directories": {
      "ready": "product/prds/02-ready",
      "in_progress": "product/prds/03-in-progress"
    }
  }
}

Success Criteria

  • ✅ All 4 phases completed (or skipped intentionally)
  • ✅ Implementation aligns with PRD
  • ✅ All acceptance criteria met
  • ✅ Tests passing
  • ✅ PR created and linked
  • ✅ Context stayed under 60% throughout
  • ✅ Thoughts documented for team

Example Output

🚀 Starting PRD-007: OAuth2 Integration

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 PHASE 1: RESEARCH (15 min)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Exploring codebase...
✓ Found auth/ directory with Passport.js setup
✓ Identified user model in models/User.js
✓ Existing local strategy pattern to follow

Research saved → .prds/thoughts/research/PRD-007-research.md
Context: 45% ✓

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 PHASE 2: PLAN (20 min)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Breaking down into tasks...

1. Configure Passport Google strategy (2h)
2. Add OAuth routes (1h)
3. Update User model (1h)
4. Add OAuth buttons to UI (2h)
5. Write tests (3h)

Total: ~9h (1.2 days)

Plan saved → .prds/thoughts/plans/PRD-007-plan.md
Context: 38% ✓

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚡ PHASE 3: IMPLEMENT
Read more
Ships withclaude-plugin-prd-workflow

The complete Claude Code plugin for Product-Driven Development Transform PRDs from ideas to shipped features with AI-powered review, guided implementation, and automated quality gates. Never ship unclear requirements again.

Get the whole plugin

Other commands on claude-plugin-prd-workflow.