Technical integration layer for spec-kit CLI - handles automatic initialization, installation validation, project setup, and ensures proper file/directory layout. Called by all SDD workflow skills.
Automatic initialization and validation layer for spec-kit CLI. Called by all SDD workflow skills at startup to verify installation, initialize projects, enforce file structure, and detect when restart is needed after command installation.
/plugin marketplace add rhuss/cc-superpowers-sdd/plugin install sdd@sdd-plugin-developmentThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill is the single source of truth for all spec-kit technical integration:
This is a low-level technical skill. Workflow skills (brainstorm, implement, etc.) call this skill for setup, then proceed with their specific workflows.
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.
# Check if already initialized this session
# Use an environment variable or similar mechanism
# If "sdd_init_done" flag is set, skip to step 4
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.
# 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:
If already initialized: Skip to step 3.
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.
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:
Use these helpers to validate spec-kit file structure:
# Constitution location (per spec-kit convention)
CONSTITUTION=".specify/memory/constitution.md"
if [ -f "$CONSTITUTION" ]; then
echo "constitution-exists"
else
echo "no-constitution"
fi
# 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
}
# 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"
}
# 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"
}
Wrapper helpers for common spec-kit commands:
# Already covered in automatic initialization
speckit init
# Interactive spec creation
speckit specify [feature-description]
# Uses template from .specify/templates/spec-template.md
# Validate spec format and structure
speckit validate <spec-file>
# Example:
speckit validate specs/0001-user-auth/spec.md
# Generate implementation plan from spec
speckit plan <spec-file>
# Example:
speckit plan specs/0001-user-auth/spec.md
# Interactive constitution creation
speckit constitution
# Creates .specify/memory/constitution.md
Command not found after installation:
Init fails:
Validation fails:
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
Called by these workflow skills:
Calls:
First call in session:
Subsequent calls in session:
Session reset:
This skill is infrastructure, not workflow.
Workflow skills handle:
This skill handles:
The goal: Zero-config, automatic, invisible setup.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.