data-wise/craft/guard-audit
Claude Code and agent skill by data-wise/craft
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
This skill should be used when the user asks to "audit guard", "guard friction", "tune guard", "guard false positives", "fix guard blocking", or mentions branch guard configuration issues. Analyzes branch-guard.sh rules; proposes JSON branch-policy config changes for policy-level false positives, and flags detection-logic bugs (which the flat config schema cannot fix) as needing a code PR instead.
Install
npx vskill@latest install data-wise/craft/guard-auditSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as data-wise/craft/guard-audit.
Guard Audit
Analyze branch guard configuration to find false positives and reduce friction. Proposes changes to .claude/branch-guard.json — never modifies the guard script itself.
When to Use
- User reports branch guard blocking legitimate operations
- User says "audit guard", "tune guard", "guard friction"
- After multiple guard false positives in a session
- User wants to understand guard behavior
Prerequisites
scripts/branch-guard.shmust exist (the guard script)- Git repository with branch protection enabled
Guard Audit Pipeline
Execute these steps in order.
Step 1: Discovery
Read the branch guard script and extract all protection rules:
Present a summary:
Step 1b: Matcher-Overlap Check
Check ~/.claude/settings.json for duplicate PreToolUse matcher strings:
If any duplicates appear, flag them — a guard registered twice fires twice for that tool, causing double prompts.
Progress indicator: [1b/5] Matcher-overlap .......... DONE (N duplicates found)
Step 1c: Duplicated Rule Coverage + Guard State
Rule coverage check: Scan both scripts/branch-guard.sh and scripts/no-switch-guard.sh for patterns that handle the same git operations. Common overlap site: git restore / git checkout -- <file> (data-loss detection).
Flag any operation handled by BOTH guards (double prompts; ownership should be assigned to one).
Guard state: Surface disabled or muted guards so audit context includes current guard state:
Progress indicator: [1c/5] Rule-coverage + state ...... DONE (N overlaps, M muted)
Step 2: Friction Analysis
For each rule, identify scenarios where it produces false positives:
| Rule | Intended Block | False Positive Scenario | |
|---|---|---|---|
| Force push detection | Force push to main/dev | Rebased feature branch push (already excluded — verify the branch was matched correctly) | |
| New code files on dev (shell redirection) | echo/cat/tee/cp/touch writing code to dev | A > character, or the keyword cp, tee, or touch followed by a space, appearing INSIDE a single- or double-quoted argument (an awk/grep/sed program, a search pattern) — text, not real shell syntax | |
| New code files on dev (path scoping) | Writes landing inside the repo tree | A target outside PROJECT_ROOT entirely (/tmp/..., $HOME/...) — poses no risk to this repo's branch | |
| File extension detection | Source code files | Generated/template files with a non-code extension already in NONCODE_EXTENSIONS |
Step 3: Test Harness
Generate test scenarios and report which ones trigger incorrectly:
Step 4: Report
First, classify each false positive by what can actually fix it — this determines whether Step 5 applies at all:
| Class | What it looks like | Fixable via config? | |
|---|---|---|---|
| Branch policy | The wrong protection level for a branch (e.g. a research repo's draft branch needs smart but has none) | Yes — Step 5's flat schema | |
| Detection logic | The guard misparses a specific command regardless of branch — e.g. a > inside a quoted awk/grep program read as a redirect, or an out-of-repo target (/tmp/...) flagged as an in-repo write | No — this is a bug in scripts/branch-guard.sh itself; only a code fix (PR) resolves it |
Output a friction report with specific recommendations:
Step 5: Apply (with user confirmation)
The real config schema is a flat branch-name → protection-level map — nothing else. scripts/branch-guard.sh reads it with a single lookup, _json_get ".\"${BRANCH}\"" — there is no nested "branches" object, no allowed_extensions, pr_body_scan, or force_push_allow key. Those do not exist in the script; proposing them would produce a config file the guard silently ignores.
Valid protection-level values (from the script's own comment): "block-all", "smart", "block-new-code" (alias for smart), "confirm" (alias for smart), or "" (no protection). A branch not listed in the config gets no protection — a custom config is explicit and authoritative; it does not merge with auto-detection.
Only propose branch-policy changes this way (see Step 4's classification). Ask the user to confirm before writing to .claude/branch-guard.json.
IMPORTANT: Never modify scripts/branch-guard.sh. If the false positive is a detection-logic bug (not fixable via this flat schema), say so plainly and recommend a code fix as its own PR — do not fabricate a config key to paper over it.
Output Format
Use craft box-drawing format throughout. Each step shows progress:
Error Recovery
| Error | Recovery | |
|---|---|---|
| No guard script found | Report error, suggest installing guard | |
| No false positives found | Report clean audit, no changes needed | |
| Config write fails | Show JSON for manual copy | |
| Tests inconclusive | Show raw test output for review |
See Also
scripts/branch-guard.sh— The guard script (read-only for this skill).claude/branch-guard.json— Per-project config (this skill's output)- `skills/dev/git/SKILL.md` — unprotect, protect, and guard management (ask naturally; folded from
/craft:git:unprotect/protect/guard, 2026-07 v4 consolidation) docs/guide/guard-suite.md— Guard suite concepts and usage guide
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/guard-audit/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/data-wise/craft/guard-audit)