pre-commit

Verifies test coverage, test results, and documentation currency before generating a commit message.

Updated Jun 4, 2026
One-click install
npx skills add https://github.com/PeteRichardson/skills --skill pre-commit-peterichardson
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pre-commit
Source: https://github.com/PeteRichardson/skills/tree/main/pre-commit
Command: npx skills add https://github.com/PeteRichardson/skills --skill pre-commit-peterichardson

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Before committing code, developers often forget to confirm that tests exist, tests pass, and documentation is current. This Skill runs a final verification gate across all three areas so incomplete or broken work never slips into a commit. ## Core Features & Use Cases - Staged-change isolation: Stashes unstaged changes with git stash push --keep-index so verification runs against exactly what will be committed, then always pops the stash afterward. - Three-part verification gate: Checks test coverage for changed files, runs the test suite, and assesses design doc currency against the diff. - Routing, not fixing: When a check fails, it names the responsible skill (/add-tests, /run-tests, /update-docs) instead of fixing issues inline. - Use Case: You finish a feature, stage your files, and type /pre-commit. The skill stashes unrelated unstaged edits, confirms all changed files have tests, runs the suite (42 passed), verifies the design doc is current, and gives the green light to run /commit-message. ## Quick Start Type /pre-commit or say "ready to commit" after staging your changes to run the full verification gate.

Frequently Asked Questions about pre-commit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify tests pass before committing in git?

Stage your changes, then run a pre-commit verification that detects your project's test framework and executes the suite once. It reports pass/fail counts and flags failing tests so you can diagnose them before committing.

How to check test coverage for changed files before a commit?

The verification compares your staged diff against existing test files and flags any source file with no apparent test coverage. Missing coverage is routed to a test-writing step rather than being fixed inline.

What happens to unstaged changes during pre-commit verification?

Unstaged changes are stashed with `git stash push --keep-index` so checks run against exactly what will be committed. The stash is always popped afterward, even if checks fail, restoring your working tree.

Does pre-commit verification fix failing tests or stale docs?

No. It is a verification pass only. When a check fails, it names the appropriate follow-up skill for fixing tests or updating documentation, and you re-run verification after resolving the issue.

When should I not run a pre-commit verification gate?

Avoid it when nothing is staged and you have not decided what to commit, since checking unstaged files can produce a false green. Stage the intended files first so results reflect the actual commit.