--- name: fix-compile description: Diagnose and fix compilation errors systematically. Use when `mvn compile` or `npm run build:dev` fails. --- Systematically diagnose and fix compilation errors following the 4-stage debugging process: ## Stage 1: Root cause investigation 1. Read the FULL error message (stack trace, line numbers, error codes) 2. Identify the error type: - Java: syntax, type mismatch, missing import, duplicate method, signature conflict - Vue/JS: syntax, import error, TypeScript type, SCSS bracket mismatch 3. Check recent changes: `git diff HEAD~5` to see what changed 4. For Java errors: check if the method/class already exists elsewhere (Iron Law 9) 5. For Vue errors: check SCSS bracket closure (Iron Law 30) ## Stage 2: Pattern analysis - Search for similar working code: `rg "similar_pattern" --type java --type vue` - Compare with working examples in the same codebase - Check if dependencies are correctly imported ## Stage 3: Hypothesis and test - Form ONE hypothesis: "I believe X is the root cause because Y" - Make the MINIMAL change to test it - If it works → Stage 4 - If not → new hypothesis (max 3 attempts before asking user) ## Stage 4: Implement fix - Apply the fix - Run the verification command again: - Backend: `mvn clean compile -DskipTests` - Frontend: `npm run build:dev` - Confirm zero errors before declaring success ## Common error patterns in this codebase: - **Duplicate method**: Check all Service implementations for the same method - **Missing import**: Verify package structure matches `com.healthlink.his.web.{module}` - **Type mismatch**: Check DTO field types (Iron Law: DTO field type defense) - **SCSS bracket**: Count `{` and `}` in `