Skip to content

mishitpatel/claude-code-example1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude Code Template System for Spec-Driven Development

A comprehensive CLAUDE.md template system designed for fullstack projects using Progressive Disclosure to keep Claude Code sessions focused and efficient.

Overview

This template system implements Spec-Driven Development with Claude Code, organizing documentation into a hierarchy that:

  1. Keeps CLAUDE.md concise (~70 lines) as an entry point
  2. Uses progressive disclosure - Claude reads detailed docs only when needed
  3. Separates concerns - Product specs, engineering docs, and guidelines are distinct
  4. Enables efficient AI collaboration - Claude knows where to find information

Directory Structure

your-project/
β”œβ”€β”€ CLAUDE.md                          # 🎯 Entry point (keep concise!)
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ product/                       # πŸ“¦ PRODUCT PACK
β”‚   β”‚   β”œβ”€β”€ PRODUCT_OVERVIEW.md        # Vision, goals, roadmap
β”‚   β”‚   β”œβ”€β”€ specs/                     # Detailed feature specifications
β”‚   β”‚   β”‚   β”œβ”€β”€ SPEC_TEMPLATE.md
β”‚   β”‚   β”‚   β”œβ”€β”€ SPEC_001_[feature].md
β”‚   β”‚   β”‚   └── SPEC_002_[feature].md
β”‚   β”‚   └── stories/                   # User stories for each spec
β”‚   β”‚       β”œβ”€β”€ STORY_TEMPLATE.md
β”‚   β”‚       β”œβ”€β”€ STORY_001.md
β”‚   β”‚       └── STORY_002.md
β”‚   β”‚
β”‚   β”œβ”€β”€ engineering/                   # πŸ”§ ENGINEERING PACK
β”‚   β”‚   β”œβ”€β”€ ARCHITECTURE.md            # System design, tech stack
β”‚   β”‚   β”œβ”€β”€ API_DESIGN.md              # REST API guidelines
β”‚   β”‚   └── DATABASE.md                # Schema, migrations, queries
β”‚   β”‚
β”‚   β”œβ”€β”€ guidelines/                    # πŸ“ CODING STANDARDS
β”‚   β”‚   β”œβ”€β”€ FRONTEND.md                # React/TypeScript conventions
β”‚   β”‚   β”œβ”€β”€ BACKEND.md                 # Node.js/Express conventions
β”‚   β”‚   β”œβ”€β”€ UI_UX.md                   # Design system, accessibility
β”‚   β”‚   └── TESTING.md                 # Test patterns, coverage
β”‚   β”‚
β”‚   └── project/                       # πŸ“Š PROJECT MANAGEMENT
β”‚       β”œβ”€β”€ GITHUB_WORKFLOW.md         # Branching, PRs, CI/CD
β”‚       β”œβ”€β”€ CONSTRAINTS.md             # Policies, security, SLAs
β”‚       β”œβ”€β”€ COMMANDS.md                # Frequently used commands
β”‚       β”œβ”€β”€ milestones/
β”‚       β”‚   β”œβ”€β”€ MILESTONE_TEMPLATE.md
β”‚       β”‚   └── MILESTONE_001.md
β”‚       └── decisions/
β”‚           └── ADR_TEMPLATE.md        # Architecture Decision Records
β”‚
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/                           # Frontend application
β”‚   └── api/                           # Backend application
β”‚
└── packages/
    └── shared/                        # Shared types, utilities

How Progressive Disclosure Works

Level 1: CLAUDE.md (Always Loaded)

  • Project overview and quick start
  • Map of documentation structure
  • Key conventions and constraints
  • Links to detailed docs

Level 2: Category Documents (Loaded on Demand)

  • PRODUCT_OVERVIEW.md - When discussing features
  • ARCHITECTURE.md - When making design decisions
  • API_DESIGN.md - When working on APIs
  • Coding guidelines - When writing code

Level 3: Detailed Specs (Loaded for Specific Tasks)

  • Individual spec files for features
  • User story details
  • Milestone tracking

Usage Guide

Starting a New Project

  1. Copy the template structure to your project root
  2. Customize CLAUDE.md with your project details
  3. Fill in PRODUCT_OVERVIEW.md with your vision
  4. Define your tech stack in ARCHITECTURE.md
  5. Create your first milestone and specs

