From spectacular
Generates Run IDs, creates isolated worktrees, brainstorms requirements, writes lean spec documents referencing constitutions, validates architecture quality, and reports completion for new features.
How this skill is triggered — by the user, by Claude, or both
Slash command
/spectacular:writing-specsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A **specification** defines WHAT to build and WHY. It is NOT an implementation plan.
A specification defines WHAT to build and WHY. It is NOT an implementation plan.
Core principle: Reference constitutions, link to docs, keep it lean. The /plan command handles task decomposition.
Spec = Requirements + Architecture Plan = Tasks + Dependencies
Use this skill when:
/spectacular:spec slash commandDo NOT use for:
/spectacular:plan insteadAnnounce: "I'm using the writing-specs skill to create a feature specification."
Before starting the spec workflow, detect the workspace mode:
# Detect workspace mode
REPO_COUNT=$(find . -maxdepth 2 -name ".git" -type d 2>/dev/null | wc -l | tr -d ' ')
if [ "$REPO_COUNT" -gt 1 ]; then
echo "Multi-repo workspace detected ($REPO_COUNT repos)"
WORKSPACE_MODE="multi-repo"
WORKSPACE_ROOT=$(pwd)
# List detected repos
find . -maxdepth 2 -name ".git" -type d | xargs -I{} dirname {} | sed 's|^\./||'
else
echo "Single-repo mode"
WORKSPACE_MODE="single-repo"
fi
Single-repo mode (current behavior):
specs/{runId}-{feature}/spec.md at repo root.worktrees/{runId}-main/@docs/constitutions/current/Multi-repo mode (new behavior):
./specs/{runId}-{feature}/spec.md at WORKSPACE rootAll specifications MUST follow: @docs/constitutions/current/
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..."
Multi-repo mode: Skip worktree creation. Specs live at workspace root, not inside any repo.
if [ "$WORKSPACE_MODE" = "multi-repo" ]; then
echo "Multi-repo mode: Specs stored at workspace root, no worktree needed"
mkdir -p specs/${RUN_ID}-${FEATURE_SLUG}
# Skip to Step 1 (brainstorming)
fi
Single-repo mode: Continue with worktree creation as normal.
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: "Generating the specification document..."
Task:
.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
---
Use the Spec Structure template below to generate the document.
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 (single-repo mode):
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: PASS
Architecture Quality: PASS
Requirements Quality: PASS
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 validation passed (multi-repo mode):
Feature Specification Complete & Validated
RUN_ID: {run-id}
Workspace: {workspace-root}
Location: specs/{run-id}-{feature-slug}/spec.md
Repos affected:
- backend: @backend/docs/constitutions/current/
- frontend: @frontend/docs/constitutions/current/
Constitution Compliance: PASS
Architecture Quality: PASS
Requirements Quality: PASS
Note: Spec is at workspace root, affecting multiple repos.
Next Steps (User Actions - DO NOT AUTO-EXECUTE):
1. Review the spec: specs/{run-id}-{feature-slug}/spec.md
2. When ready, create plan: /spectacular:plan @specs/{run-id}-{feature-slug}/spec.md
If clarifications needed (single-repo mode):
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}
If clarifications needed (multi-repo mode):
Feature Specification Complete - Clarifications Needed
RUN_ID: {run-id}
Workspace: {workspace-root}
Location: specs/{run-id}-{feature-slug}/spec.md
Clarifications: specs/{run-id}-{feature-slug}/clarifications.md
Repos affected:
- backend: @backend/docs/constitutions/current/
- frontend: @frontend/docs/constitutions/current/
Note: Spec is at workspace root, affecting multiple repos.
Next Steps:
1. Review spec: specs/{run-id}-{feature-slug}/spec.md
2. Answer clarifications: specs/{run-id}-{feature-slug}/clarifications.md
3. Once resolved, re-run: /spectacular:spec {feature-description}
# Feature: {Feature Name}
**Status**: Draft
**Created**: {date}
## Problem Statement
**Current State:**
{What exists today and what's missing/broken}
**Desired State:**
{What we want to achieve}
**Gap:**
{Specific problem this feature solves}
## Requirements
> **Note**: All features must follow @docs/constitutions/current/
### Functional Requirements
- FR1: {specific requirement}
- FR2: {specific requirement}
### Non-Functional Requirements
- NFR1: {performance/security/DX requirement}
- NFR2: {performance/security/DX requirement}
## Architecture
> **Layer boundaries**: @docs/constitutions/current/architecture.md
> **Required patterns**: @docs/constitutions/current/patterns.md
### Components
**New Files:**
- `src/lib/models/{name}.ts` - {purpose}
- `src/lib/services/{name}-service.ts` - {purpose}
- `src/lib/actions/{name}-actions.ts` - {purpose}
**Modified Files:**
- `{path}` - {what changes}
### Dependencies
**New packages:**
- `{package}` - {purpose}
- See: {link to official docs}
**Schema changes:**
- {migration name} - {purpose}
- Rules: @docs/constitutions/current/schema-rules.md
### Integration Points
- Auth: Uses existing Auth.js setup
- Database: Prisma client per @docs/constitutions/current/tech-stack.md
- Validation: Zod schemas per @docs/constitutions/current/patterns.md
## Acceptance Criteria
**Constitution compliance:**
- [ ] All patterns followed (@docs/constitutions/current/patterns.md)
- [ ] Architecture boundaries respected (@docs/constitutions/current/architecture.md)
- [ ] Testing requirements met (@docs/constitutions/current/testing.md)
**Feature-specific:**
- [ ] {criterion for this feature}
- [ ] {criterion for this feature}
- [ ] {criterion for this feature}
**Verification:**
- [ ] All tests pass
- [ ] Linting passes
- [ ] Feature works end-to-end
## Open Questions
{List any unresolved questions or decisions needed}
## References
- Architecture: @docs/constitutions/current/architecture.md
- Patterns: @docs/constitutions/current/patterns.md
- Schema Rules: @docs/constitutions/current/schema-rules.md
- Tech Stack: @docs/constitutions/current/tech-stack.md
- Testing: @docs/constitutions/current/testing.md
- {External SDK}: {link to official docs}
For multi-repo features, add this section to the spec:
## Constitutions
This feature must comply with constitutions from each affected repo:
**backend**: @backend/docs/constitutions/current/
- architecture.md - Backend layer boundaries
- patterns.md - Backend patterns (next-safe-action, etc.)
- schema-rules.md - Database design rules
**frontend**: @frontend/docs/constitutions/current/
- architecture.md - Frontend component structure
- patterns.md - Frontend patterns (React Query, etc.)
**shared-lib**: @shared-lib/docs/constitutions/current/
- (if applicable)
When brainstorming in multi-repo mode:
NEVER recreate constitution rules in the spec
```markdown ## Layered ArchitectureThe architecture has three layers:
</Bad>
<Good>
```markdown
## Architecture
> **Layer boundaries**: @docs/constitutions/current/architecture.md
Components follow the established 3-layer pattern.
NEVER include code examples from external libraries
```markdown ### Zod Validationimport { z } from 'zod';
export const schema = z.object({
name: z.string().min(3),
email: z.string().email()
});
</Bad>
<Good>
```markdown
### Validation
Use Zod schemas per @docs/constitutions/current/patterns.md
See: https://zod.dev for object schema syntax
NEVER include task breakdown or migration phases
```markdown ## Migration Plan...
</Bad>
<Good>
```markdown
## Dependencies
**Schema changes:**
- Migration: `init_rooms` - Add Room, RoomParticipant, WaitingListEntry models
Implementation order determined by `/plan` command.
NEVER include adoption metrics, performance targets, or measurement strategies
```markdown ## Success Metrics</Bad>
<Good>
```markdown
## Non-Functional Requirements
- NFR1: Page load performance <500ms (measured per @docs/constitutions/current/testing.md)
- NFR2: Support 1000 concurrent users
| Mistake | Why It's Wrong | Fix |
|---|---|---|
| Including full Prisma schemas | Duplicates what goes in code | List model names + purposes, reference schema-rules.md |
| Writing test code examples | Shows HOW not WHAT | List what to test, reference testing.md for how |
| Explaining ts-pattern syntax | Already in patterns.md | Reference patterns.md, list where pattern applies |
Creating /notes subdirectory | Violates single-file principle | Keep spec lean, remove supporting docs |
| Adding timeline estimates | That's project management | Focus on requirements and architecture |
| Excuse | Reality |
|---|---|
| "Thorough means showing complete code" | Thorough = complete requirements. Code = implementation. |
| "Spec needs examples so people understand" | Link to docs. Don't copy-paste library examples. |
| "Migration plan shows full picture" | /plan command handles decomposition. Spec = WHAT not HOW. |
| "Include constitutions for context" | Constitutions exist to avoid duplication. Reference, don't recreate. |
| "Testing code shows approach" | testing.md shows approach. Spec lists WHAT to test. |
| "Metrics demonstrate value" | NFRs show requirements. Metrics = measurement strategy (different doc). |
| "More detail = more helpful" | More detail = harder to maintain. Lean + links = durable. |
Seeing any of these? Delete and reference instead:
specs/{run-id}-{feature-slug}/notes/ directoryAll of these mean: Too much implementation detail. Focus on WHAT not HOW.
Before finalizing spec:
/spectacular:plan)specs/{run-id}-{feature-slug}/spec.md.worktrees/ is in .gitignoregit worktree prune to clean stale entriesgs repo init to initialize repositorygs ls to view current stackusing-git-spice skill for troubleshootingSpecs define WHAT and WHY. Plans define HOW and WHEN.
Reference heavily. Link to docs. Keep it lean.
If you're copy-pasting code or recreating rules, you're writing the wrong document.
npx claudepluginhub joshuarweaver/cascade-code-general-misc-3 --plugin arittr-spectacularGuides GitHub Spec-Kit CLI integration for 7-phase constitution-based spec-driven feature development, managing .specify/specs/ directories with phases: Constitution, Specify, Clarify, Plan, Tasks, Analyze, Implement.
Guides GitHub Spec-Kit CLI integration for 7-phase constitution-based spec-driven feature development, managing .specify/specs/ directories with phases: Constitution, Specify, Clarify, Plan, Tasks, Analyze, Implement.
Generates structured specifications with demoable units, functional requirements, and proof artifacts for new features. Use when starting a feature to define what to build before coding.