Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
*.log
.DS_Store
.env
.env.local
.vscode/
.idea/
12 changes: 12 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
src/
tsconfig.json
*.test.ts
.git/
.github/
examples/
commands/
CLAUDE.md
requirements/
node_modules/
.DS_Store
*.log
112 changes: 112 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

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.

## Repository Structure

```
claude-code-requirements-builder/
├── src/ # MCP server source code
│ └── index.ts # Main MCP server implementation
├── dist/ # Built JavaScript files
├── commands/ # Claude slash command definitions
│ ├── requirements-start.md # Begin new requirement gathering
│ ├── requirements-status.md # Check progress (alias: current)
│ ├── requirements-current.md # View active requirement details
│ ├── requirements-end.md # Finalize requirement session
│ ├── requirements-list.md # List all requirements
│ └── requirements-remind.md # Remind AI of workflow rules
├── requirements/ # Generated requirement documents
│ ├── .current-requirement # Tracks active requirement
│ ├── index.md # Summary of all requirements
│ └── YYYY-MM-DD-HHMM-[name]/ # Individual requirement folders
├── examples/ # Sample requirement outputs
├── package.json # npm package configuration
└── tsconfig.json # TypeScript configuration
```

## Dual Implementation Architecture

This system provides two ways to access the same functionality:

### MCP Server (`src/index.ts`)
- **Node.js TypeScript implementation** using the official MCP SDK
- **6 registered tools** that mirror the slash commands:
- `requirements-start` - Begin new requirement gathering
- `requirements-status` - Check progress and session state
- `requirements-current` - View active requirement details
- `requirements-end` - Complete/incomplete/delete session
- `requirements-list` - Multi-requirement overview with status
- `requirements-remind` - Workflow rules and best practices reminder
- **File-based state management** using the same structure as slash commands
- **npx distribution** for easy installation and updates

### Slash Commands (`commands/` directory)
Each command in `commands/` defines a specific workflow step:

- **requirements-start.md**: 5-phase workflow (setup → discovery → context → expert → documentation)
- **requirements-status.md**: Progress tracking and session resumption
- **requirements-end.md**: Finalization with options (complete/incomplete/delete)
- **requirements-list.md**: Multi-requirement overview with status display

## Key Workflow Patterns

### Phase-Based Progression
1. **Setup**: Create timestamped folder, extract slug from request
2. **Discovery**: 5 yes/no questions about problem space
3. **Context**: Autonomous code analysis and file reading
4. **Expert**: 5 detailed yes/no questions with codebase knowledge
5. **Documentation**: Generate comprehensive requirements spec

### Question Format Standards
- Only yes/no questions with intelligent defaults
- One question at a time (never batch)
- Write ALL questions to file BEFORE asking any
- Include "Default if unknown" reasoning for each question
- Use actual file paths and component names in expert phase

### File Naming Conventions
- Requirement folders: `YYYY-MM-DD-HHMM-[feature-slug]`
- Sequential files: `00-initial-request.md` through `06-requirements-spec.md`
- Metadata tracking: `metadata.json` with phase/progress state

### State Management
- `.current-requirement` file tracks active session
- `metadata.json` structure includes phase, progress counters, analyzed files
- Status transitions: discovery → context → detail → complete

## Development Notes

This repository provides dual implementation approaches:

### MCP Server Development
- **TypeScript** with Node.js runtime
- **MCP SDK** for protocol compliance
- **Build system** with `npm run build`
- **npx distribution** for easy installation
- **State management** via JSON metadata files

### Slash Commands
- **Documentation-based** system reading markdown files in `commands/`
- **No build system** required for slash commands
- **File-based workflow** definitions

## Usage Patterns

The system is designed for product managers and developers to gather requirements through:
- Simple yes/no responses (supports "idk" for defaults)
- Codebase-aware questioning after AI analysis
- Progressive refinement from high-level to implementation-specific
- Comprehensive documentation with file paths and implementation hints

### MCP Server Usage
Users can install via `npx claude-code-requirements` and access all functionality through MCP tools in Claude Desktop or other MCP-compatible clients.

