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

Remediate HIGH severity findings systematically in 4 rounds.

## Steps

1. **Load audit findings**
   - Read latest from `.vaspera/audit/*.json`
   - Filter findings where `severity === "high"`
   - Group by category for round assignment

2. **Round A: Input Validation**
   Target findings related to:
   - Missing Zod schemas
   - Missing safeParse calls
   - Missing 400 responses for invalid input
   - Unvalidated user input
   
   For each:
   - Add Zod schema if missing
   - Replace direct access with safeParse
   - Add proper error responses
   - Run `npm run build` to verify

3. **Round B: TypeScript Strictness**
   Target findings related to:
   - `any` type annotations
   - Missing explicit return types
   - Unsafe type assertions (`as unknown as T`)
   
   For each:
   - Replace `any` with proper types or `unknown`
   - Add explicit return types to functions
   - Replace unsafe casts with type guards
   - Run `npm run build` to verify

4. **Round C: UI Resilience**
   Target findings related to:
   - Missing loading states
   - Missing error states
   - Missing empty states
   - Missing cleanup for subscriptions/listeners
   - Missing Error Boundaries
   
   For each:
   - Add loading/error/empty state handling
   - Add cleanup in useEffect return
   - Wrap risky components in Error Boundaries
   - Run `npm run build` to verify

5. **Round D: API Hardening**
   Target findings related to:
   - Error response leaking internal details
   - Missing revalidatePath calls
   - Inconsistent response shapes
   
   For each:
   - Sanitize error responses
   - Add cache invalidation
   - Standardize response format
   - Run `npm run build` to verify

6. **After each round**
   - Commit with: `fix: resolve high-severity issues (round X)`
   - Re-scan to verify finding count decreased
   - Report progress: N fixed in round X

7. **Final report**
   - Total high findings fixed across all rounds
   - Remaining high findings (if any)
   - Suggest `/vaspera-fix-medium` as next step

## Important

- Complete each round fully before moving to next
- Commit after each round for clean rollback if needed
- If a fix is unclear, ask for guidance rather than guessing
