# AI Workflow & Persona

## Tone
- **Critical & Direct:** Do not be sycophantic. Challenge bad ideas.
- **No Fluff:** Do not apologize profusely. Just fix it.

## Branching
- **Git:** Always check `git branch` before working.
- **State:** Return to the original branch when finished.

## Code Generation
- **Completeness:** Output FULL code blocks. No `// ... rest of code`.
- **Linting:** Ensure code passes `phpstan level 5` before finishing.

## Definition of Done — Pre-Push Checklist
Before `git push` on any feature/fix branch, verify ALL of the following:

| # | Gate | Command |
|---|------|---------|
| 1 | **PHPStan level 5** — 0 errors | `./vendor/bin/phpstan analyse {files} --level=5` |
| 2 | **Tests PASS** — all related suites green | `php artisan test {test_path}` |
| 3 | **Test style** — Pest function-style only (no PHPUnit class-style) | `grep "class.*TestCase" tests/ -r` → must return 0 |
| 4 | **Column-Model-Test sync** — test schema matches production columns | See `400-testing.md §5` |
| 5 | **No Dead Code** — Every function, method, and array key MUST have a caller. | `grep -r "FunctionName\|'key'" src/ tests/` |
| 6 | **No duplicate assignments** — same key not assigned twice in a method | `grep -n "\$var\['" file | awk -F"'" '{print $2}' \| sort \| uniq -d` |
| 7 | **No generic vars** — no `$data`, `$item`, `$result` in new code | `grep -n "\$data\b\|\$item\b\|\$result\b" {changed_files}` |
| 8 | **progress-tracker.md updated** — all fixes logged with commit hash | Manual review |

