mirror of
https://github.com/harivansh-afk/claude-code-vertical.git
synced 2026-04-15 07:04:45 +00:00
7 KiB
7 KiB
Spec Schema v2
Enhanced spec format incorporating learnings from agent workflows + oracle planning patterns.
Full Schema
# === METADATA ===
name: feature-name # Short identifier (no spaces)
description: | # What this PR accomplishes
Multi-line description of what this spec implements.
Should be clear to someone reviewing the PR.
# === ATOMICITY ===
atomic: true # REQUIRED: Each spec = one commit
complexity: 3 # 1-10 scale (for orchestrator scheduling)
estimated_minutes: 45 # Rough estimate (helps parallel scheduling)
# === DEMO & SPRINT CONTEXT ===
demo_goal: | # What this makes demoable at sprint level
User can now authenticate with Google OAuth and see their profile.
sprint_checkpoint: true # Is this a sprint demo milestone?
# === SKILLS ===
skill_hints: # Orchestrator matches to skill-index
- typescript-patterns
- react-testing
- security-best-practices
# === BUILDING ===
building_spec:
requirements: # What to build (specific, technical)
- Add Google OAuth button to login page
- Create /api/auth/google/callback route
- Store OAuth tokens in Prisma database
- Add GoogleUser type to schema
constraints: # Rules to follow
- Must use existing AuthContext pattern
- No direct database access (use Prisma only)
- Follow existing error handling patterns
- Keep bundle size <5kb increase
files: # Where code lives (helps weaver focus)
- src/components/auth/GoogleButton.tsx
- src/pages/api/auth/google/**
- prisma/schema.prisma
dependencies: # Task IDs this depends on
- auth-01-schema # Must complete before this
test_first: # OPTIONAL: Write tests before implementation
- test: "Google button redirects to OAuth URL"
file: "src/components/auth/__tests__/GoogleButton.test.tsx"
- test: "Callback route exchanges code for token"
file: "src/pages/api/auth/google/__tests__/callback.test.ts"
# === VERIFICATION ===
verification_spec:
# Deterministic checks first
- type: command
name: "typecheck"
run: "npm run typecheck"
expect: exit_code 0
- type: command
name: "tests"
run: "npm test -- google"
expect: exit_code 0
- type: file-contains
path: "src/components/auth/GoogleButton.tsx"
pattern: "window.location.href.*google.*oauth"
reason: "OAuth redirect must be implemented"
- type: file-not-contains
path: "src/"
pattern: "console.log.*token"
reason: "No token logging in production"
# Test-first validation (if specified)
- type: test-first-check
description: "Verify tests were written before implementation"
test_files:
- "src/components/auth/__tests__/GoogleButton.test.tsx"
- "src/pages/api/auth/google/__tests__/callback.test.ts"
# Agent-based checks (last, non-deterministic)
- type: agent
name: "security-review"
prompt: |
Review OAuth implementation for security:
1. No client secret exposed to frontend
2. PKCE code_verifier generated securely
3. State parameter validated (CSRF protection)
4. Tokens stored server-side only
Report PASS/FAIL with evidence.
# Demo validation (for sprint checkpoints)
- type: demo
name: "google-oauth-flow"
description: "Manual verification of OAuth flow"
steps:
- "npm run dev"
- "Navigate to /login"
- "Click 'Sign in with Google'"
- "Complete OAuth flow in popup"
- "Verify: redirected to dashboard with user profile"
acceptance: "User can complete full OAuth flow without errors"
# === REVIEW (before weaver execution) ===
review_spec:
type: subagent # Spawn reviewer before building
model: opus # Review uses Opus
prompt: |
Review this spec for quality before building:
Check:
1. Is each requirement atomic (one commit)?
2. Are tests defined clearly (or validation method)?
3. Are dependencies identified?
4. Is demo goal clear and testable?
5. Are constraints specific (not vague)?
Report PASS or FAIL with specific issues.
accept_criteria:
- "Requirements are atomic and specific"
- "Tests or validation method defined"
- "Dependencies identified (or none)"
- "Demo goal is testable"
# === PR METADATA ===
pr:
branch: auth/03-google-oauth
base: auth/02-password # Stacked on previous spec
title: "feat(auth): add Google OAuth login"
labels: # GitHub PR labels
- auth
- security
reviewers: # Optional: auto-assign reviewers
- security-team
Key Changes from v1
Added Fields
atomic: true- Enforces one-commit rulecomplexity: 1-10- Helps orchestrator schedule parallel workestimated_minutes- Rough time estimatedemo_goal- Sprint-level demoable outcomesprint_checkpoint: true- Marks sprint milestonesdependencies- Explicit task IDs (not just PR base)test_first- Write tests before implementationreview_spec- Subagent reviews spec before building
Enhanced Sections
verification_spec additions:
test-first-check- Validates tests existdemotype - Manual verification with stepsname+reasonfields for clarity
building_spec additions:
test_first- List tests to write firstdependencies- Task IDs (separate from PR stacking)
Validation Types
validation_type: "tests" # Default: automated tests
validation_type: "manual" # Visual/UX verification
validation_type: "demo" # Sprint checkpoint demo
validation_type: "benchmark" # Performance validation
Usage in Vertical
Planner Flow
- Gather requirements (AskUserTool)
- Call oracle with full context
- Oracle outputs plan.md (following this schema)
- Planner transforms plan.md tasks → spec yamls
- Review subagent validates each spec
- Orchestrator executes validated specs
Orchestrator Scheduling
Uses new fields for smart scheduling:
complexity- balance heavy/light tasksestimated_minutes- predict completiondependencies- build execution graphatomic: true- enforce one-commit rule
Weaver Execution
- Read spec (all fields)
- If
test_firstexists, write tests first - Implement
building_spec.requirements - Run
verification_specchecks in order - If
demotype exists, prompt human for manual verification - Create PR only after all checks pass
Migration from v1
Old specs still work. New fields are optional except:
atomic: true- should be added to all specsdemo_goal- required for sprint checkpoints
Examples
See:
examples/auth-google-oauth.yaml- Full example aboveexamples/simple-bugfix.yaml- Minimal spec (no test-first, no demo)examples/sprint-milestone.yaml- Sprint checkpoint with demo validation