speckit-workflow-pre-commit
Skill4 starsChanged 4 months agoApache-2.0View on GitHub
Run closure-auditor at the pre-commit checkpoint for final audit-trail verification before git commit
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- commit-messagesSkill
- securitySkill
- speckit-analyzeSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-git-commitSkill
- speckit-git-featureSkill
- speckit-git-initializeSkill
- speckit-git-remoteSkill
- speckit-git-validateSkill
- speckit-implementSkill
- speckit-planSkill
- speckit-specifySkill
- speckit-tasksSkill
- speckit-taskstoissuesSkill
- speckit-workflow-post-implSkill
- speckit-workflow-post-planSkill
- speckit-workflow-post-specSkill
- terraformSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
If $ARGUMENTS contains a feature directory path (e.g., specs/001-feature-name), use it.
- Distinctive: line 66
Commit-ready: - all P1/P2 items have valid closure evidence
- Distinctive: line 77
Read it there rather than from a list restated here, which would drift.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
User Input
$ARGUMENTSIf $ARGUMENTS contains a feature directory path (e.g., specs/001-feature-name),
use it. Otherwise, determine the active feature directory from the current
git branch or by listing specs/ and asking the user to confirm if ambiguous.
Pre-Commit Checkpoint
You are at the pre-commit checkpoint - the final proactive gate before code reaches the repository. The closure-auditor sub-agent performs one final closure verification sweep to catch any gaps that emerged after the post-implementation (C3) checkpoint (e.g., from manual code edits, hotfixes, or late-stage refactors).
This checkpoint is a single-agent invocation, not a multi-wave dispatch. There is no routing plan here; closure-auditor is invoked directly.
What this checkpoint does
The closure-auditor sub-agent (defined in .claude/agents/closure-auditor.md) performs a focused closure verification:
- Reads
specs/NNN-feature/events.jsonlfor the current feature - For each pending-resolution item, locates closure activity (
closure-claimed,closure-verified,closure-rejected,overridden,deferred) - Reads the cited evidence (code locations, ADRs,
deferrals.mdentries) to verify the closure actually addresses the original concern - Independently sweeps for closures the user may have forgotten to signal (grep on item IDs in code and ADRs)
- Emits
closure-verifiedorclosure-rejectedevents as ready-to-append JSON lines - Reports commit readiness:
ready-to-commitorblocked-with-N-issues
This is lighter than C3 - it does NOT re-invoke staff-engineer, code-reviewer, or security-reviewer (they ran at C3 Wave 1). It verifies the audit trail remains consistent after any late-stage changes.
Recommended invocation
@closure-auditor I'm at the pre-commit checkpoint for the current feature. Please verify all closure evidence is valid and the commit is safe to proceed.The auditor returns its report; you execute persistence:
- Save closure-auditor's report to
specs/NNN-feature/reviews/closure-audit-report-checkpoint-pre-commit.md - Append closure-auditor's
completedevent toevents.jsonl - Parse the "Recommended events" section and append each JSON line verbatim to
events.jsonl - Parse the "Ready-to-append PROJECT-LOG entries" section; for each block (skip if it reads "(none)"), append the block verbatim to
PROJECT-LOG.mdunder the "## Cross-cutting observations" heading, after any existing entries. closure-auditor is read-only and cannot write either file; persisting both is your job.
Output size handling
closure-auditor's report carries the 30KB output constraint. If the audit produces too many rejected closures to fit, the agent will summarize by item_id and reference deeper detail files. Re-invoke for specific item details if needed. Never reach into ~/.claude/projects/. See .claude/docs/agent-coordination.md.
Output
closure-auditor's report will fall into one of these categories:
- Commit-ready - all P1/P2 items have valid closure evidence
- Blocked with N issues - list of items requiring action:
- Rejections: closure was claimed but the cited evidence doesn't address the concern; either fix the gap or override via ADR
- Unaddressed: no closure activity at all; close in code, override via ADR, or (P2 only) defer
- Incomplete deferrals:
deferredevent present butdeferrals.mdrationale entry missing
Relationship to the git pre-commit hook
The full commit-time gate chain (every gate, its posture, and its skip/strict
env vars) is enumerated in docs/GATES.md, generated from the gate-meta headers
in .githooks/pre-commit.d/ and kept current by the gate-inventory meta-gate.
Read it there rather than from a list restated here, which would drift.
The git pre-commit hook at .githooks/pre-commit (which calls .claude/hooks/verify-loop-closure.sh which delegates to .claude/hooks/verify_loop_closure.py) is the mechanical enforcement: it blocks the commit at commit time if required closures are missing or rejected.
This checkpoint is the proactive equivalent - surface issues before attempting commit, so you don't get blocked at the git layer.
If you're confident the C3 checkpoint handled everything and you've made no late-stage changes, you can skip this checkpoint and let the git hook be the final gate. The pre-commit checkpoint exists for cases where late-stage changes (hotfix patches, manual edits) might have introduced gaps the C3 checkpoint didn't see.
Emergency override
The git pre-commit hook honors the emergency bypass only when the reason variable accompanies it:
SKIP_LOOP_VERIFY=1 SKIP_LOOP_VERIFY_REASON="<why>" git commit -m "hotfix: <description>
Bypassing loop closure check because <reason>. Will address
<unresolved items> in follow-up commit <ref or feature>."This bypass should be rare and documented in the commit message. It logs loudly to stderr so it's auditable in CI logs and terminal scrollback.
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.

