CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

git-guardrails-claude-code

设置 Claude Code hooks,在危险 git commands(push、reset --hard、clean、branch -D 等)执行前阻止它们。适用于用户想防止破坏性 git 操作、添加 git safety hooks,或在 Claude Code 中阻止 git push/reset 时。

Quality

92%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

Quality

Content

93%Weight 40%Scale 1-5

Reviews the quality of instructions and guidance provided to agents. Good implementation is clear, handles edge cases, and produces reliable results.

A tight, fully actionable setup guide: concrete paths, ready-to-paste settings JSON for both scopes, and an end-to-end verification step with expected behavior. The only gap is the absence of troubleshooting/error-recovery guidance if the step-5 verification fails, which keeps workflow clarity at 4 rather than 5.

Suggestions

Add a short fallback to step 5 for the failure case, e.g., '若未阻止:检查 script 是否可执行、settings JSON 中 command 路径是否正确,修正后重新测试', to close the feedback-loop gap.

Note that jq is required by the bundled script so users on minimal environments can install it before verification fails mysteriously.

DimensionReasoningScore

Conciseness

The body is lean and imperative throughout ("用 chmod +x 让它可执行", "添加到对应 settings file") with no explanation of concepts Claude already knows. The single behavioral note ("被阻止时,Claude 会看到一条 message...") conveys functional information, so it does not fit the 'some unnecessary explanation' anchor 3.

5 / 5

Actionability

Fully executable guidance: exact copy destinations per scope, chmod command, copy-paste-ready JSON hook configs for both project and global settings, a merge instruction, and a concrete verification command with the expected exit code ("应以 code 2 退出,并向 stderr 打印 BLOCKED message"). This matches the copy-paste-ready anchor 5 and exceeds anchor 4's 'minor gaps'.

5 / 5

Workflow Clarity

A clear five-step sequence with an explicit verification checkpoint (step 5: pipe a test command into the script and check for exit code 2 plus a stderr BLOCKED message). It is not 5 because there is no error-recovery guidance if verification fails (no fix-and-retry loop); it is above anchor 3 because validation is present and explicit, and the destructive-operation cap does not apply since this workflow installs (not performs) destructive operations.

4 / 5

Progressive Disclosure

The body is a well-sectioned overview that keeps the blocking logic in the bundled script, referenced by a clear one-level-deep relative link ([scripts/block-dangerous-git.sh](scripts/block-dangerous-git.sh)) that resolves to a real file. Nothing that belongs in a separate file is inlined, fitting the simple-skill exception for a well-organized single-purpose skill.

5 / 5

Total

19

/

20

Passed

Description

87%Weight 40%Scale 1-5

Based on the skill's description, can an agent find and select it at the right time? Clear, specific descriptions lead to better discovery.

A strong description that pairs an explicit 'what' (hook-based blocking of named dangerous git commands) with an explicit 'Use when...' clause containing natural trigger phrases. Trigger coverage is good but misses a few synonymous phrasings, and the single-action scope keeps specificity just short of comprehensive.

Suggestions

Add one or two natural trigger synonyms (e.g., '防止误删/误推', 'git 保护', 'guard against accidental git pushes') to broaden keyword coverage.

Mention the remaining blocked patterns explicitly (e.g., 'git checkout .' / 'git restore .') instead of '等' to close the minor specificity gap.

DimensionReasoningScore

Specificity

Names the concrete capability ("设置 Claude Code hooks...阻止它们") and enumerates specific blocked commands ("push、reset --hard、clean、branch -D 等"). It stays at 4 rather than 5 because the skill performs essentially one action, so it lacks the breadth of the multi-action anchor-5 example; it is well above the 1-2-actions level of anchor 3.

4 / 5

Completeness

Explicitly answers 'what' ("设置 Claude Code hooks,在危险 git commands...执行前阻止它们") and 'when' ("适用于用户想...时") with concrete trigger phrases, matching the anchor-5 good-example structure. It is not 4 because the 'when' clause is fully explicit rather than only adequate.

5 / 5

Trigger Term Quality

Includes natural user phrases like "防止破坏性 git 操作", "git safety hooks", and "阻止 git push/reset", which users would plausibly say. A few natural variants (e.g., 'guard', 'protect') are missing, keeping it just below comprehensive coverage at 5 and clearly above the sparse keyword levels of 2-3.

4 / 5

Distinctiveness Conflict Risk

Occupies a clear niche (Claude Code PreToolUse hooks for dangerous git commands) with distinct, unlikely-to-collide triggers. It does not fit anchor 4's 'minor overlap risk with closely related skills' because the scope is narrowly and uniquely defined.

5 / 5

Total

18

/

20

Passed

Validation

100%

Checks the skill against the spec for correct structure and formatting. All validation checks must pass before discovery and implementation can be scored.

Validation — 16 / 16 Passed

Validation for skill structure

No warnings or errors.

Repository

vinvcn/mattpocock-skills-zh-CN

Path

skills/misc/git-guardrails-claude-code/SKILL.md

Reviewed

Table of Contents

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.