|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is the Claude Requirements Gathering System - a structured workflow for collecting and documenting software requirements through AI-guided interviews. The system provides both slash commands and an MCP server implementation, using a two-phase questioning approach (discovery + expert) with automated context gathering to generate comprehensive requirements documentation. |
| 8 | + |
| 9 | +## Repository Structure |
| 10 | + |
| 11 | +``` |
| 12 | +claude-code-requirements-builder/ |
| 13 | +├── src/ # MCP server source code |
| 14 | +│ └── index.ts # Main MCP server implementation |
| 15 | +├── dist/ # Built JavaScript files |
| 16 | +├── commands/ # Claude slash command definitions |
| 17 | +│ ├── requirements-start.md # Begin new requirement gathering |
| 18 | +│ ├── requirements-status.md # Check progress (alias: current) |
| 19 | +│ ├── requirements-current.md # View active requirement details |
| 20 | +│ ├── requirements-end.md # Finalize requirement session |
| 21 | +│ ├── requirements-list.md # List all requirements |
| 22 | +│ └── requirements-remind.md # Remind AI of workflow rules |
| 23 | +├── requirements/ # Generated requirement documents |
| 24 | +│ ├── .current-requirement # Tracks active requirement |
| 25 | +│ ├── index.md # Summary of all requirements |
| 26 | +│ └── YYYY-MM-DD-HHMM-[name]/ # Individual requirement folders |
| 27 | +├── examples/ # Sample requirement outputs |
| 28 | +├── package.json # npm package configuration |
| 29 | +└── tsconfig.json # TypeScript configuration |
| 30 | +``` |
| 31 | + |
| 32 | +## Dual Implementation Architecture |
| 33 | + |
| 34 | +This system provides two ways to access the same functionality: |
| 35 | + |
| 36 | +### MCP Server (`src/index.ts`) |
| 37 | +- **Node.js TypeScript implementation** using the official MCP SDK |
| 38 | +- **6 registered tools** that mirror the slash commands: |
| 39 | + - `requirements-start` - Begin new requirement gathering |
| 40 | + - `requirements-status` - Check progress and session state |
| 41 | + - `requirements-current` - View active requirement details |
| 42 | + - `requirements-end` - Complete/incomplete/delete session |
| 43 | + - `requirements-list` - Multi-requirement overview with status |
| 44 | + - `requirements-remind` - Workflow rules and best practices reminder |
| 45 | +- **File-based state management** using the same structure as slash commands |
| 46 | +- **npx distribution** for easy installation and updates |
| 47 | + |
| 48 | +### Slash Commands (`commands/` directory) |
| 49 | +Each command in `commands/` defines a specific workflow step: |
| 50 | + |
| 51 | +- **requirements-start.md**: 5-phase workflow (setup → discovery → context → expert → documentation) |
| 52 | +- **requirements-status.md**: Progress tracking and session resumption |
| 53 | +- **requirements-end.md**: Finalization with options (complete/incomplete/delete) |
| 54 | +- **requirements-list.md**: Multi-requirement overview with status display |
| 55 | + |
| 56 | +## Key Workflow Patterns |
| 57 | + |
| 58 | +### Phase-Based Progression |
| 59 | +1. **Setup**: Create timestamped folder, extract slug from request |
| 60 | +2. **Discovery**: 5 yes/no questions about problem space |
| 61 | +3. **Context**: Autonomous code analysis and file reading |
| 62 | +4. **Expert**: 5 detailed yes/no questions with codebase knowledge |
| 63 | +5. **Documentation**: Generate comprehensive requirements spec |
| 64 | + |
| 65 | +### Question Format Standards |
| 66 | +- Only yes/no questions with intelligent defaults |
| 67 | +- One question at a time (never batch) |
| 68 | +- Write ALL questions to file BEFORE asking any |
| 69 | +- Include "Default if unknown" reasoning for each question |
| 70 | +- Use actual file paths and component names in expert phase |
| 71 | + |
| 72 | +### File Naming Conventions |
| 73 | +- Requirement folders: `YYYY-MM-DD-HHMM-[feature-slug]` |
| 74 | +- Sequential files: `00-initial-request.md` through `06-requirements-spec.md` |
| 75 | +- Metadata tracking: `metadata.json` with phase/progress state |
| 76 | + |
| 77 | +### State Management |
| 78 | +- `.current-requirement` file tracks active session |
| 79 | +- `metadata.json` structure includes phase, progress counters, analyzed files |
| 80 | +- Status transitions: discovery → context → detail → complete |
| 81 | + |
| 82 | +## Development Notes |
| 83 | + |
| 84 | +This repository provides dual implementation approaches: |
| 85 | + |
| 86 | +### MCP Server Development |
| 87 | +- **TypeScript** with Node.js runtime |
| 88 | +- **MCP SDK** for protocol compliance |
| 89 | +- **Build system** with `npm run build` |
| 90 | +- **npx distribution** for easy installation |
| 91 | +- **State management** via JSON metadata files |
| 92 | + |
| 93 | +### Slash Commands |
| 94 | +- **Documentation-based** system reading markdown files in `commands/` |
| 95 | +- **No build system** required for slash commands |
| 96 | +- **File-based workflow** definitions |
| 97 | + |
| 98 | +## Usage Patterns |
| 99 | + |
| 100 | +The system is designed for product managers and developers to gather requirements through: |
| 101 | +- Simple yes/no responses (supports "idk" for defaults) |
| 102 | +- Codebase-aware questioning after AI analysis |
| 103 | +- Progressive refinement from high-level to implementation-specific |
| 104 | +- Comprehensive documentation with file paths and implementation hints |
| 105 | + |
| 106 | +### MCP Server Usage |
| 107 | +Users can install via `npx claude-code-requirements` and access all functionality through MCP tools in Claude Desktop or other MCP-compatible clients. |
| 108 | + |
| 109 | +### Slash Command Usage |
| 110 | +For users preferring the original slash command interface, the `commands/` directory provides the same workflow through Claude Code's built-in command system. |
| 111 | + |
| 112 | +When working with this repository, maintain consistency between both implementations and ensure the workflow preserves its structured, phase-based approach while keeping questions simple and defaults intelligent. |
0 commit comments