From aida
AIDA Fix - Fix existing project to meet all quality gates. Takes a partially-built project and iterates until all 19 gates pass. Useful for completing interrupted implementations or improving test coverage.
npx claudepluginhub clearclown/claude-code-aida-red --plugin aidaThis skill uses the workspace's default tool permissions.
Fix an existing project to meet all 19 quality gates.
Applies Acme Corporation brand guidelines including colors, fonts, layouts, and messaging to generated PowerPoint, Excel, and PDF documents.
Builds DCF models with sensitivity analysis, Monte Carlo simulations, and scenario planning for investment valuation and risk assessment.
Calculates profitability (ROE, margins), liquidity (current ratio), leverage, efficiency, and valuation (P/E, EV/EBITDA) ratios from financial statements in CSV, JSON, text, or Excel for investment analysis.
Fix an existing project to meet all 19 quality gates.
/aida:fix <project-name>
Example:
/aida:fix twitter-clone
You MUST follow this protocol exactly. Do NOT deviate.
This command takes an existing (possibly incomplete) project and fixes it to pass all quality gates.
Check project directory:
ls -la ./
ls -la ./backend/
ls -la ./frontend/
If project doesn't exist:
Project {{PROJECT}} not found.
Available projects:
$(ls ./)
To create a new project:
/aida "Your project description"
Run quality gates to identify failures:
./scripts/quality-gates.sh {{PROJECT}} 2>&1 | tee /tmp/gate-diagnostic.log
Parse the output to identify:
Based on gate failures, create a prioritized fix plan:
var slice []T with make([]T, 0)[] not nullFor each failure category, either:
Backend Player for test additions:
Task tool:
description: "Backend Player: Add Tests for Coverage"
subagent_type: "general-purpose"
model: "sonnet"
prompt: |
You are AIDA Backend Player in FIX mode.
## Current State
Project: {{PROJECT}}
Location: ./backend/
## Problem
{{SPECIFIC_GATE_FAILURE}}
## Your Task
{{SPECIFIC_FIX_INSTRUCTIONS}}
## Requirements
- Follow TDD (write test first, then implementation)
- Run `go test ./...` after each change
- Achieve minimum 80 tests, 75% coverage
## Completion
Write results to .aida/results/fix-backend-{{PROJECT}}.json
Frontend Player for test additions:
Task tool:
description: "Frontend Player: Add Tests for Coverage"
subagent_type: "general-purpose"
model: "sonnet"
prompt: |
You are AIDA Frontend Player in FIX mode.
## Current State
Project: {{PROJECT}}
Location: ./frontend/
## Problem
{{SPECIFIC_GATE_FAILURE}}
## Your Task
{{SPECIFIC_FIX_INSTRUCTIONS}}
## Requirements
- Follow TDD
- Run `pnpm test -- --run` after each change
- Achieve minimum 100 tests, 70% coverage
- Ensure E2E tests pass
## Completion
Write results to .aida/results/fix-frontend-{{PROJECT}}.json
┌─────────────────────────────────────────────────────────────────┐
│ FIX LOOP (ralph-loop style) │
│ │
│ 1. RUN GATES → ./scripts/quality-gates.sh {{PROJECT}} │
│ │
│ 2. PARSE OUTPUT → Which gates failed? │
│ │
│ 3. FOR EACH FAILURE: │
│ → Determine fix strategy │
│ → Apply fix (direct or via Player) │
│ → Verify fix worked │
│ │
│ 4. RE-RUN GATES │
│ │
│ 5. IF ALL 19 PASS → DONE │
│ ELSE → GOTO step 3 │
└─────────────────────────────────────────────────────────────────┘
After basic gates pass, verify Docker and E2E:
# Start Docker environment
podman-compose up -d --build # or docker compose
# Wait for services
sleep 30
# Health checks
curl -sf http://localhost:8080/health
curl -sf http://localhost:5173/
# Run E2E tests
cd frontend
E2E_BASE_URL=http://localhost:5173 pnpm test:e2e
# Cleanup
cd ..
podman-compose down
After all gates pass:
Update session.json:
{
"current_phase": "COMPLETED",
"quality_gates_passed": true,
"fixed_at": "<ISO8601>",
"fix_summary": {
"gates_fixed": ["Gate 11", "Gate 12", "Gate 19"],
"tests_added": 45,
"coverage_improvement": "68% → 83%"
}
}
Update kanban.md:
## Status: COMPLETED ✅ (Fixed)
## Quality Gates - ALL 19 PASSED ✅
- [x] Gate 1-18: (existing gates)
- [x] Gate 19: E2E Test Execution (Playwright)
## Fix Summary
- Fixed at: {{TIMESTAMP}}
- Gates fixed: {{LIST}}
- Tests added: {{COUNT}}
AIDA Fix Complete
Project: {{PROJECT}}
Duration: {{DURATION}}
Gates Fixed:
- Gate 11: Backend Test Count (50 → 85)
- Gate 12: Frontend Test Count (80 → 110)
- Gate 14: Backend Coverage (65% → 78%)
- Gate 19: E2E Test Execution (PASS)
Quality Gates: 19/19 PASSED
To run the project:
docker compose up -d
open http://localhost:5173
Focus on table-driven tests for high coverage:
func TestHandler_AllCases(t *testing.T) {
tests := []struct {
name string
input string
expectedStatus int
}{
{"valid", `{"field":"value"}`, 200},
{"empty", ``, 400},
{"invalid json", `{bad}`, 400},
// Add 10+ cases for quick coverage boost
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// test implementation
})
}
}
Focus on render and interaction tests:
describe('Component', () => {
it('renders correctly', () => { ... });
it('handles click', () => { ... });
it('shows loading state', () => { ... });
it('shows error state', () => { ... });
it('handles empty data', () => { ... });
// 5 tests per component = quick coverage
});
Common issues:
getByRole or getByText| Command | Description |
|---|---|
/aida | Start new project from scratch |
/aida:resume | Continue from last session state |
/aida:status | Check current state |