원클릭으로
sea-debug
Debug SEA-Forge specific issues including code generation failures, spec validation errors, handler mismatches, and runtime problems.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Debug SEA-Forge specific issues including code generation failures, spec validation errors, handler mismatches, and runtime problems.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends AI agent capabilities with specialized knowledge, workflows, or tool integrations.
Use when creating, scaffolding, or updating the repository AI harness in VS Code. Trigger on requests to bootstrap or refresh instructions, prompts, agents, hooks, skills, or memory layers while preserving useful existing structure and avoiding monolithic always-on context.
Canonical SEA-Forge release workflow for release preparation, validation, branch promotion, tagging, rollback, and release-gate evidence. Use when preparing a release, promoting dev to stage or stage to main, cutting a version tag, validating release readiness, handling hotfix forward-merges, planning rollback, or executing a full end-to-end release. Prefer existing just recipes and evidence-producing gates over ad hoc deployment steps.
Use when SEA work touches specs, generators, manifests, semantic fixtures, regeneration, `src/gen`, or behavior projected from ADR/PRD/SDS/SEA authority.
Use when a SEA context has valid specs and generated contracts but lacks handwritten logic, runtime wiring, persistence, integration, tests, or executable proof.
Create concise, copy-paste-ready bridge prompts between a repo-aware coding agent and an external strategic reasoning agent such as S1 ArchDevAgent. Use when the user wants to offload architecture, research, large refactor planning, migration design, plan critique, implementation-spec drafting, test-strategy design, whole-repo analysis, or diff review to an external agent while keeping repo inspection and implementation in the coding agent. Also use when the user says "use S1", "ask S1", "make a prompt for S1", "bridge this to my external agent", "prepare a context packet", or "validate this S1 response".
| name | sea-debug |
| description | Debug SEA-Forge specific issues including code generation failures, spec validation errors, handler mismatches, and runtime problems. |
Debug SEA-Forge specific issues across the pipeline: code generation, spec validation, handler mismatches, runtime errors, and integration problems.
Invoke when:
User invokes with:
echo "🔍 Identifying issue category..."
# Check spec files
if find docs/specs -name "*.yaml" -exec calm validate {} \; 2>&1 | grep -q error; then
CATEGORY="spec_validation"
elif ! just pipeline 2>&1 | grep -q "Generation successful"; then
CATEGORY="code_generation"
elif ! pnpm test 2>&1 | grep -q "passing"; then
CATEGORY="test_failure"
else
CATEGORY="runtime_error"
fi
echo "Issue category: $CATEGORY"
# SEA-Forg diagnostics
echo "--- SEA Environment ---"
just env || echo "just env not available"
echo "--- Nx Workspace ---"
pnpm exec nx report
echo "--- Spec Validation ---"
find docs/specs -name "*.yaml" -exec calm validate {} \; 2>&1 | head -20
echo "--- Generated Code Status ---"
find . -path "*/src/gen/*" -type f | head -20
echo "--- Recent Pipeline Runs ---"
git log --oneline -10 --grep="pipeline\|generate"
echo "--- Test Status ---"
pnpm test --reporter=verbose 2>&1 | tail -50
echo "🔍 Analyzing spec validation..."
# Check for syntax errors
for spec in docs/specs/**/*.yaml; do
if ! yq eval '.' "$spec" > /dev/null 2>&1; then
echo "❌ YAML syntax error: $spec"
yq eval '.' "$spec" 2>&1 | head -10
fi
done
# Check for missing required fields
for spec in docs/specs/**/*.yaml; do
echo "--- Checking: $spec ---"
yq eval '
.context as $context |
.domain as $domain |
.api_surface as $api |
if $context == null then error("Missing context section") end |
if $domain == null then error("Missing domain section") end |
if $api == null then error("Missing api_surface section") end
' "$spec" 2>&1 || true
done
# Check CALM compliance
if command -v calm &> /dev/null; then
echo "--- CALM Validation ---"
calm validate docs/specs/ 2>&1 | head -30
fi
echo "🔍 Analyzing code generation..."
# Run pipeline with verbose output
just pipeline --verbose 2>&1 | tee tmp/pipeline-debug.log
# Check for common errors
echo "--- Common Generation Errors ---"
grep -i "error\|fail\|exception" tmp/pipeline-debug.log | head -20
# Check spec-to-handler mapping
echo "--- Spec to Handler Mapping ---"
for spec in docs/specs/**/*spec.yaml; do
CONTEXT=$(yq e '.context.name' "$spec")
echo "Context: $CONTEXT"
echo "Spec: $spec"
echo "Handlers:"
find "apps/$CONTEXT/src/gen" -name "*.ts" 2>/dev/null | head -5 || echo " No handlers found"
echo ""
done
echo "🔍 Analyzing handler mismatches..."
# Compare spec endpoints to generated handlers
for spec in docs/specs/**/*spec.yaml; do
CONTEXT=$(yq e '.context.name' "$spec")
# Get expected endpoints from spec
EXPECTED=$(yq e '.api_surface.endpoints[].name' "$spec" | sort)
# Get actual handlers
ACTUAL=$(find "apps/$CONTEXT/src/gen" -name "*Handler.ts" -exec basename {} \; | sed 's/Handler.ts//' | sort)
# Compare
echo "--- Context: $CONTEXT ---"
echo "Expected endpoints:"
echo "$EXPECTED" | while read ep; do
if echo "$ACTUAL" | grep -q "^$ep$"; then
echo " ✅ $ep"
else
echo " ❌ $ep (missing)"
fi
done
echo "Extra handlers:"
echo "$ACTUAL" | while read handler; do
if ! echo "$EXPECTED" | grep -q "^$handler$"; then
echo " ⚠️ $handler (not in spec)"
fi
done
done
echo "🔍 Analyzing runtime errors..."
# Check recent error logs
echo "--- Recent Error Logs ---"
if [ -f "logs/error.log" ]; then
tail -50 logs/error.log
fi
# Check for common patterns
echo "--- Common Error Patterns ---"
# Missing environment variables
grep -r "process.env\." src/ | grep -v "test" | while read line; do
VAR=$(echo "$line" | grep -oE 'process\.env\.[A-Z_]+' | sort -u)
if [ -n "$VAR" ]; then
echo "Check if $VAR is set"
fi
done
# Missing dependencies
echo "--- Checking for missing imports ---"
find src -name "*.ts" -exec grep -h "^import" {} \; | sort -u > tmp/imports.txt
while read dep; do
if ! grep -q "$dep" package.json; then
echo "⚠️ Possibly missing: $dep"
fi
done < tmp/imports.txt
echo "💡 Generating fix recommendations..."
# Based on issue category
case "$CATEGORY" in
spec_validation)
echo "Spec Validation Fixes:"
echo "1. Fix YAML syntax errors"
echo "2. Add missing required fields"
echo "3. Run calm validate docs/specs/"
echo "4. Check CALM compliance"
;;
code_generation)
echo "Code Generation Fixes:"
echo "1. Check spec validity: calm validate docs/specs/"
echo "2. Clear generation cache: rm -rf src/gen/"
echo "3. Regenerate: just pipeline <context>"
echo "4. Check handler-generator logs"
;;
handler_mismatch)
echo "Handler Mismatch Fixes:"
echo "1. Update spec with missing endpoints"
echo "2. Regenerate handlers: just pipeline <context>"
echo "3. Remove orphaned handlers"
echo "4. Validate spec: /spec-validate"
;;
runtime_error)
echo "Runtime Error Fixes:"
echo "1. Check environment variables"
echo "2. Verify dependencies: pnpm install"
echo "3. Check logs: tail -f logs/error.log"
echo "4. Run tests: pnpm test"
;;
esac
cat > tmp/debug-report.md <<EOF
# SEA Debug Report
**Date**: $(date -u +%Y-%m-%dT%H:%M:%SZ)
**Category**: $CATEGORY
**Branch**: $(git branch --show-current)
**Commit**: $(git log -1 --format=%h)
## Issue Description
{user's issue description}
## Diagnostic Information
### Environment
\`\`\`
$(just env 2>&1 || echo "Not available")
\`\`\`
### Validation Status
- Spec validation: {$SPEC_STATUS}
- Code generation: {$GEN_STATUS}
- Tests: {$TEST_STATUS}
## Findings
{analysis findings}
## Recommendations
{fix recommendations}
## Next Steps
1. {step 1}
2. {step 2}
3. {step 3}
EOF
echo "Debug report: tmp/debug-report.md"
Cause: Spec changed but handlers not regenerated
Fix:
# Clear and regenerate
rm -rf apps/*/src/gen/*
just pipeline
# Or regenerate specific context
just pipeline user-management
Cause: Invalid YAML or missing fields
Fix:
# Validate specific spec
calm validate docs/specs/my-spec.yaml
# Check syntax
yq eval '.' docs/specs/my-spec.yaml
# Fix reported issues
Cause: Spec and handlers out of sync
Fix:
# Compare spec to handlers
# See "Handler Mismatches" above
# Regenerate from spec
just pipeline <context>
Cause: Generated handlers need domain implementation
Fix:
# Implement domain layer
# Update src/domain/*.ts files
# Or update tests to match new signatures
# Validate all specs
calm validate docs/specs/
# Generate handlers
just pipeline
# Run tests
pnpm test
# Check environment
just env
# View logs
tail -f logs/error.log
# Nx graph
pnpm exec nx graph
# Nx affected
pnpm exec nx affected
debugging-codegen-pipeline for pipeline issuesobservability-debugging for runtime issuesgovernance-validation for spec issuesnx-workspace for workspace issuesAfter debugging:
## Debug Analysis Complete
**Issue Category**: {category}
**Root Cause**: {cause}
**Severity**: {critical|high|medium|low}
### Findings
{detailed findings}
### Recommended Fixes
1. {fix 1}
2. {fix 2}
3. {fix 3}
### Commands to Run
\`\`\`bash
{commands}
\`\`\`
### Prevention
{how to prevent this issue}
### Debug Report
Full report: tmp/debug-report.md