Back to Skills

spec-kit

rhuss
Updated Today
86 views
1
1
View on GitHub
Metaautomation

About

The spec-kit skill provides the technical integration layer for spec-kit CLI, automatically handling initialization, installation validation, and project setup. It ensures proper file/directory layout and serves as the single source of truth for all SDD workflow skills. Developers should use this low-level technical skill when building workflow skills that require spec-kit integration.

Documentation

Spec-Kit Technical Integration

Purpose

This skill is the single source of truth for all spec-kit technical integration:

  • Automatic initialization and setup
  • Installation validation
  • Project structure management
  • CLI command wrappers
  • Layout and file path enforcement

This is a low-level technical skill. Workflow skills (brainstorm, implement, etc.) call this skill for setup, then proceed with their specific workflows.

Automatic Initialization Protocol

IMPORTANT: This runs automatically when called by any workflow skill.

Every SDD workflow skill calls this skill first via {Skill: spec-kit}. When called, execute this initialization sequence once per session.

Session Tracking

# Check if already initialized this session
# Use an environment variable or similar mechanism
# If "sdd_init_done" flag is set, skip to step 4

Step 1: Check spec-kit CLI Installation

which speckit

If NOT found:

❌ ERROR: spec-kit is required but not installed

spec-kit provides the templates, scripts, and tooling for SDD workflows.

Installation:
1. Visit: https://github.com/github/spec-kit
2. Follow installation instructions
3. Ensure 'speckit' is in your PATH
4. Verify: run 'which speckit'

After installation, restart this workflow.

STOP workflow. Do not proceed without spec-kit.

If found:

# Get version for logging
speckit --version

Proceed to step 2.

Step 2: Check Project Initialization

# Check if .specify/ directory exists
[ -d .specify ] && echo "initialized" || echo "not-initialized"

If NOT initialized:

Display message:

spec-kit is installed ✓

This project needs initialization...
Running: speckit init

Execute initialization:

speckit init

Check for errors:

  • Permission denied → suggest running with proper permissions
  • Command failed → display error and suggest manual init
  • Success → proceed to step 3

If already initialized: Skip to step 3.

Step 3: Check for New Commands (Restart Detection)

After speckit init runs, check if local commands were installed:

# Check if spec-kit installed Claude Code commands
if [ -d .claude/commands ]; then
  ls .claude/commands/ | grep -q speckit
  if [ $? -eq 0 ]; then
    echo "commands-installed"
  fi
fi

If commands were installed:

Display restart prompt:

✅ Project initialized successfully!

⚠️  RESTART REQUIRED ⚠️

spec-kit has installed local slash commands in:
  .claude/commands/speckit.*

To load these new commands, please:
1. Save your work
2. Close this conversation
3. Restart Claude Code application
4. Return to this project
5. Continue your workflow

After restart, you'll have access to:
- /sdd:* commands (from this plugin)
- /speckit.* commands (from local spec-kit installation)

[Workflow paused - resume after restart]

STOP workflow. User must restart before continuing.

If no new commands installed: Proceed to step 4.

Step 4: Verify Installation

Quick sanity check:

# Verify key files exist
[ -f .specify/templates/spec-template.md ] && \
[ -f .specify/scripts/bash/common.sh ] && \
echo "verified" || echo "corrupt"

If verification fails:

❌ ERROR: .specify/ exists but appears incomplete

This may be due to a failed initialization.

Please run: speckit init --force

Then restart this workflow.

STOP workflow.

If verification succeeds:

  • Set session flag: "sdd_init_done"
  • Return success to calling skill
  • Calling skill continues with its workflow

Layout Validation

Use these helpers to validate spec-kit file structure:

Check Constitution

# Constitution location (per spec-kit convention)
CONSTITUTION=".specify/memory/constitution.md"

if [ -f "$CONSTITUTION" ]; then
  echo "constitution-exists"
else
  echo "no-constitution"
fi

Get Feature Spec Path

# Validate feature spec path follows spec-kit layout
# Expected: specs/NNNN-feature-name/spec.md
# Or: specs/features/feature-name.md

validate_spec_path() {
  local spec_path=$1

  # Check if follows spec-kit conventions
  if [[ $spec_path =~ ^specs/[0-9]+-[a-z-]+/spec\.md$ ]] || \
     [[ $spec_path =~ ^specs/features/[a-z-]+\.md$ ]]; then
    echo "valid"
  else
    echo "invalid: spec must be in specs/ directory with proper naming"
  fi
}

