Git Guardrails Claude Code
fossasia/eventyay-interpretation
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
Creates behavioral rules in markdown to block dangerous commands or restrict AI behavior.
$ npx skills add athola/claude-night-market --skill writing-rules -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install athola/claude-night-market writing-rules --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/athola/claude-night-market.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/hookify/skills/writing-rules .claude/skills/writing-rules && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "writing-rules" agent skill from https://github.com/athola/claude-night-market/tree/master/plugins/hookify/skills/writing-rules into .claude/skills/writing-rules/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "writing-rules", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/athola/claude-night-market/tree/master/plugins/hookify/skills/writing-rulesType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add athola/claude-night-market --skill writing-rules -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install athola/claude-night-market writing-rules --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/athola/claude-night-market.git skills-src && mkdir -p .agents/skills && cp -r skills-src/plugins/hookify/skills/writing-rules .agents/skills/writing-rules && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "writing-rules" agent skill from https://github.com/athola/claude-night-market/tree/master/plugins/hookify/skills/writing-rules into .agents/skills/writing-rules/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "writing-rules", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add athola/claude-night-market --skill writing-rules -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install athola/claude-night-market writing-rules --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/athola/claude-night-market.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/plugins/hookify/skills/writing-rules .cursor/skills/writing-rules && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "writing-rules" agent skill from https://github.com/athola/claude-night-market/tree/master/plugins/hookify/skills/writing-rules into .cursor/skills/writing-rules/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "writing-rules", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/athola/claude-night-market.git --path plugins/hookify/skills/writing-rules--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add athola/claude-night-market --skill writing-rules -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install athola/claude-night-market writing-rules --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/athola/claude-night-market.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/plugins/hookify/skills/writing-rules .gemini/skills/writing-rules && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "writing-rules" agent skill from https://github.com/athola/claude-night-market/tree/master/plugins/hookify/skills/writing-rules into .gemini/skills/writing-rules/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "writing-rules", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install athola/claude-night-market writing-rulesInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add athola/claude-night-market --skill writing-rules -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/athola/claude-night-market.git skills-src && mkdir -p .github/skills && cp -r skills-src/plugins/hookify/skills/writing-rules .github/skills/writing-rules && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "writing-rules" agent skill from https://github.com/athola/claude-night-market/tree/master/plugins/hookify/skills/writing-rules into .github/skills/writing-rules/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "writing-rules", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add athola/claude-night-market --skill writing-rules -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install athola/claude-night-market writing-rules --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/athola/claude-night-market.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/plugins/hookify/skills/writing-rules .opencode/skills/writing-rules && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "writing-rules" agent skill from https://github.com/athola/claude-night-market/tree/master/plugins/hookify/skills/writing-rules into .opencode/skills/writing-rules/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "writing-rules", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
writing-rulesCreates behavioral rules in markdown to block dangerous commands or restrict AI behavior.
Writing Rules is an agent skill from athola/claude-night-market. Creates behavioral rules in markdown to block dangerous commands or restrict AI behavior. Use when adding safety guardrails or preventing specific commands.
Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in AI & LLM Engineering, covering Brand voice and tone, Hooks and plugins and LLM guardrails. It works with Bash. The repository describes itself as: 23 Claude Code plugins: TDD enforcement hooks, git/PR workflows, spec-driven development, code review, project lifecycle, fix-from-error, maintenance automation, context… The licence is MIT.
6 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 9f3eb00. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
python3From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names these keys or tokens, usually read from environment variables:
API_KEYFrom names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Writing Rules loads about 1.4k tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 427 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
🔐 **API key in .env file!**Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from athola/claude-night-market at commit 9f3eb00, republished under its MIT licence (© athola). 427 words, ~1,387 tokens.
.claude/skills/writing-rules/SKILL.md (or your agent's skills folder).Hookify rules are markdown files with YAML frontmatter that define patterns to watch for and messages to show when those patterns match. Rules are stored in .claude/hookify.{rule-name}.local.md files.
Create .claude/hookify.dangerous-rm.local.md:
---
name: dangerous-rm
enabled: true
event: bash
pattern: rm\s+-rf
action: block
---
🛑 **Dangerous rm command detected!**
This command could delete important files.Verification: Run the command with --help flag to verify availability.
The rule activates immediately - no restart needed!
name (required): Unique identifier (kebab-case)
enabled (required): true or false
event (required): bash, file, stop, prompt, or all
action (optional): warn (default) or block
pattern (simple): Regex pattern to match
For multiple field checks:
---
name: warn-env-edits
enabled: true
event: file
action: warn
conditions:
- field: file_path
operator: regex_match
pattern: \.env$
- field: new_text
operator: contains
pattern: API_KEY
---
🔐 **API key in .env file!**
Ensure file is in .gitignore.regex_match: Pattern matchingcontains: Substring checkequals: Exact matchnot_contains: Must NOT containstarts_with: Prefix checkends_with: Suffix checkbash events: command
file events: file_path, new_text, old_text, content
prompt events: user_prompt
stop events: transcript
\s - whitespace\d - digit\w - word character. - any character (use \. for literal dot)+ - one or more* - zero or more| - ORrm\s+-rf → rm -rf
console\.log\( → console.log(
chmod\s+777 → chmod 777python3 -c "import re; print(re.search(r'pattern', 'text'))"---
name: block-destructive
enabled: true
event: bash
pattern: rm\s+-rf|dd\s+if=|mkfs
action: block
---
🛑 **Destructive operation blocked!**
Can cause data loss.---
name: warn-debug
enabled: true
event: file
pattern: console\.log\(|debugger;
action: warn
---
🐛 **Debug code detected!**
Remove before committing.---
name: require-tests
enabled: true
event: stop
action: warn
conditions:
- field: transcript
operator: not_contains
pattern: pytest|npm test
---
⚠️ **Tests not run!**
Please verify changes.---
name: protect-prod
enabled: true
event: file
action: block
conditions:
- field: file_path
operator: regex_match
pattern: /production/|\.prod\.
---
🚨 **Production file!**
Requires review.Enable/Disable:
Edit .local.md file: enabled: false
Delete:
rm .claude/hookify.my-rule.local.mdList:
/hookify:listIf a rule doesn't trigger, verify that the event type matches the tool being used (e.g., use bash for command line tools). Check that the regex pattern is valid and matches the target text by testing it with a short Python script. If you encounter permission errors when creating rule files in .claude/, ensure that the directory is writable by your user.
.claude/hookify.<rule-name>.local.md
with all required frontmatter fields present: name (kebab-case),
enabled, event, and either pattern or conditions<pattern>', '<test>'))"
before the rule is saved; no untested patterns shippedwarn action
shows the message body, block action prevents the operation© athola, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in plugins/hookify/skills/writing-rules of athola/claude-night-market.
Open the folder on GitHubat commit 9f3eb00
Writing Rules next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Writing Rules this skillathola/claude-night-market | 341 | — | ~1.4k | Automated safety check: Notes | MIT | |
| Git Guardrails Claude Codefossasia/eventyay-interpretation | 1.6k | 12 repos | ~578 | Automated safety check: Pass | Apache-2.0 | |
| Git Guardrails Claude Codevinvcn/mattpocock-skills-zh-CN | 4.7k | — | ~461 | Automated safety check: Pass | MIT | |
| GuardHouseofmvps/ultraship | 123 | — | ~790 | Automated safety check: Notes | MIT | |
| Guardrail PatternsZaxbyHub/opencode-swarm | 493 | — | ~3.5k | Automated safety check: Pass | MIT | |
| Hook Development for Claude Code Pluginsanthropics/claude-plugins-official | 38k | 10 repos | ~4.1k | Automated safety check: Notes | Apache-2.0 |
fossasia/eventyay-interpretation
Set up Claude Code hooks to block dangerous git commands (push, reset --hard, clean, branch -D, etc.) before they execute.
vinvcn/mattpocock-skills-zh-CN
设置 Claude Code hooks,在危险 git commands(push、reset --hard、clean、branch -D 等)执行前阻止它们。适用于用户想防止破坏性 git 操作、添加 git safety hooks,或在 Claude Code 中阻止 git push/reset 时。
Houseofmvps/ultraship
Safety guardrails — blocks destructive commands (rm -rf, DROP TABLE, force-push, git reset --hard) and optionally restricts file edits to a specific directory.
ZaxbyHub/opencode-swarm
Guardrail patterns for opencode-swarm — pattern structure, bypass surfaces, regex anti-patterns, and test conventions for checkDestructiveCommand()
anthropics/claude-plugins-official
Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.
anthropics/claude-plugins-official
Shows how Claude Code plugins keep per-project settings and state in .claude/plugin-name.local.md files with YAML frontmatter and a markdown body.
athola/claude-night-market
Run and interpret repo diagnostic scripts (ratchets, validators, token stats).
athola/claude-night-market
Evaluate Claude skill quality through auditing. An agent skill from athola/claude-night-market.
athola/claude-night-market
Coordinates Claude agent teams via filesystem protocol. An agent skill from athola/claude-night-market.
athola/claude-night-market
Delegates execution to eight CLIs (Gemini, Qwen, MiniMax, GLM, Muse, Codex, OpenCode, Glimmer).
athola/claude-night-market
Guide minimal code via a decision ladder with full safety, edge, and negative-case coverage.
athola/claude-night-market
Build a project skill library in .claude/skills/ via discovery, parallel authoring, and review.
Works with
Creates behavioral rules in markdown to block dangerous commands or restrict AI behavior. Writing Rules is an agent skill from athola/claude-night-market. Creates behavioral rules in markdown to block dangerous commands or restrict AI behavior.
Writing Rules fits situations like: adding safety guardrails; preventing specific commands.
Run `npx skills add athola/claude-night-market --skill writing-rules -a claude-code`. Or copy the skill folder (plugins/hookify/skills/writing-rules in athola/claude-night-market) into .claude/skills/writing-rules in your project. Claude Code loads it when a task matches its description.
Run `npx skills add athola/claude-night-market --skill writing-rules -a codex`. Or copy the skill folder (plugins/hookify/skills/writing-rules in athola/claude-night-market) into .agents/skills/writing-rules in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add athola/claude-night-market --skill writing-rules -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/writing-rules, .gemini/skills/writing-rules, .github/skills/writing-rules and .opencode/skills/writing-rules in your project.
Going by SKILL.md and its folder, Writing Rules needs the command-line tools its instructions call (python3) and credentials named API_KEY. Our summary lists: Python 3; A credential in API_KEY.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.
Writing Rules is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Writing Rules: Git Guardrails Claude Code (fossasia/eventyay-interpretation, 1.6k stars), Git Guardrails Claude Code (vinvcn/mattpocock-skills-zh-CN, 4.7k stars), Guard (Houseofmvps/ultraship, 123 stars) and Guardrail Patterns (ZaxbyHub/opencode-swarm, 493 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
athola (a GitHub user) maintains it in athola/claude-night-market, which has 341 GitHub stars. The repository holds 154 skills in this directory. The repository was last updated on October 6, 2026.
Source: athola/claude-night-market on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.