### Slash Command Usage
For users preferring the original slash command interface, the `commands/` directory provides the same workflow through Claude Code's built-in command system.

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.
91 changes: 88 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Claude Requirements Gathering System

An intelligent requirements gathering system for Claude Code that progressively builds context through automated discovery, asks simple yes/no questions, and generates comprehensive requirements documentation.
An intelligent requirements gathering system that combines slash commands and MCP server for Claude Code. It progressively builds context through automated discovery, asks simple yes/no questions, and generates comprehensive requirements documentation.

## 🎯 Overview

Expand All @@ -10,9 +10,43 @@ This system transforms the requirements gathering process by:
- **Two-Phase Questioning**: 5 high-level questions for context, then 5 expert questions after code analysis
- **Automated Documentation**: Generates comprehensive specs with specific file paths and patterns
- **Product Manager Friendly**: No code knowledge required to answer questions
- **MCP Server Support**: Available as both slash commands and MCP tools
- **Complete Development Loop**: New `/synthesize` command transforms requirements into implementation

## 🚀 Quick Start

### Option 1: Using MCP Server (Recommended)

**Install via npm:**
```bash
# Test it works
npx claude-code-requirements

# Add to Claude Desktop config
```

Add to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"claude-code-requirements": {
"command": "npx",
"args": ["claude-code-requirements"]
}
}
}
```

Then use the MCP tools:
- `requirements-start` - Begin gathering requirements
- `requirements-status` - Check progress
- `requirements-current` - View active requirement
- `requirements-end` - Complete/cancel session
- `requirements-list` - List all requirements
- `requirements-remind` - Get workflow reminder

### Option 2: Using Slash Commands

```bash
# Start gathering requirements for a new feature
/requirements-start add user profile picture upload
Expand All @@ -29,6 +63,9 @@ This system transforms the requirements gathering process by:
# End current requirement gathering
/requirements-end

# Generate implementation plan from completed requirements
/synthesize

# Quick reminder if AI strays off course
/remind
```
Expand All @@ -43,7 +80,8 @@ claude-requirements/
│ ├── requirements-current.md # View active requirement
│ ├── requirements-end.md # Finalize requirement
│ ├── requirements-list.md # List all requirements
│ └── requirements-remind.md # Remind AI of rules
│ ├── requirements-remind.md # Remind AI of rules
│ └── synthesize.md # Generate implementation from requirements
├── requirements/ # Requirement documentation storage
│ ├── .current-requirement # Tracks active requirement
Expand Down Expand Up @@ -165,6 +203,27 @@ Reminds AI to follow requirements gathering rules.
- Starts implementing code
- Asks multiple questions at once

### `/synthesize`
Transforms completed requirements into actionable implementation plans.

**Features:**
- Finds most recent completed requirement automatically
- Generates phased implementation plan
- Creates tracked todo list with specific tasks
- Maps tasks to requirement IDs (FR/TR)
- Begins actual implementation with progress tracking

**Example:**
```
/synthesize
```

**Output:**
- Implementation plan document
- Todo list with task IDs
- Automatic loading into Claude's task tracker
- Begins implementation immediately

## 🎯 Features

### Smart Defaults
Expand Down Expand Up @@ -205,9 +264,35 @@ Every question includes an intelligent default based on:

## 🔧 Installation

### MCP Server Installation (Recommended)

Install the MCP server via npm:

```bash
# Test it works
npx claude-code-requirements

# Or install globally
npm install -g claude-code-requirements
```

Add to your Claude Desktop configuration:
```json
{
"mcpServers": {
"claude-code-requirements": {
"command": "npx",
"args": ["claude-code-requirements"]
}
}
}
```

### Slash Commands Installation

1. Clone this repository:
```bash
git clone https://github.com/rizethereum/claude-code-requirements-builder.git
git clone https://github.com/ulasbilgen/claude-code-requirements-builder.git
```

2. Copy the commands to your project:
Expand Down
Loading