使用Spec范式编写代码的Claude Code工作流

使用Spec范式编写代码的Claude Code工作流

Table of Contents

Claude Code Spec Workflow

![npm version](https://badge.fury.io/js/ @pimzino%2Fclaude-code-spec-workflow.svg?cacheSeconds=300) License: MIT

Automated workflows for Claude Code with intelligent orchestration.

Transform your development with structured workflows: Requirements → Design → Tasks → Implementation for new features, plus streamlined Report → Analyze → Fix → Verify for bug fixes.


Quick Start

# Install and setup in any project
npx @pimzino/claude-code-spec-workflow@latest

# Start using workflows in Claude Code
/spec-create user-dashboard "User profile management"
/spec-orchestrate user-dashboard  #  NEW! Automated execution

Installation

MethodCommandUse Case
NPX (Recommended)npx @pimzino/claude-code-spec-workflow@latestOne-time setup
Globalnpm i -g @pimzino/claude-code-spec-workflowMultiple projects
Localnpm i -D @pimzino/claude-code-spec-workflowSingle project

✨ What You Get

  • ** Complete .claude/ structure** - All files and directories
  • ** 14 slash commands** - 9 spec workflow + 5 bug fix workflow
  • ** Intelligent orchestrator** - Automated task execution
  • ** 16 specialized agents** - Enhanced automation (optional)
  • ** Real-time dashboard** - Monitor progress visually
  • ** Auto-generated commands** - One command per task
  • ** Document templates** - Professional spec documents
  • ⚙️ Project steering - Persistent context and standards

Workflows Overview

Spec Workflow (New Features)

Complete automation in one command:

/spec-create feature-name "Description"

What happens:

  1. Requirements → User stories + acceptance criteria
  2. Design → Technical architecture + diagrams
  3. Tasks → Atomic, agent-friendly breakdown
  4. Commands → Auto-generated task commands (optional)

Execute tasks:

# Automated (recommended)
/spec-orchestrate feature-name

# Manual control
/spec-execute 1 feature-name
/feature-name-task-1        # Auto-generated

Bug Fix Workflow (Quick Fixes)

/bug-create issue-name "Description"  # Document the bug
/bug-analyze                          # Find root cause
/bug-fix                             # Implement solution
/bug-verify                          # Confirm resolution

Steering Setup (Project Context)

/spec-steering-setup  # Creates product.md, tech.md, structure.md

️ Commands Reference

Spec Workflow Commands
CommandPurpose
/spec-steering-setupCreate project context documents
/spec-create <name>Complete spec workflow
/spec-orchestrate <name>Automated execution
/spec-execute <task-id>Manual task execution
/<name>-task-<id>Auto-generated task commands
/spec-statusShow progress
/spec-listList all specs
/spec-completion-reviewFinal validation
Bug Fix Commands
CommandPurpose
/bug-create <name>Document bug with structured format
/bug-analyzeInvestigate root cause
/bug-fixImplement targeted solution
/bug-verifyVerify resolution
/bug-statusShow bug fix progress

Key Features

Intelligent Orchestrator (NEW!)

  • Fully automated task execution
  • Session resumable - handles Claude Code limits
  • Error recovery - smart debugging and retry
  • Continuous execution - no manual intervention needed

Specialized Agents (Optional)

15 AI agents for enhanced automation:

Core Workflow: spec-task-executor, spec-requirements-validator, spec-design-validator, spec-task-validator

Quality Assurance: spec-task-implementation-reviewer, spec-integration-tester, spec-completion-reviewer, spec-duplication-detector

Analysis: spec-dependency-analyzer, spec-test-generator, spec-performance-analyzer, spec-breaking-change-detector

Documentation: spec-documentation-generator, steering-document-updater

Bug Fixes: bug-root-cause-analyzer

Note: Agents are optional - everything works with built-in fallbacks.

Real-Time Dashboard

npx -p @pimzino/claude-code-spec-workflow claude-spec-dashboard
  • Live progress tracking
  • WebSocket updates
  • Git integration
  • Modern UI with Tailwind CSS

️ Project Structure

your-project/
├── .claude/
│   ├── commands/           # 14 slash commands + auto-generated
│   ├── steering/          # product.md, tech.md, structure.md
│   ├── templates/         # Document templates
│   ├── specs/            # Generated specifications
│   ├── bugs/             # Bug fix workflows
│   ├── agents/           # AI agents (optional)
│   └── spec-config.json  # Configuration

When To Use What

ScenarioRecommended Approach
New feature, well-defined/spec-orchestrate (automated)
Complex/experimental feature/spec-execute (manual control)
Bug in existing codeBug workflow (/bug-create/bug-verify)
Learning the codebaseManual execution with individual commands
Production deploymentFull spec workflow with completion review

⚙️ Setup Options

# Basic setup
npx @pimzino/claude-code-spec-workflow@latest

# Advanced options
npx @pimzino/claude-code-spec-workflow@latest --project /path --force --yes

During setup you choose:

  • Enable agents? Enhanced automation vs simpler setup
  • Project analysis Auto-detection of frameworks and patterns

Examples

Recommendation: Use Claude Opus 4 to generate the spec documentation ‘/spec-create’, then use Claude Sonnet 4 for the implementation i.e. ‘/spec-execute’ or ‘/spec-orchestrate’ or ‘/{spec-name}-task-’.

Basic Workflow Example
# 1. Setup (one time)
cd my-project
npx @pimzino/claude-code-spec-workflow@latest

# 2. Create steering documents (recommended)
claude
/spec-steering-setup

# 3. Create feature spec
/spec-create user-authentication "Secure login system"

# 4. Automated execution
/spec-orchestrate user-authentication

# 5. Monitor progress
/spec-status user-authentication
Bug Fix Example
/bug-create login-timeout "Users logged out too quickly"
/bug-analyze
/bug-fix
/bug-verify

Troubleshooting

Common Issues

❓ “Command not found”

npx @pimzino/claude-code-spec-workflow@latest  # Use full package name

❓ “Claude Code not detected”

npm install -g @anthropic-ai/claude-code

❓ “Permission errors”

npx @pimzino/claude-code-spec-workflow@latest --project ~/my-project

Requirements

  • Node.js 16.0.0+
  • Claude Code installed
  • Any project directory

Share :
comments powered by Disqus

Related Posts

claude code 必备 MCP

claude code 必备 MCP

记录Claude code安装时,必备的几个Mcp。 Warning

Read More