---
description: Fix MEDIUM severity findings
argument-hint: "[project-path: defaults to .]"
allowed-tools: Read, Edit, Write, Bash, Grep, Glob
---

Remediate MEDIUM severity findings in a single pass.

## Steps

1. **Load audit findings**
   - Read latest from `.vaspera/audit/*.json`
   - Filter findings where `severity === "medium"`

2. **Categorize and fix**
   Medium categories:
   
   **Code Quality**
   - Missing test files → Add basic test coverage
   - Code duplication → Extract shared utilities
   - Components >300 lines → Split into smaller components
   - Hardcoded strings → Extract to constants/i18n
   
   **Type Safety**
   - Missing return types → Add explicit return types
   - Implicit any (not explicit) → Add proper typing
   
   **Error Handling**
   - No structured logging → Add logger calls
   - Inconsistent error responses → Standardize format
   - No error boundaries → Add React Error Boundaries
   
   **Architecture**
   - Manual schema management → Add migration files
   - Scattered Supabase clients → Centralize client creation

3. **For each finding**
   - Show context and proposed fix
   - Apply fix with user confirmation
   - Run `npm run build` to verify

4. **Verification**
   - After all fixes, re-run audit
   - Confirm medium count decreased
   - Flag any regressions

5. **Final report**
   - N medium findings fixed
   - Remaining medium findings
   - Suggest `/vaspera-add-tests` as next step

## Important

- Medium fixes are lower priority but improve maintainability
- Some fixes may require architectural decisions — ask if unclear
- Stage changes but do NOT commit unless user requests
