writing-rules

writing-rules is a skill for Claude Code from athola/claude-night-market. It costs 25 tokens per session (1,437 once invoked), scanned D, original, MIT.

A guide for writing Markdown rules that warn about or block commands and behaviors during coding-agent sessions.

In plain words
What is it for?
Use it to define rules for events such as shell commands, including blocks for destructive operations and checks that require tests.
Why use it?
It helps prevent dangerous commands, debug code, or changes to protected files by applying persistent guardrails.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions Claude Code.

Part of the hookify plugin — 2 skills, 6 commands shipped together

Good fit Use it to define rules for events such as shell commands, including blocks for destructive operations and checks that require tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/athola/claude-night-market/writing-rules
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.

Any agent
npx skills add athola/claude-night-market --skill writing-rules
Clone the repo
git clone --depth 1 https://github.com/athola/claude-night-market

Made for: Claude Code.

Or install hookify, the plugin that ships this one along with the rest of its 2 skills, 6 commands.

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 writing-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/athola/claude-night-market/writing-rules/github.svg)](https://agentmods.dev/skills/athola/claude-night-market/writing-rules)
Your own site
<a href="https://agentmods.dev/skills/athola/claude-night-market/writing-rules"><img src="https://agentmods.dev/badge/skills/athola/claude-night-market/writing-rules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for writing-rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/athola/claude-night-market/writing-rules"><img src="https://agentmods.dev/badge/skills/athola/claude-night-market/writing-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,437 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00025 $0.01437
Opus 5.5 $0.00010 $0.00575
Sonnet 5.5 $0.00005 $0.00287
Haiku 4.5 $0.00003 $0.00144

Measured 16d ago against content hash 317c4ff504a0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade D, and why

writing-rules scanned grade D with 2 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 16d 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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod\s+777 → chmod 777

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm\s+-rf → rm -rf
plugins/hookify/skills/writing-rules/SKILL.md · 264 lines

How it starts

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

Hookify Rule Writing Guide

When To Use

  • Creating behavioral rules to prevent unwanted actions
  • Defining persistent guardrails for Claude Code sessions

When NOT To Use

  • Complex multi-step workflows - use agents instead
  • One-time operations that do not need persistent behavioral rules

Overview

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.

Quick Start

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!

Rule File Format

Frontmatter Fields

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

Event Types

  • bash: Bash tool commands
  • file: Edit, Write, MultiEdit tools
  • stop: When agent wants to stop
  • prompt: User prompt submission
  • all: All events

Advanced Conditions

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.

Operators

  • regex_match: Pattern matching
  • contains: Substring check
  • equals: Exact match
  • not_contains: Must NOT contain
  • starts_with: Prefix check
  • ends_with: Suffix check

Field Reference

bash events: command file events: file_path, new_text, old_text, content prompt events: user_prompt stop events: transcript

Read the full file on GitHub · 264 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. 16d ago Changed · -4 tokens per session 317c4ff504a0
  2. 24d ago Changed · -1 lines 937f330005f4
  3. 2mo ago Changed · -23 lines a06167fbecc5
  4. 2mo ago First seen · 288 lines · 29 tokens per session scan D e48d6776b52f

Subscribe to this mod's changes

writing-rules is a skill published in the GitHub repository athola/claude-night-market (358 stars, last pushed yesterday), licensed MIT. It adds 25 tokens to every session and 1,437 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it D with 2 findings (asks for root, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

writing-rules compared with skills from other repositories

writing-rules next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
writing-rulesathola/claude-night-marketSkill358yesterdayMITD25Claude Code
regex-masteryalibaba/anolisaSkill6888d agoApache-2.0A60Claude Code, Codex
code-reviewer-rustbuiphucminhtam/forgewrightSkill492d agononeA23Claude Code
effect-rpc-clustermpsuesser/pi-effect-harnessSkill255mo agoMITA68Claude Code, Codex
effect-error-handlingmpsuesser/pi-effect-harnessSkill255mo agoMITA61Claude Code, Codex
effect-http-apimpsuesser/pi-effect-harnessSkill255mo agoMITA53Claude Code, Codex
effect-http-clientmpsuesser/pi-effect-harnessSkill255mo agoMITA92Claude Code, Codex