Generate a lean feature specification using brainstorming and the writing-specs skill
Generates a feature specification using brainstorming and constitutional compliance validation.
/plugin marketplace add arittr/spectacular/plugin install spectacular@spectacularYou are creating a feature specification.
All specifications MUST follow: @docs/constitutions/current/
User will provide: /spectacular:spec {feature-description}
Example: /spectacular:spec magic link authentication with Auth.js
First action: Generate a unique run identifier for this spec.
# Generate 6-char hash from feature name + timestamp
TIMESTAMP=$(date +%s)
RUN_ID=$(echo "{feature-description}-$TIMESTAMP" | shasum -a 256 | head -c 6)
echo "RUN_ID: $RUN_ID"
CRITICAL: Execute this entire block as a single multi-line Bash tool call. The comment on the first line is REQUIRED - without it, command substitution $(...) causes parse errors.
Store for use in:
specs/{run-id}-{feature-slug}/Announce: "Generated RUN_ID: {run-id} for tracking this spec run"
Announce: "Creating isolated worktree for this spec run..."
Create worktree for isolated development:
Create branch using git-spice:
using-git-spice skill to create branch {runId}-main from current branch{runId}-main (e.g., abc123-main)Create worktree:
# Create worktree at .worktrees/{runId}-main/
git worktree add .worktrees/${RUN_ID}-main ${RUN_ID}-main
Error handling:
git worktree remove .worktrees/{runId}-main or use a different feature name."Working directory context:
.worktrees/{runId}-main/Announce: "Worktree created at .worktrees/{runId}-main/ - all work will happen in isolation"
REQUIRED: Each worktree needs dependencies installed before work begins.
Check CLAUDE.md for setup commands:
Look for this pattern in the project's CLAUDE.md:
## Development Commands
### Setup
- **install**: `bun install`
- **postinstall**: `npx prisma generate`
If setup commands found, run installation:
# Navigate to worktree
cd .worktrees/${RUN_ID}-main
# Check if dependencies already installed (handles resume)
if [ ! -d node_modules ]; then
echo "Installing dependencies..."
{install-command} # From CLAUDE.md (e.g., bun install)
# Run postinstall if defined
if [ -n "{postinstall-command}" ]; then
echo "Running postinstall (codegen)..."
{postinstall-command} # From CLAUDE.md (e.g., npx prisma generate)
fi
else
echo "✅ Dependencies already installed"
fi
If setup commands NOT found in CLAUDE.md:
Error and instruct user:
❌ Setup Commands Required
Worktrees need dependencies installed to run quality checks and codegen.
Please add to your project's CLAUDE.md:
## Development Commands
### Setup
- **install**: `bun install` (or npm install, pnpm install, etc.)
- **postinstall**: `npx prisma generate` (optional - for codegen)
Then re-run: /spectacular:spec {feature-description}
Announce: "Dependencies installed in worktree - ready for spec generation"
Context: All brainstorming happens in the context of the worktree (.worktrees/{runId}-main/)
Announce: "I'm brainstorming the design using Phases 1-3 (Understanding, Exploration, Design Presentation)."
Create TodoWrite checklist:
Brainstorming for Spec:
- [ ] Phase 1: Understanding (purpose, constraints, criteria)
- [ ] Phase 2: Exploration (2-3 approaches proposed)
- [ ] Phase 3: Design Presentation (design validated)
- [ ] Proceed to Step 2: Generate Specification
Goal: Clarify scope, constraints, and success criteria.
Constitution compliance:
Goal: Propose and evaluate 2-3 architectural approaches.
Goal: Present detailed design incrementally and validate.
After Phase 3: Mark TodoWrite complete and proceed immediately to Step 2.
Announce: "I'm using the Writing Specs skill to create the specification."
Use the writing-specs skill to generate the spec document.
Task for writing-specs skill:
.worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/spec.md/spectacular:plan's job)Spec frontmatter must include:
---
runId: {run-id}
feature: {feature-slug}
created: {date}
status: draft
---
After spec generation completes, commit the spec to the worktree branch:
cd .worktrees/${RUN_ID}-main
git add specs/
git commit -m "spec: add ${feature-slug} specification [${RUN_ID}]"
Announce: "Spec committed to {runId}-main branch in worktree"
CRITICAL: Before reporting completion, validate the spec against architecture quality standards.
Announce: "Validating spec against architecture quality standards..."
Read the generated spec and check against these dimensions:
If ANY checks fail, create .worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/clarifications.md with:
# Clarifications Needed
## [Category: Constitution/Quality/Requirements/Architecture]
**Issue**: {What's wrong}
**Location**: {Spec section reference}
**Severity**: [BLOCKER/CRITICAL/MINOR]
**Question**: {What needs to be resolved}
Options:
- A: {Option with trade-offs}
- B: {Option with trade-offs}
- Custom: {User provides alternative}
Iteration limit: Maximum 3 validation cycles. If issues remain after 3 iterations, escalate to user with clarifications.md.
IMPORTANT: After reporting completion, STOP HERE. Do not proceed to plan generation automatically. The user must review the spec and explicitly run /spectacular:plan when ready.
After validation passes OR clarifications documented, report to user:
If validation passed:
✅ Feature Specification Complete & Validated
RUN_ID: {run-id}
Worktree: .worktrees/{run-id}-main/
Branch: {run-id}-main
Location: .worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/spec.md
Constitution Compliance: ✓
Architecture Quality: ✓
Requirements Quality: ✓
Note: Spec is in isolated worktree, main repo unchanged.
Next Steps (User Actions - DO NOT AUTO-EXECUTE):
1. Review the spec: .worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/spec.md
2. When ready, create implementation plan: /spectacular:plan @.worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/spec.md
If clarifications needed:
⚠️ Feature Specification Complete - Clarifications Needed
RUN_ID: {run-id}
Worktree: .worktrees/{run-id}-main/
Branch: {run-id}-main
Location: .worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/spec.md
Clarifications: .worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/clarifications.md
Note: Spec is in isolated worktree, main repo unchanged.
Next Steps:
1. Review spec: .worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/spec.md
2. Answer clarifications: .worktrees/{run-id}-main/specs/{run-id}-{feature-slug}/clarifications.md
3. Once resolved, re-run: /spectacular:spec {feature-description}
Now generate the specification for: {feature-description}