diff --git a/claude/commands/qa.md b/claude/commands/qa.md new file mode 100644 index 0000000..1c78a81 --- /dev/null +++ b/claude/commands/qa.md @@ -0,0 +1,155 @@ +--- +name: qa +description: Run QA checks and fix all issues iteratively +hooks: + PostToolUse: + - matcher: "Bash" + hooks: + - type: command + command: "core ai qa-filter" + Stop: + - hooks: + - type: command + command: "core ai qa-verify" + once: true +--- + +# QA Fix Loop + +Run the full QA pipeline and fix all issues. + +## Detection + +First, detect the project type: +- If `go.mod` exists → Go project → `core go qa` +- If `composer.json` exists → PHP project → `core php qa` +- If both exist → ask user or check current directory + +## Process + +1. **Run QA**: Execute `core go qa` or `core php qa` +2. **Parse issues**: Extract failures from output (see format below) +3. **Fix each issue**: Address one at a time, simplest first +4. **Re-verify**: After fixes, re-run QA +5. **Repeat**: Until all checks pass +6. **Report**: Summary of what was fixed + +## Issue Priority + +Fix in this order (fastest feedback first): +1. **fmt** - formatting issues (auto-fix with `core go fmt`) +2. **lint** - static analysis (usually quick fixes) +3. **test** - failing tests (may need more investigation) +4. **build** - compilation errors (fix before tests can run) + +## Output Parsing + +### Go QA Output +``` +=== FMT === +FAIL: pkg/api/handler.go needs formatting + +=== LINT === +pkg/api/handler.go:42:15: undefined: ErrNotFound (typecheck) +pkg/api/handler.go:87:2: ineffectual assignment to err (ineffassign) + +=== TEST === +--- FAIL: TestCreateUser (0.02s) + handler_test.go:45: expected 200, got 500 +FAIL + +=== RESULT === +fmt: FAIL +lint: FAIL (2 issues) +test: FAIL (1 failed) +``` + +### PHP QA Output +``` +=== PINT === +FAIL: 2 files need formatting + +=== STAN === +src/Http/Controller.php:42 - Undefined variable $user + +=== TEST === +✗ CreateUserTest::testSuccess + Expected status 200, got 500 + +=== RESULT === +pint: FAIL +stan: FAIL (1 error) +test: FAIL (1 failed) +``` + +## Fixing Strategy + +**Formatting (fmt/pint):** +- Just run `core go fmt` or `core php fmt` +- No code reading needed + +**Lint errors:** +- Read the specific file:line +- Understand the error type +- Make minimal fix + +**Test failures:** +- Read the test file to understand expectation +- Read the implementation +- Fix the root cause (not just the symptom) + +**Build errors:** +- Usually missing imports or typos +- Fix before attempting other checks + +## Stop Condition + +Only stop when: +- All QA checks pass, OR +- User explicitly cancels, OR +- Same error repeats 3 times (stuck - ask for help) + +## Example Session + +``` +Detecting project type... Found go.mod → Go project + +Running: core go qa + +## QA Issues + +pkg/api/handler.go:42:15: undefined: ErrNotFound +--- FAIL: TestCreateUser (0.02s) + +**Summary:** lint: FAIL (1) | test: FAIL (1) + +--- + +Fixing lint issue: undefined ErrNotFound +Reading pkg/api/handler.go... +Adding error variable definition. + +Running: core go qa + +## QA Issues + +--- FAIL: TestCreateUser (0.02s) + expected 200, got 404 + +**Summary:** lint: PASS | test: FAIL (1) + +--- + +Fixing test issue: expected 200, got 404 +Reading test setup... +Correcting test data. + +Running: core go qa + +✓ All checks passed! + +**Summary:** +- Fixed: undefined ErrNotFound (added error variable) +- Fixed: TestCreateUser (corrected test setup) +- 2 issues resolved, all checks passing +``` diff --git a/claude/commands/yes.md b/claude/commands/yes.md new file mode 100644 index 0000000..5f613ad --- /dev/null +++ b/claude/commands/yes.md @@ -0,0 +1,57 @@ +--- +name: yes +description: Auto-approve mode - trust Claude to complete task and commit +args: +hooks: + PermissionRequest: + - hooks: + - type: command + command: "core ai auto-approve" + Stop: + - hooks: + - type: command + command: "core ai ensure-commit" + once: true +--- + +# Yes Mode + +You are in **auto-approve mode**. The user trusts you to complete this task autonomously. + +## Task + +$ARGUMENTS + +## Rules + +1. **No confirmation needed** - all tool uses are pre-approved +2. **Complete the full workflow** - don't stop until done +3. **Commit when finished** - create a commit with the changes +4. **Use conventional commits** - type(scope): description + +## Workflow + +1. Understand the task +2. Make necessary changes (edits, writes) +3. Run tests to verify (`core go test` or `core php test`) +4. Format code (`core go fmt` or `core php fmt`) +5. Commit changes with descriptive message +6. Report completion + +Do NOT stop to ask for confirmation. Just do it. + +## Commit Format + +``` +type(scope): description + +Co-Authored-By: Claude Opus 4.5 +``` + +Types: feat, fix, refactor, docs, test, chore + +## Safety Notes + +- The Stop hook will block if you try to stop with uncommitted changes +- You still cannot bypass blocked commands (security remains enforced) +- If you get stuck in a loop, the user can interrupt with Ctrl+C