harn-rules

harn-rules is a skill for Claude Code from burin-labs/harn. It costs 26 tokens per session (1,663 once invoked), scanned A, original, Apache-2.0.

A skill for creating and running structural code rules with Harn, including searches, lint checks, and automated code rewrites called codemods.

In plain words
What is it for?
Use it to author TOML-based rules, scan code for patterns, report diagnostics, or apply safe structural rewrites.
Why use it?
It lets you match code by its structure instead of relying on fragile text patterns or file globs.

Skill for Claude Code

Written for Claude Code: when-to-use in frontmatter.

Good fit Use it to author TOML-based rules, scan code for patterns, report diagnostics, or apply safe structural rewrites.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/burin-labs/harn/harn-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 burin-labs/harn --skill harn-rules
Clone the repo
git clone --depth 1 https://github.com/burin-labs/harn

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/burin-labs/harn/harn-rules/github.svg)](https://agentmods.dev/skills/burin-labs/harn/harn-rules)
Your own site
<a href="https://agentmods.dev/skills/burin-labs/harn/harn-rules"><img src="https://agentmods.dev/badge/skills/burin-labs/harn/harn-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 harn-rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/burin-labs/harn/harn-rules"><img src="https://agentmods.dev/badge/skills/burin-labs/harn/harn-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,663 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Tool Misuse · line 76
    Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
    Fix: Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
How audits are shown
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.00026 $0.01663
Opus 5.5 $0.00010 $0.00665
Sonnet 5.5 $0.00005 $0.00333
Haiku 4.5 $0.00003 $0.00166

Measured 1mo ago against content hash 388d33c22c9e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

harn-rules scanned grade A with 0 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 1mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

crates/harn-skills/src/corpus/harn-rules/SKILL.md · 111 lines

How it starts

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

Harn rule engine

Use this skill when matching or rewriting code structurally — a search pattern, a lint rule, or a codemod — instead of with regex/glob. The engine is the harn-rules crate; it is exposed to Harn as std/rules and to the CLI as harn scan (read-only) and harn codemod (apply).

Pair it with [[harn-language]] for .harn syntax and [[harn-testing]] for conformance fixtures.

Start here

  • crates/harn-rules/README.md is the rule-model reference (matcher forms, relational/composite algebra, where/transform/fix, safety tiers).
  • docs/src/cookbooks/rules-engine.md is the worked-example cookbook (harn scan / harn codemod, authoring a rule).
  • A rule is TOML; an agent can author and run one entirely from .harn (via std/rules) without recompiling the binary.

A rule, end to end

  • A rule has an identity (id, language, severity, message), a [rule] matcher block, and an optional fix.
  • Scalar fields come before [rule] — [rule] opens a TOML table, so any later top-level scalar would bind to it.
  • The rule's kind is derived: a fix makes it a codemod; a message with no fix is a lint; a bare matcher is a search.

Matcher forms (the [rule] block)

  • pattern — a code snippet with $VAR metavariable holes (ast-grep style), compiled to a tree-sitter query. Operators/keywords match literally (?? ≠ ||); a repeated $VAR unifies; a metavar-free pattern is a literal pattern (foo() matches calls to foo, not any call). Matching is exact-shape: the target must have exactly the pattern's children and keywords (only a terminating ; may be omitted), so getById($A) does not match svc.getById(x) or getById(a, b). Put a hole where code varies ($OBJ.getById($A)); there is no variadic $$$ yet. Java/C#/C/C++/PHP expressions are written without ;. A trailing ; roots the pattern at the statement.
  • $VAR:kind — a typed placeholder: bind only nodes of a syntactic class. expr/stmt/type/ident aliases resolve to the grammar's supertype (TypeScript/JS/Python), else use an exact tree-sitter kind. Unknown kind = compile error.
  • kind — a bare tree-sitter node kind. regex — a regex over node text.
  • Relational (each a sub-rule, tuned by stopBy/field): inside (ancestor), has (descendant), follows/precedes (siblings).
  • Composite: all/any (lists), not (a sub-rule), matches (a [utils.NAME] utility rule by id). Every key on a node is ANDed.

Read the full file on GitHub · 111 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. 1mo ago Changed · +6 lines 388d33c22c9e
  2. 3mo ago First seen · 105 lines · 26 tokens per session scan A f42aea0d0e51

Subscribe to this mod's changes

harn-rules is a skill published in the GitHub repository burin-labs/harn (34 stars, last pushed 2d ago), licensed Apache-2.0. It adds 26 tokens to every session and 1,663 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

harn-rules compared with skills from other repositories

harn-rules next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
harn-rulesburin-labs/harnSkill342d agoApache-2.0A26Claude Code
md-auditchaitanyagiri/munder-difflinSkill10kyesterdayMITA85Claude Code
resolve-review-promnigent-ai/omnigentSkill12ktodayApache-2.0A23Claude Code, Codex
oraclesteipete/oracleSkill4.1k3d agoMITA18Claude Code, Codex
tldr-deepparcadei/Continuous-Claude-v3Skill4.0k14d agoMITA23Claude Code
brutal-honesty-reviewproffesor-for-testing/agentic-qeSkill5372d agoMITA72Claude Code
cocoreviewSnowflake-Labs/cocoplusSkill72923d agoMITA57Claude Code