Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add stephansama/packages --skill ai-commit-msggit clone --depth 1 https://github.com/stephansama/packagesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/stephansama/packages/ai-commit-msg)<a href="https://agentmods.dev/skills/stephansama/packages/ai-commit-msg"><img src="https://agentmods.dev/badge/skills/stephansama/packages/ai-commit-msg/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/stephansama/packages/ai-commit-msg"><img src="https://agentmods.dev/badge/skills/stephansama/packages/ai-commit-msg.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00151 | $0.01725 |
| Opus 5.5 | $0.00060 | $0.00690 |
| Sonnet 5.5 | $0.00030 | $0.00345 |
| Haiku 4.5 | $0.00015 | $0.00172 |
Grade A, and why
ai-commit-msg scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 235 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ai-commit-msg
Writes an AI-generated conventional commit message to the COMMIT_EDITMSG file via the prepare-commit-msg Git hook. Reads the staged diff and passes it to your configured AI provider through TanStack AI adapters.
Setup
- Install and initialise husky:
npm install --save-dev husky && npx husky init
- Create
.husky/prepare-commit-msg:
#!/bin/sh
ai-commit-msg -o "$1"
- Create a config file at
ai-commit-msg.config.ts(orpackage.jsonkeyai-commit-msg):
// ai-commit-msg.config.ts
export default {
provider: "google",
model: "gemini-2.5-flash",
};
- Set the required environment variable:
export GOOGLE_GENERATIVE_AI_API_KEY=your-key
Core Patterns
Google provider
export default {
provider: "google",
model: "gemini-2.5-flash",
};
Requires GOOGLE_GENERATIVE_AI_API_KEY, GOOGLE_API_KEY, or GEMINI_API_KEY in the environment (checked in that order).
OpenAI provider
export default {
provider: "openai",
model: "gpt-4o-mini",
};
Requires OPENAI_API_KEY in the environment.
Ollama provider (local, no API key)
export default {
provider: "ollama",
model: "llama3.2",
};
Requires the Ollama server running locally (ollama serve). Set OLLAMA_HOST to use a server other than http://localhost:11434.
Custom prompt
export default {
provider: "google",
model: "gemini-2.5-flash",
prompt:
"Write a short conventional commit message in lowercase for this diff:\n\n{{diff}}",
};
The {{diff}} placeholder is replaced with the staged diff (truncated at 8000 characters). The prompt must include {{diff}} or the model receives no diff context.
Preserve an existing commit message
git commit -m "fix login redirect"
# -> fix(auth): fix login redirect after session refresh
When the output file already holds a message, it is passed to the model as the original intent and only reformatted to match the prompt and diff. Git comment lines and the verbose-diff scissors section are stripped first. Empty, punctuation-only, or n/a-style messages (N/A, na, n.a., none) are ignored and a fresh message is generated.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago Changed · +26 lines · +51 tokens per session ae4655bf367f
- 1mo ago First seen · 209 lines · 100 tokens per session scan A 5698e8132a75
ai-commit-msg is a skill published in the GitHub repository stephansama/packages (5 stars, last pushed 8d ago), licensed MIT. It adds 151 tokens to every session and 1,725 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
create-pr
Creates a GitHub PR with a Linear-ticket-prefixed title and a decision-led, narrative description for Prisma 8. Use when the user wants to create a pull request, open a PR, or submit changes for review.
review-implement-phase
Implements triaged review actions, commits focused fixes, and posts Done plus resolves threads. Use when the user wants only the implementation phase of the review-framework workflow.
review-triage-phase
Produces canonical review actions from fetched review state and renders action markdown. Use when the user wants only triage/action-planning for the review-framework workflow.
multiline-commit-messages
Use single-quoted strings for multiline git commit messages in the Shell tool. Prevents heredoc escaping failures that produce garbled commit messages.
hero-diff-highlight
A dark code editor reveals a red deletion then a green addition with a soft pulse. Function: PR / code-change explainer.
stacking-prs
Create and manage GitHub native Stacked PRs in this repo with the gh stack CLI. Use when asked to stack PRs, split a large change into a stack, add a layer to a stack, restack or rebase a stack, adopt existing branches or PRs into a stack, check out someone else's stack, or land a stack. Covers creating and submitting…