AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

PreCommitSanitize

skill-rohirik-claude-code-config-precommitsanitize · by RohiRIK

Scan staged files for hardcoded home paths, personal identifiers, symlinks, and runtime state before committing to the ~/.claude repo. USE WHEN staging or committing in ~/.claude, or before pushing a dotfiles/config repo to a public GitHub remote.

No reviews yet
0 installs
27 views
0.0% view→install

Install

$ agentstack add skill-rohirik-claude-code-config-precommitsanitize

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-rohirik-claude-code-config-precommitsanitize)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of PreCommitSanitize? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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// | /Users/jane/.claude/hooks/... | ~/.claude/hooks/... | | /home// | /home/deploy/.claude/... | ~/.claude/... | | C:\Users\\ | C:\Users\jane\... | ~\.claude\... |

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

Personal Identifiers

| Pattern | Example | Action | |---------|---------|--------| | Email addresses | jane@gmail.com | Remove or replace with user@example.com | | Social media handles | linkedin.com/in/ | Remove unless intentionally public (README author section) | | Machine hostnames | -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 | 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

Runtime State Files

Files that are managed by Claude Code at runtime and should not be version-controlled:

| File/Pattern | Why | |-------------|-----| | plugins/installed_plugins.json | Contains absolute install paths with username | | plugins/known_marketplaces.json | Contains absolute install paths with username | | plugins/install-counts-cache.json | Runtime cache | | security_warnings_state_*.json | Session-specific state | | stats-cache.json | Runtime cache | | settings.json.bak | Backup file | | *.db, *.db-shm, *.db-wal | Database files | | history.jsonl | Session history |

If any of these appear in git status as tracked, run git rm --cached and add to .gitignore.

How to Check

Before staging, run this scan on all files being committed:

# Check for hardcoded home paths in staged files
git diff --cached --name-only | xargs grep -n '/Users/\|/home/\|C:\\Users\\' 2>/dev/null

If matches are found:

  1. For settings.json hook commands — these require absolute paths (Claude Code limitation). Add settings.json to .gitignore if it contains paths, or accept this as a known trade-off and document it.
  2. For all other files — replace with ~/.claude/ or $HOME/.claude/.
  3. For comments/docs — use ~/.claude/ notation.

Automated Enforcement

The hooks/git/pre-commit hook runs bunx varlock scan --staged for secret detection. For path sanitization, manually verify before committing or add a grep check to the pre-commit hook:

# Add to hooks/git/pre-commit after varlock scan
if git diff --cached --name-only | xargs grep -l '/Users/' 2>/dev/null | grep -v 'settings.json' | grep -qv '.gitignore'; then
  echo "[pre-commit] WARNING: Hardcoded /Users/ paths found in staged files" >&2
  git diff --cached --name-only | xargs grep -n '/Users/' 2>/dev/null | grep -v 'settings.json' | grep -v '.gitignore' >&2
  echo "[pre-commit] Replace with ~/.claude/ before committing" >&2
  exit 1
fi

Known Trade-offs

settings.json hook commands require absolute paths — Claude Code does not expand ~ or $HOME in hook command strings. Options:

  1. Gitignore settings.json — loses version control on hook config
  2. Accept the path leak — username visible but not a security risk
  3. Use env var in a wrapper — hook commands call a shell script that resolves $HOME

Current decision: keep settings.json tracked, accept that the username is visible. The file contains no secrets — only hook wiring with absolute paths.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.