harn-rules

harn-rules is a skill for Claude Code from burin-labs/harn. It costs 26 tokens per session (1,541 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.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.svg" alt="Measured on agentmods" 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,541 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.01541
Opus 5 $0.00013 $0.00771
Sonnet 5 $0.00005 $0.00308
Haiku 4.5 $0.00003 $0.00154

Measured 8d ago against content hash f42aea0d0e51, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 8d 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 · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 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).
  • $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 · 105 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. 8d 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 (20 stars, last pushed today), licensed Apache-2.0. It adds 26 tokens to every session and 1,541 once invoked, about $0.0001 per session on Opus 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

Other skills, from other repositories

hunk-extensions

Maps the hunkdiff/extension authoring surface for Hunk, the terminal diff viewer — hiding or reordering reviewed files, docked panes, alternate file views, commands and key bindings, dialogs, workspace writes, themes, syntax languages, VCS backends, lifecycle events. Use when writing, debugging, or installing a Hunk…

modem-dev/hunk · 105 tokens

md-audit

Read-only code quality audit — scan the current working directory for common issues (bugs, dead code, security hotspots, missing error handling) and return a prioritised findings report. No files are edited. Use when asked to "audit the code", "quick audit", "find issues", "code scan", or "what's wrong with this…

chaitanyagiri/munder-difflin · 85 tokens

oracle

Oracle second-model review: bundle prompts/files, debug, refactor, design.

steipete/oracle · 18 tokens

cocoreview

CocoReview — structured code review with six-severity findings vocabulary, progressive disclosure architecture, and universal anti-pattern baseline. Invoked via $review [file] [--complexity] [--security] [--architecture] [--language ].

Snowflake-Labs/cocoplus · 57 tokens

review-loop

Run the adversarial verification loop — implement, then hand the change to a fresh checker that did not write it, fix what it finds, and re-dispatch until APPROVE. Use before claiming any behavioural change is done, and on requests like "review loop", "adversarial review", "independent review", "get this verified"…

sangrokjung/claude-forge · 100 tokens

commit

Auto-fix, lint, test, and commit changes with a conventional commit message.

phel-lang/phel-lang · 16 tokens