project-standalo-sonic-cloud/.claude/commands/guardrail/validate.md

2.6 KiB

description allowed-tools
Validate implementation against design document Read, Bash, Glob, Grep

Validate Implementation

Validate: "$ARGUMENTS"

Purpose

Check that implementations match the design document specifications exactly.

Validation Steps

1. Run Implementation Validator

python3 skills/guardrail-orchestrator/scripts/workflow_manager.py validate --checklist

2. Review Errors

The validator checks:

  • Components: Props match design, events implemented
  • APIs: Routes exist, methods implemented, schemas match
  • Models: Prisma fields match design

3. Fix Issues

For each error, check:

  1. Read the design spec:

    cat .workflow/versions/v001/contexts/<entity_id>.yml
    
  2. Check generated types:

    cat types/component-props.ts | grep -A 20 "<ComponentName>Props"
    
  3. Fix the implementation to match the design

  4. Re-validate:

    python3 skills/guardrail-orchestrator/scripts/workflow_manager.py validate
    

4. View Checklist

# View markdown checklist
cat .workflow/versions/v001/implementation_checklist.md

# Or use the workflow command
python3 skills/guardrail-orchestrator/scripts/workflow_manager.py checklist show

Common Issues

Props Don't Match Design

Problem: Component uses flat props instead of typed objects

// ❌ Wrong
interface SongCardProps {
  id: string;
  title: string;
}

// ✅ Correct - from generated types
import type { SongCardProps } from '@/types/component-props';
// SongCardProps = { song: Song; showArtist?: boolean; }

Missing Events

Problem: Design specifies events not implemented

// Design specifies: onPlay, onAddToPlaylist
// Implementation only has: onPlay

// Fix: Add missing event
export function SongCard({ song, onPlay, onAddToPlaylist }: SongCardProps) {
  // Implement onAddToPlaylist handler
}

API Route Missing

Problem: API route file doesn't exist

Expected: app/api/songs/[id]/route.ts
Actual: (not found)

Fix: Create the route file following the design spec.

Validation Report Symbols

  • Passed - Implementation matches design
  • ⚠️ Warning - Minor issue (e.g., optional field missing)
  • Error - Critical mismatch with design

Post-Validation

After all errors are fixed:

# Verify clean validation
python3 skills/guardrail-orchestrator/scripts/workflow_manager.py validate

# If passed, transition to REVIEWING phase
python3 skills/guardrail-orchestrator/scripts/workflow_manager.py transition REVIEWING