pre-commit-gate
Skill8 starsChanged 6 months agoMITView on GitHub
Pre-commit quality gate - run lint, typecheck, test LOCALLY before committing. Prevents wasted CI time and embarrassing build failures.
- Pipes a download into a shell
- Deletes or force-pushes
In this repository129 other files it gives its agents.
- AGENTS.mdAGENTS.md
- guidance/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- guidance/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- blast-radius-checkSkill
- brainstormingSkill
- branch-flow-gateSkill
- branch-sync-gateSkill
- codebase-reconSkill
- codeowners-drift-auditSkill
- code-review-batterySkill
- cognitive-complexity-refactoringSkill
- debateSkill
- debug-conductorSkill
- dispatching-parallel-agentsSkill
- domain-buildSkill
- evidence-adjudicatorSkill
- executing-plansSkill
- external-cli-auditSkill
- feature-developmentSkill
- field-rename-verificationSkill
- finishing-a-development-branchSkill
- git-branch-conventionsSkill
- gitlab-cliSkill
- hotfix-charterSkill
- implementation-trackerSkill
- incident-revert-reviewSkill
- infra-config-investigatorSkill
- investigation-stateSkill
- kernel-splitSkill
- llm-behavior-investigatorSkill
- llm-skill-reviewSkill
- merge-authorization-gateSkill
- micro-harsh-reviewSkill
- output-verificationSkill
- progressive-code-review-gateSkill
- progressive-harsh-reviewSkill
- providing-code-reviewSkill
- pr-triage-gateSkill
- push-authorization-gateSkill
- receiving-code-reviewSkill
- reproduction-experiment-investigatorSkill
- requesting-code-reviewSkill
- requirements-validation-pmSkill
- requirements-validationSkill
- scope-tripwireSkill
- session-handoffSkill
- skills-hierarchy-tuningSkill
- sp-bughuntSkill
- state-consistency-investigatorSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- timeline-trace-investigatorSkill
- token-estimationSkill
- unified-commit-gateSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 10 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Before every git commit — run local lint, typecheck, and tests first
- Distinctive: line 33
Before pushing to any remote branch (CI should confirm, not discover)
- Distinctive: line 34
After resolving merge conflicts to verify nothing broke
- Distinctive: line 35
When preparing a hotfix under time pressure (especially then)
- Distinctive: line 39
RUN THESE LOCALLY BEFORE EVERY
git commit: Not after CI fails — BEFORE you commit. - Distinctive: line 132
Check pipeline logs immediately
- Distinctive: line 135
Verify new build passes
- Distinctive: line 144
verification-before-completion: After commit gates, before "done"
- Distinctive: line 145
blast-radius-check: Before modifying existing code
- Distinctive: line 146
output-verification: Before claiming generated artifacts correct
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pre-Commit Quality Gate
Wrong skill? Reviewing a PR →
providing-code-review. Output verification →output-verification. Completion check →verification-before-completion.Source:
superpowers-plusPart of: Engineering Rigor skill family
When to Use
- Before every
git commit— run local lint, typecheck, and tests first - Before pushing to any remote branch (CI should confirm, not discover)
- After resolving merge conflicts to verify nothing broke
- When preparing a hotfix under time pressure (especially then)
The Rule
RUN THESE LOCALLY BEFORE EVERY git commit. Not after CI fails — BEFORE you commit.
This Gate's Checks: Safety Scan → Lint → Typecheck → Test
# 0. Dangerous pattern scan (MUST pass if .sh files are staged)
~/.codex/superpowers-plus/tools/dangerous-pattern-scan.sh
# 1. Lint (MUST pass with zero errors)
npm run lint # or: pnpm run lint, biome check .
# 2. Typecheck (MUST pass with zero errors)
npm run typecheck # or: tsc --noEmit
# 3. Test (MUST pass — excluding known infrastructure failures)
npm test # or: vitest --runAfter this gate passes, the remaining commit gates run in order: enforce-style-guide (2) → progressive-code-review-gate (3) → professional-language-audit (4) → public-repo-ip-audit (5) → commit → push.
Preferred:
use-skill unified-commit-gateloads all 5 gates in one load. Use individual skills for deep-dive when a specific gate fails.
Step 0 only runs when
.shfiles are staged. It detects unguardedrm -rf,chmod 777,curl | bash, and other destructive patterns. Hardcoded safe paths (e.g.,rm -rf ~/.codex/something) produce warnings, not blocks.<!-- doctor-ignore -->Use--allflag to scan the entire repo:dangerous-pattern-scan.sh --all
Why This Gate Exists
Common failure: Pushing code without running local checks, then debugging CI failures. Lint errors, type errors, and test failures are all detectable locally. Instead of running checks locally first, developers push, wait for CI, read logs, fix, push again — wasting multiple CI cycles that could have been zero.
Pre-Commit Checklist
dangerous-pattern-scan.sh— no blocked patterns (if .sh files staged)npm run lint— zero errors (warnings OK if project allows)npm run typecheck— zero errorsnpm test— all tests pass (or only pre-existing failures)- Reviewed staged changes (
git diff --staged)
Skip any step = wasted CI time + embarrassing build failures
Acceptable vs. Not Acceptable
| Acceptable | Not Acceptable |
| Pre-existing infrastructure test failures (e.g., lockfile conflict) | New failures you introduced |
| Lint warnings if project config allows them | Lint errors |
Skipped tests marked @skip | Tests you broke |
The Gate Function
BEFORE EVERY COMMIT:
0. Did I run `dangerous-pattern-scan.sh`? (if .sh files staged — zero blocked patterns)
1. Did I run the lint command AND show the output in my response? (zero errors)
2. Did I run the typecheck command AND show the output? (zero errors)
3. Did I run the test command AND show the output? (all pass or only pre-existing failures)
4. Did I review staged changes? (`git diff --staged`)
If NO to any → DO NOT COMMITChain to Next Gate
When this gate passes, IMMEDIATELY load the next gate in the chain:
use-skill enforce-style-guideThen continue: progressive-code-review-gate → professional-language-audit → public-repo-ip-audit (gates 4–5 when applicable). Do NOT commit between gates.
Post-Commit: Verify Build Status
DO NOT update ticket status or claim "done" until ALL builds pass.
# Check CI status for your PR
# Look for: all checks passing
# NOT just merge status (that only means merge is possible)| Check | Required Before "Done" |
| PR created/merged | ✅ Yes |
| Build triggered | ✅ Yes |
| Build result = succeeded | ✅ Yes |
| No lint/test failures in CI logs | ✅ Yes |
If build fails after push:
- Check pipeline logs immediately
- Fix the issue locally
- Push fix to branch
- Verify new build passes
- THEN update ticket status
Companion Skills
- enforce-style-guide: Style fixes (step 2 in commit chain)
- progressive-code-review-gate: Code review (step 3)
- professional-language-audit: Language check (step 4)
- public-repo-ip-audit: IP/license audit (step 5)
- verification-before-completion: After commit gates, before "done"
- blast-radius-check: Before modifying existing code
- output-verification: Before claiming generated artifacts correct
Failure Modes
| Failure | Recovery |
| Claiming 'lint passes' without showing output | VIOLATION: Every gate claim requires visible tool output in response |
| Running tests after push (CI-first anti-pattern) | Run ALL gates locally before git commit. CI confirms, not discovers. |
| Skipping dangerous-pattern-scan for .sh files | Step 0 is mandatory when .sh files are staged |
| Not re-running gates after fixing gate failures | Fixes are new code. They need their own gate pass. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

