spec-kit-skill
This skill integrates GitHub's Spec-Kit CLI to guide users through a seven-phase constitution-driven development workflow that establishes principles, specifies requirements, clarifies ambiguities, plans technical strategy, generates task breakdowns, analyzes consistency, and enables implementation. Use it when initializing spec-kit in a project, creating feature specifications in the .specify/ directory structure, or following GitHub's structured specification-driven development methodology.
git clone --depth 1 https://github.com/feiskyer/claude-code-settings /tmp/spec-kit-skill && cp -r /tmp/spec-kit-skill/skills/spec-kit-skill ~/.claude/skills/spec-kit-skillSKILL.md
# Spec-Kit: Constitution-Based Spec-Driven Development
Official GitHub Spec-Kit integration providing a 7-phase constitution-driven workflow for feature development.
## Quick Start
This skill works with the [GitHub Spec-Kit CLI](https://github.com/github/spec-kit) to guide you through structured feature development:
1. **Constitution** → Establish governing principles
2. **Specify** → Define functional requirements
3. **Clarify** → Resolve ambiguities
4. **Plan** → Create technical strategy
5. **Tasks** → Generate actionable breakdown
6. **Analyze** → Validate consistency
7. **Implement** → Execute implementation
**Storage**: Creates files in `.specify/specs/NNN-feature-name/` directory with numbered features
## When to Use
- Setting up spec-kit in a project
- Creating constitution-based feature specifications
- Working with .specify/ directory
- Following GitHub spec-kit workflow
- Constitution-driven development
---
## Prerequisites & Setup
### Check CLI Installation
First, verify if spec-kit CLI is installed:
```bash
command -v specify || echo "Not installed"
```
### Installation
If not installed:
```bash
# Persistent installation (recommended)
uv tool install specify-cli --from git+https://github.com/github/spec-kit.git
# One-time usage
uvx --from git+https://github.com/github/spec-kit.git specify init <PROJECT_NAME>
```
**Requirements**:
- Python 3.11+
- Git
- uv package manager ([install uv](https://docs.astral.sh/uv/))
### Project Initialization
If CLI is installed but project not initialized:
```bash
# Initialize in current directory
specify init . --ai claude
# Initialize new project
specify init <project-name> --ai claude
# Options:
# --force: Overwrite non-empty directories
# --script ps: Generate PowerShell scripts (Windows)
# --no-git: Skip Git initialization
```
---
<details>
<summary>🔍 Phase Detection Logic</summary>
## Detecting Project State
Before proceeding, always detect the current state:
### 1. CLI Installed?
```bash
if command -v specify &> /dev/null || [ -x "$HOME/.local/bin/specify" ]; then
echo "CLI installed"
else
echo "CLI not installed - guide user through installation"
fi
```
### 2. Project Initialized?
```bash
if [ -d ".specify" ] && [ -f ".specify/memory/constitution.md" ]; then
echo "Project initialized"
else
echo "Project not initialized - guide user through 'specify init'"
fi
```
### 3. Current Feature
```bash
# Get latest feature directory
LATEST=$(ls -d .specify/specs/[0-9]* 2>/dev/null | sort -V | tail -1)
echo "Latest feature: $LATEST"
```
### 4. Current Phase
Detect phase by checking file existence in latest feature:
```bash
FEATURE_DIR=".specify/specs/001-feature-name"
if [ ! -f ".specify/memory/constitution.md" ]; then
echo "Phase: constitution"
elif [ ! -d "$FEATURE_DIR" ]; then
echo "Phase: specify"
elif [ -f "$FEATURE_DIR/spec.md" ] && ! grep -q "## Clarifications" "$FEATURE_DIR/spec.md"; then
echo "Phase: clarify"
elif [ ! -f "$FEATURE_DIR/plan.md" ]; then
echo "Phase: plan"
elif [ ! -f "$FEATURE_DIR/tasks.md" ]; then
echo "Phase: tasks"
elif [ -f "$FEATURE_DIR/tasks.md" ] && grep -q "\\- \\[ \\]" "$FEATURE_DIR/tasks.md"; then
echo "Phase: implement"
else
echo "Phase: complete"
fi
```
</details>
<details>
<summary>📜 Phase 1: Constitution</summary>
## Constitution Phase
Establish foundational principles that govern all development decisions.
### Purpose
Create `.specify/memory/constitution.md` with:
- Project values and principles
- Technical standards
- Decision-making frameworks
- Code quality expectations
- Architecture guidelines
### Process
1. **Gather Context**
- Understand project domain
- Identify key stakeholders
- Review existing standards (if any)
2. **Draft Constitution**
- Core values and principles
- Technical standards
- Quality expectations
- Decision criteria
3. **Structure**
```markdown
# Project Constitution
## Core Values
1. **[Value Name]**: [Description and implications]
2. **[Value Name]**: [Description and implications]
## Technical Principles
### Architecture
- [Principle with rationale]
### Code Quality
- [Standards and expectations]
### Performance
- [Performance criteria]
## Decision Framework
When making technical decisions, consider:
1. [Criterion with priority]
2. [Criterion with priority]
```
4. **Versioning**
- Constitution can evolve
- Track changes for governance
- Review periodically
### Example Content
```markdown
# Project Constitution
## Core Values
1. **Simplicity Over Cleverness**: Favor straightforward solutions that are easy to understand and maintain over clever optimizations.
2. **User Experience First**: Every technical decision should improve or maintain user experience.
## Technical Principles
### Architecture
- Prefer composition over inheritance
- Keep components loosely coupled
- Design for testability
### Code Quality
- Code reviews required for all changes
- Unit test coverage > 80%
- Documentation for public APIs
### Performance
- Page load < 3 seconds
- API response < 200ms
- Progressive enhancement for slower connections
## Decision Framework
When choosing between approaches:
1. Does it align with our core values?
2. Is it maintainable by the team?
3. Does it scale with our growth?
4. What's the long-term cost?
```
</details>
<details>
<summary>📝 Phase 2: Specify</summary>
## Specify Phase
Define *what* needs building and *why*, avoiding technology specifics.
### Script Usage
```bash
# Create new feature
.specify/scripts/bash/create-new-feature.sh --json "feature-name"
# Expected JSON output:
# {"BRANCH_NAME": "001-feature-name", "SPEC_FILE": "/path/to/.specify/specs/001-feature-name/spec.md"}
```
**Parse JSON**: Extract `BRANCH_NAME` and `SPEC_FILE` for subsequent operations.
### Template Structure
Load `.specify/templates/spec-template.md` to understand required sections, then create specification at `SPEC_FILE` location.
### Specification Content
Focus>-
Explore user intent, requirements, and design options through collaborative dialogue before implementation. Use before building new features, components, or systems — whenever the user describes something to build and design decisions are involved. Triggers: \"brainstorm\", \"help me design\", \"think through the requirements\", \"头脑风暴\", \"设计方案\", \"梳理需求\". Not for bug fixes, config changes, or tasks with an obvious implementation path.
Leverage OpenAI Codex/GPT models for autonomous code implementation, code review, and plan review. Triggers: "codex", "use gpt", "gpt-5", "let openai", "full-auto", "adversarial review", "second opinion review", "用codex", "让gpt实现", "对抗式审查", "让codex审查计划", "第二意见". Use this skill whenever the user wants to delegate coding tasks to OpenAI models, run code or plan reviews via codex, get a second-opinion review from a different model, or execute tasks in a sandboxed environment.
Create Claude Code custom slash commands with proper structure, frontmatter, and best practices. Use this skill whenever the user wants to create a new command, add a slash command, build a custom command, or mentions "create-command", "new command", "add command", or "make a command" for Claude Code. Also trigger when the user wants to turn a workflow into a reusable command.
Comprehensive session analysis and learning capture specialist. Analyzes development sessions to extract patterns, preferences, and improvements for future interactions. Use after significant work sessions to capture learnings.
Multi-agent research orchestration: split a research goal into parallel sub-goals, run each via headless `claude -p` subprocesses, aggregate results into a polished report file. Use for systematic web/document research, competitive or industry analysis, batch link/dataset processing, and long-form evidence synthesis. Triggers: "深度调研", "deep research", "wide research", "多 Agent 调研", "系统调研".
Capture technical breakthroughs and transform them into actionable, reusable documentation. Use this skill when the user has achieved a significant technical insight, solved a hard problem, discovered a non-obvious solution, or wants to document a breakthrough moment. Also trigger when the user mentions "eureka", "breakthrough", "document this insight", "capture this discovery", or wants to turn a technical win into reusable knowledge.
Fix GitHub issues end-to-end — analysis, branch creation, implementation, testing, and PR submission. Use whenever the user mentions fixing a GitHub issue, says "fix issue #123", "work on this issue", "修复 issue", or references a GitHub issue number or URL.