Working with Claude Code

When you start a session, Claude will:

  1. Read CLAUDE.md to understand the project
  2. Before implementing features, read the relevant spec from docs/product/specs/
  3. Before writing code, read the appropriate guideline from docs/guidelines/
  4. Reference API_DESIGN.md and DATABASE.md for backend work

Template Relationships

PRODUCT_OVERVIEW.md
        β”‚
        β–Ό
   SPEC_XXX.md ──────► MILESTONE_XXX.md
        β”‚                    β”‚
        β–Ό                    β”‚
   STORY_XXX.md β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
        β–Ό
   Implementation
   (guided by guidelines)

Template Descriptions

Product Pack

File Purpose When to Use
PRODUCT_OVERVIEW.md High-level product vision Starting a project, onboarding
SPEC_TEMPLATE.md Feature specification Planning new features
STORY_TEMPLATE.md User story with acceptance criteria Sprint planning

Engineering Pack

File Purpose When to Use
ARCHITECTURE.md System design, tech stack, data flow Design decisions
API_DESIGN.md REST conventions, endpoints, errors API development
DATABASE.md Schema patterns, migrations, queries Database work

Guidelines Pack

File Purpose When to Use
FRONTEND.md React/TypeScript conventions Frontend development
BACKEND.md Node.js patterns, structure Backend development
UI_UX.md Design system, accessibility UI implementation
TESTING.md Test patterns, coverage Writing tests

Project Pack

File Purpose When to Use
GITHUB_WORKFLOW.md Branching, PRs, CI/CD Git operations
CONSTRAINTS.md Policies, SLAs, security Compliance checks
COMMANDS.md Common CLI commands Daily development
MILESTONE_TEMPLATE.md Sprint/release planning Project management
ADR_TEMPLATE.md Architecture decisions Major tech choices

Best Practices

Keeping CLAUDE.md Effective

βœ… DO:
- Keep under 100 lines
- Include project map
- List key conventions
- Link to detailed docs
- Update current sprint focus

❌ DON'T:
- Embed full specifications
- Include all API endpoints
- List every command
- Duplicate content from other docs

Writing Good Specs

βœ… DO:
- Clear problem statement
- Measurable acceptance criteria
- Link to related stories
- Define what's out of scope
- Include error scenarios

❌ DON'T:
- Implementation details
- Vague requirements
- Missing edge cases
- Undefined success metrics

Maintaining Documentation

  • Review quarterly: Update constraints and policies
  • Update per sprint: Milestone progress, current focus
  • Update per feature: Specs, stories, API docs
  • Update as needed: Commands, guidelines

Customization

For Monorepo Projects

β”œβ”€β”€ CLAUDE.md                    # Root entry point
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/
β”‚   β”‚   └── CLAUDE.md            # Frontend-specific (optional)
β”‚   └── api/
β”‚       └── CLAUDE.md            # Backend-specific (optional)
└── docs/                        # Shared documentation

For Microservices

β”œβ”€β”€ CLAUDE.md                    # Service overview
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ engineering/
β”‚   β”‚   β”œβ”€β”€ API_DESIGN.md        # This service's API
β”‚   β”‚   └── INTEGRATION.md       # Inter-service communication

For Solo Developers

You might simplify to:

β”œβ”€β”€ CLAUDE.md
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ SPECS.md                 # All specs in one file
β”‚   └── GUIDELINES.md            # Combined guidelines

Integration with Claude Code

Suggested Workflow

  1. Session Start: Claude reads CLAUDE.md
  2. Feature Request: Claude reads relevant spec
  3. Implementation: Claude follows guidelines
  4. PR Creation: Claude follows GitHub workflow
  5. Testing: Claude follows testing guidelines

Example Claude Code Prompt

@CLAUDE.md I need to implement the user authentication feature.

Before coding:
1. Read docs/product/specs/SPEC_001_authentication.md
2. Read docs/guidelines/BACKEND.md
3. Check docs/engineering/API_DESIGN.md for auth patterns

Contributing

When adding new documentation:

  1. Follow the existing template structure
  2. Keep files focused on single topics
  3. Cross-reference related documents
  4. Update CLAUDE.md if adding new categories

License

MIT - Feel free to use and modify for your projects.

About

Claude Code example with MD templates.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors