Use before creating worktrees or executing tasks - validates that CLAUDE.md defines required setup commands (install, optional postinstall) and provides clear error messages with examples if missing
Validates CLAUDE.md contains setup commands before creating worktrees. Triggers when you create worktrees or execute tasks that need dependencies, preventing "command not found" errors with clear fix instructions.
/plugin marketplace add arittr/spectacular/plugin install spectacular@spectacularThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Worktrees require dependency installation before tasks can execute. Projects MUST define setup commands in CLAUDE.md.
This skill validates setup commands exist BEFORE creating worktrees, preventing cryptic failures later.
Use this skill when:
Use early: Validate during setup phase, not during task execution.
Without validation:
With validation:
Announce: "Validating CLAUDE.md setup commands before creating worktrees."
# Get repo root
REPO_ROOT=$(git rev-parse --show-toplevel)
# Check if CLAUDE.md exists
if [ ! -f "$REPO_ROOT/CLAUDE.md" ]; then
echo "❌ Error: CLAUDE.md not found in repository root"
echo ""
echo "Spectacular requires CLAUDE.md to define setup commands."
echo "See: https://docs.claude.com/claude-code"
exit 1
fi
Why fail fast: No CLAUDE.md = no command configuration. Stop before creating any worktrees.
# Parse CLAUDE.md for setup section
INSTALL_CMD=$(grep -A 10 "^### Setup" "$REPO_ROOT/CLAUDE.md" | grep "^- \*\*install\*\*:" | sed 's/.*: `\(.*\)`.*/\1/')
if [ -z "$INSTALL_CMD" ]; then
echo "❌ Error: Setup commands not defined in CLAUDE.md"
echo ""
echo "Worktrees require dependency installation before tasks can execute."
echo ""
echo "Add this section to CLAUDE.md:"
echo ""
echo "## Development Commands"
echo ""
echo "### Setup"
echo "- **install**: \`npm install\` (or your package manager)"
echo "- **postinstall**: \`npx prisma generate\` (optional - any codegen)"
echo ""
echo "Example for different package managers:"
echo "- Node.js: npm install, pnpm install, yarn, or bun install"
echo "- Python: pip install -r requirements.txt"
echo "- Rust: cargo build"
echo "- Go: go mod download"
echo ""
echo "See: https://docs.claude.com/claude-code"
echo ""
echo "Execution stopped. Add setup commands to CLAUDE.md and retry."
exit 1
fi
# Extract postinstall command (optional)
POSTINSTALL_CMD=$(grep -A 10 "^### Setup" "$REPO_ROOT/CLAUDE.md" | grep "^- \*\*postinstall\*\*:" | sed 's/.*: `\(.*\)`.*/\1/')
Parsing logic:
### Setup header**install**: command (required)**postinstall**: command (optional)# Report detected commands
echo "✅ Setup commands found in CLAUDE.md"
echo " install: $INSTALL_CMD"
if [ -n "$POSTINSTALL_CMD" ]; then
echo " postinstall: $POSTINSTALL_CMD"
fi
Store for later use:
INSTALL_CMD to callerPOSTINSTALL_CMD (may be empty)The skill expects this exact format:
## Development Commands
### Setup
- **install**: `npm install`
- **postinstall**: `npx prisma generate` (optional)
Format requirements:
### Setup (exactly)- **install**: command`` (required)- **postinstall**: command`` (optional)Multi-language examples:
### Setup
- **install**: `npm install` # Node.js
- **install**: `pip install -r requirements.txt` # Python
- **install**: `cargo build` # Rust
- **install**: `go mod download` # Go
- **install**: `bundle install` # Ruby
❌ Error: CLAUDE.md not found in repository root
Spectacular requires CLAUDE.md to define setup commands.
See: https://docs.claude.com/claude-code
User action: Create CLAUDE.md in repository root.
❌ Error: Setup commands not defined in CLAUDE.md
Worktrees require dependency installation before tasks can execute.
Add this section to CLAUDE.md:
## Development Commands
### Setup
- **install**: `npm install` (or your package manager)
- **postinstall**: `npx prisma generate` (optional - any codegen)
Example for different package managers:
- Node.js: npm install, pnpm install, yarn, or bun install
- Python: pip install -r requirements.txt
- Rust: cargo build
- Go: go mod download
See: https://docs.claude.com/claude-code
Execution stopped. Add setup commands to CLAUDE.md and retry.
User action: Add Setup section with at least install command.
How commands use this skill:
# In execute.md or spec.md:
# Step 1.5: Validate Setup Commands
# Use validating-setup-commands skill to extract and verify
INSTALL_CMD=$(validate_setup_commands_install)
POSTINSTALL_CMD=$(validate_setup_commands_postinstall)
# Step 3: Create worktrees
git worktree add .worktrees/{runid}-task-1
# Step 4: Install dependencies using validated commands
cd .worktrees/{runid}-task-1
$INSTALL_CMD
if [ -n "$POSTINSTALL_CMD" ]; then
$POSTINSTALL_CMD
fi
Reusable across:
/spectacular:spec - Validates before creating main worktree/spectacular:execute - Validates before creating task worktreesWrong: Create worktrees, then validate Right: Validate BEFORE creating ANY worktrees
Why: Failed validation after worktrees exist leaves orphaned directories.
Wrong: "Error: Add setup commands" Right: "Error: Add setup commands. Here's the exact format: [example]"
Why: Users need to know WHAT to add and WHERE.
Wrong: Fail if postinstall missing Right: Postinstall is optional (codegen only needed in some projects)
Why: Not all projects have codegen (Prisma, GraphQL, etc.).
Validation sequence:
### Setup sectioninstall command (exit if missing)postinstall command (optional)Exit points:
Format validated:
### Setup header- **install**: command``- **postinstall**: command`` (optional)Validate setup commands BEFORE creating worktrees.
Early validation with clear error messages prevents confusing failures during task execution.
The skill provides users with exact examples of what to add, making fixes easy.
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.