Get Plan Path

# Plan location (per spec-kit convention)
# Expected: specs/NNNN-feature-name/docs/plan.md

get_plan_path() {
  local feature_dir=$1  # e.g., "specs/0001-user-auth"
  echo "$feature_dir/docs/plan.md"
}

Ensure Directory Structure

# Create spec-kit compliant feature structure
ensure_feature_structure() {
  local feature_dir=$1  # e.g., "specs/0001-user-auth"

  mkdir -p "$feature_dir/docs"
  mkdir -p "$feature_dir/checklists"
  mkdir -p "$feature_dir/contracts"

  echo "created: $feature_dir structure"
}

Spec-Kit CLI Commands

Wrapper helpers for common spec-kit commands:

Initialize Project

# Already covered in automatic initialization
speckit init

Create Specification

# Interactive spec creation
speckit specify [feature-description]

# Uses template from .specify/templates/spec-template.md

Validate Specification

# Validate spec format and structure
speckit validate <spec-file>

# Example:
speckit validate specs/0001-user-auth/spec.md

Generate Plan

# Generate implementation plan from spec
speckit plan <spec-file>

# Example:
speckit plan specs/0001-user-auth/spec.md

Create Constitution

# Interactive constitution creation
speckit constitution

# Creates .specify/memory/constitution.md

Error Handling

spec-kit CLI Errors

Command not found after installation:

  • Check PATH configuration
  • Suggest shell restart
  • Provide which speckit output

Init fails:

  • Check write permissions
  • Check disk space
  • Suggest manual troubleshooting

Validation fails:

  • Display validation errors
  • Suggest fixes based on error type
  • Reference spec template

File System Errors

Permission denied:

Cannot write to project directory.

Please ensure you have write permissions:
  chmod +w .

Path not found:

Expected file not found: <path>

This suggests incomplete initialization.
Run: speckit init --force

Integration Points

Called by these workflow skills:

  • sdd:brainstorm (at start)
  • sdd:implement (at start)
  • sdd:evolve (at start)
  • sdd:constitution (at start)
  • sdd:review-spec (at start)
  • All workflow skills that need spec-kit

Calls:

  • spec-kit CLI (external command)
  • File system operations
  • No other skills (this is a leaf skill)

Session Management

First call in session:

  • Run full initialization protocol
  • Check installation, project, commands
  • Prompt restart if needed
  • Set session flag

Subsequent calls in session:

  • Check session flag
  • Skip initialization if already done
  • Optionally re-verify critical paths
  • Return success immediately

Session reset:

  • New conversation = new session
  • Re-run initialization protocol
  • Ensures project state is current

Remember

This skill is infrastructure, not workflow.

  • Don't make decisions about WHAT to build
  • Don't route to other workflow skills
  • Just ensure spec-kit is ready to use
  • Validate paths and structure
  • Handle technical errors

Workflow skills handle:

  • What to create (specs, plans, code)
  • When to use which tool
  • Process discipline and quality gates

This skill handles:

  • Is spec-kit installed?
  • Is project initialized?
  • Do files exist in correct locations?
  • Are commands available?

The goal: Zero-config, automatic, invisible setup.

Quick Install

/plugin add https://github.com/rhuss/cc-superpowers-sdd/tree/main/spec-kit

Copy and paste this command in Claude Code to install this skill

GitHub 仓库

rhuss/cc-superpowers-sdd
Path: skills/spec-kit

Related Skills

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

business-rule-documentation

Meta

This skill provides standardized templates for systematically documenting business logic and domain knowledge following Domain-Driven Design principles. It helps developers capture business rules, process flows, decision trees, and terminology glossaries to maintain consistency between requirements and implementation. Use it when documenting domain models, creating business rule repositories, or bridging communication between business and technical teams.

View skill

Algorithmic Art Generation

Meta

This skill helps developers create algorithmic art using p5.js, focusing on generative art, computational aesthetics, and interactive visualizations. It automatically activates for topics like "generative art" or "p5.js visualization" and guides you through creating unique algorithms with features like seeded randomness, flow fields, and particle systems. Use it when you need to build reproducible, code-driven artistic patterns.

View skill

generating-unit-tests

Meta

This skill automatically generates comprehensive unit tests from source code when developers request test creation. It supports multiple testing frameworks like Jest, pytest, and JUnit, intelligently detecting the appropriate one or using a specified framework. Use it when asking to "generate tests," "create unit tests," or using the "gut" shortcut with file paths.

View skill