PreCommitSanitize

PreCommitSanitize is a skill for Claude Code, Codex from RohiRIK/claude-code-config. It costs 58 tokens per session (1,240 once invoked), scanned A, original, MIT.

A pre-commit checker for a configuration repository that looks for personal paths, identifying details, symbolic links, and runtime files.

In plain words
What is it for?
Use it before staging or committing files in the .claude repository to find home-directory paths, email addresses, usernames, hostnames, and similar data.
Why use it?
It helps prevent private information and machine-specific state from being pushed to a public repository.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/rohirik/claude-code-config/precommitsanitize
Any agent
npx skills add RohiRIK/claude-code-config --skill precommitsanitize
Clone the repo
git clone --depth 1 https://github.com/RohiRIK/claude-code-config

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for PreCommitSanitize

README.md
[![agentmods](https://agentmods.dev/badge/skills/rohirik/claude-code-config/precommitsanitize.svg)](https://agentmods.dev/skills/rohirik/claude-code-config/precommitsanitize)
Your own site
<a href="https://agentmods.dev/skills/rohirik/claude-code-config/precommitsanitize"><img src="https://agentmods.dev/badge/skills/rohirik/claude-code-config/precommitsanitize.svg" alt="Measured on agentmods" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,240 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00058 $0.01240
Opus 5 $0.00029 $0.00620
Sonnet 5 $0.00012 $0.00248
Haiku 4.5 $0.00006 $0.00124

Measured 5d ago against content hash a542ce5b8a5a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

PreCommitSanitize 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 5d 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.

skills/PreCommitSanitize/SKILL.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pre-Commit Sanitization

When This Applies

Before every git add or git commit in ~/.claude, scan staged files for sensitive personal information that should not be pushed to a public GitHub repository.

What to Catch

Hardcoded Home Paths

Any absolute path containing a username or home directory:

Pattern Example Fix
/Users/<username>/ /Users/jane/.claude/hooks/... ~/.claude/hooks/...
/home/<username>/ /home/deploy/.claude/... ~/.claude/...
C:\Users\<username>\ C:\Users\jane\... ~\.claude\...

Exception: .gitignore rules may use relative paths that are fine.

Personal Identifiers

Pattern Example Action
Email addresses [email protected] Remove or replace with [email protected]
Social media handles linkedin.com/in/<handle> Remove unless intentionally public (README author section)
Machine hostnames <Name>-MacBook-Pro.local Remove
Usernames in paths username embedded in file content Replace with ~ or $HOME

Exception: README.md author/contact section may intentionally include social links — confirm before removing.

Symlinks

Rule: No symlink inside ~/.claude/ may be committed to git.

Symlinks are always machine-specific — they point to absolute paths on the local filesystem that don't exist on other machines. Committing them breaks clones and leaks personal paths.

Action When
Add to .gitignore under # Symlinks section When creating any new symlink inside ~/.claude/
Run git rm --cached <path> If a symlink was accidentally tracked

The hooks/git/pre-commit hook auto-detects and blocks staged symlinks (git mode 120000) and adds them to .gitignore automatically. This is a safety net — always add manually first.

Pattern for .gitignore:

# Symlinks (local-only, machine-specific — never commit symlinks to shared tools)
# Rule: ANY symlink inside ~/.claude/ must be listed here.
skills/MySkilLink

Read the full file on GitHub · 110 lines

Changes

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.

  1. 5d ago First seen · 110 lines · 58 tokens per session scan A a542ce5b8a5a

Subscribe to this mod's changes

PreCommitSanitize is a skill published in the GitHub repository RohiRIK/claude-code-config (10 stars, last pushed 1mo ago), licensed MIT. It adds 58 tokens to every session and 1,240 once invoked, about $0.0003 per session on Opus 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.