$npx -y skills add xwtro0tk1t-cloud/harness --skill harness-quality-gate--- description: Triggered when the user says "quality gate", "pre-commit check", "ready to commit", "check before commit", "run quality checks", or "done"/"complete" (Standard level auto-trigger). Executes quality checks before code commits at three levels — Lite (doc sync remin
| 1 | # Harness Quality Gate — Pre-Commit Quality Check |
| 2 | |
| 3 | --- |
| 4 | description: Triggered when the user says "quality gate", "pre-commit check", "ready to commit", "check before commit", "run quality checks", or "done"/"complete" (Standard level auto-trigger). Executes quality checks before code commits at three levels — Lite (doc sync reminder), Standard (hygiene + docs + progress), Full (all 7 checks). |
| 5 | --- |
| 6 | |
| 7 | ## Check Levels |
| 8 | |
| 9 | | Level | Trigger | Checks | |
| 10 | |-------|---------|--------| |
| 11 | | **Lite** | After editing source code (CLAUDE.md behavior rule) | Doc sync self-check only (zero cost) | |
| 12 | | **Standard** | Claiming "done" / "complete" | #4 Documentation Sync + #5 Code Hygiene + #6 Progress Update | |
| 13 | | **Full** | "quality gate" / "ready to commit" / "pre-commit check" | All 7 checks below | |
| 14 | |
| 15 | When triggered at Standard level, run only checks #4, #5, #6 and output the report. |
| 16 | When triggered at Full level, run all checks in order. All must pass before recommending commit. |
| 17 | |
| 18 | --- |
| 19 | |
| 20 | ## Check Items |
| 21 | |
| 22 | ### 1. Tests Pass |
| 23 | |
| 24 | ``` |
| 25 | Evidence-first check — avoid re-running if recently verified: |
| 26 | |
| 27 | 1. Check progress.md for "tests passed" / "all tests pass" within current task |
| 28 | 2. Check git log --oneline -5 for test-related commits by Tester agent |
| 29 | 3. If evidence found AND no source code changed since then: |
| 30 | → ✅ Tests passed (verified by Tester agent, no code changes since) |
| 31 | → Skip re-run |
| 32 | 4. If no evidence or code changed since last test: |
| 33 | → Detect project test framework and run tests: |
| 34 | Python → pytest -v (or project-configured test command) |
| 35 | Node.js → npm test / yarn test |
| 36 | Go → go test ./... |
| 37 | Rust → cargo test |
| 38 | Java → mvn test / gradle test |
| 39 | |
| 40 | Verdict: |
| 41 | ✅ All passed (or recently verified — skip re-run) |
| 42 | ❌ Failing tests → list failed cases, BLOCK commit |
| 43 | ⚠️ No tests → remind "consider writing tests first" |
| 44 | ``` |
| 45 | |
| 46 | ### 2. Lint Passes |
| 47 | |
| 48 | ``` |
| 49 | Evidence-first check — same as Tests: |
| 50 | |
| 51 | 1. Check progress.md / recent output for "lint passed" / "no lint errors" |
| 52 | 2. If verified recently AND no code changed since → skip re-run |
| 53 | 3. Otherwise detect project linter config and run lint: |
| 54 | Python → flake8 / ruff / pylint (per project config) |
| 55 | Node.js → eslint / prettier |
| 56 | Go → golangci-lint run |
| 57 | Rust → cargo clippy |
| 58 | Java → checkstyle / spotbugs |
| 59 | |
| 60 | Verdict: |
| 61 | ✅ No errors (or recently verified — skip re-run) |
| 62 | ⚠️ Warnings only → list but don't block |
| 63 | ❌ Errors found → BLOCK commit |
| 64 | ``` |
| 65 | |
| 66 | ### 3. Security Review |
| 67 | |
| 68 | ``` |
| 69 | Check if changes touch security-sensitive areas: |
| 70 | - Auth/authorization code changes → suggest using security-review skill |
| 71 | - New database queries → check for SQL concatenation (CWE-89) |
| 72 | - New shell calls → check for command injection (CWE-78) |
| 73 | - New user input handling → check for XSS/SSRF |
| 74 | - New dependencies → suggest running supply-chain-audit |
| 75 | |
| 76 | Verdict: |
| 77 | ✅ No security-sensitive changes, or review passed |
| 78 | ⚠️ Security-sensitive changes → recommend review before commit |
| 79 | ❌ Clear security issue found → BLOCK commit |
| 80 | ``` |
| 81 | |
| 82 | ### 4. Documentation Sync |
| 83 | |
| 84 | ``` |
| 85 | Dynamically detect which docs need updating (do NOT hardcode file mappings): |
| 86 | |
| 87 | 1. Run: git diff --name-only HEAD → list changed source files |
| 88 | 2. Scan docs/ directory structure to understand existing doc organization |
| 89 | 3. For each changed source file: |
| 90 | - Search docs/ for references to the changed module/file name |
| 91 | (grep the filename, class names, or function names in docs/) |
| 92 | - If a matching doc exists AND was NOT also modified → flag ⚠️ |
| 93 | 4. Special case detection (infer from project, not hardcode): |
| 94 | - Changed files contain DB migration/schema patterns |
| 95 | AND a db-schema doc exists → check if updated |
| 96 | - Changed files contain API route/endpoint definitions |
| 97 | AND an api-reference doc exists → check if updated |
| 98 | - Changed files are build config (pyproject.toml/package.json/Cargo.toml/go.mod/Makefile) |
| 99 | AND CLAUDE.md has a command section → check if commands changed |
| 100 | |
| 101 | Verdict: |
| 102 | ✅ Docs in sync, or no matching docs found |
| 103 | ⚠️ May need updates → list the doc file + the source change that triggered it |
| 104 | ``` |
| 105 | |
| 106 | ### 5. Code Hygiene |
| 107 | |
| 108 | ``` |
| 109 | Scan changed files: |
| 110 | - No commented-out code blocks |
| 111 | - No debug print / console.log |
| 112 | - No unused imports |
| 113 | - No temp test scripts in root directory |
| 114 | - No hardcoded secrets/tokens |
| 115 | |
| 116 | Verdict: |
| 117 | ✅ Code is clean |
| 118 | ⚠️ Hygiene issues found → list files and line numbers |
| 119 | ``` |
| 120 | |
| 121 | ### 6. Progress Update |
| 122 | |
| 123 | ``` |
| 124 | If using planning-with-files: |
| 125 | - Check if progress.md reflects current changes |
| 126 | - Check task_plan.md Phase status |
| 127 | |
| 128 | Verdict: |
| 129 | ✅ Progress updated |
| 130 | ⚠️ Progress files not updated → remind to update |
| 131 | — Not using planning-with-files → skip |
| 132 | ``` |
| 133 | |
| 134 | ### 7. Commit Format |
| 135 | |
| 136 | ``` |
| 137 | Recommend Conventional Commit format: |
| 138 | feat: / fix: / refactor: / docs: / test: / chore: |
| 139 | |
| 140 | If commit-msg-check hook is configured, this is handled automatically. |
| 141 | ``` |
| 142 | |
| 143 | --- |
| 144 | |
| 145 | ## Output Format |
| 146 | |
| 147 | ``` |
| 148 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 149 | 🚦 Quality Gate Check Report |
| 150 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 151 | |
| 152 | ✅ Tests pas |