Rule Extraction

Rule Extraction is a skill for Claude Code from KnowledgeXLab/skill-git. It costs 45 tokens per session (1,792 once invoked), scanned A, original, MIT.

A rule-extraction tool for turning instructions in a skill folder's top-level Markdown files into a structured, numbered list. Markdown is a plain-text format commonly used for documentation.

In plain words
What is it for?
Use it when reviewing a skill's behavior rules, merging instructions, or checking how rules changed.
Why use it?
It makes scattered instructions easier to inspect for conflicts, combine, or compare between versions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: reads .claude/ paths.

Part of the skill-git plugin — 2 skills, 10 commands shipped together

Good fit Use it when reviewing a skill's behavior rules, merging instructions, or checking how rules changed.

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

Made for: Claude Code.

Or install skill-git, the plugin that ships this one along with the rest of its 2 skills, 10 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 Rule Extraction

README.md
[![agentmods](https://agentmods.dev/badge/skills/knowledgexlab/skill-git/rule-extraction/github.svg)](https://agentmods.dev/skills/knowledgexlab/skill-git/rule-extraction)
Your own site
<a href="https://agentmods.dev/skills/knowledgexlab/skill-git/rule-extraction"><img src="https://agentmods.dev/badge/skills/knowledgexlab/skill-git/rule-extraction/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 Rule Extraction

Your own site · 80×15
<a href="https://agentmods.dev/skills/knowledgexlab/skill-git/rule-extraction"><img src="https://agentmods.dev/badge/skills/knowledgexlab/skill-git/rule-extraction.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,792 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.
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.00045 $0.01792
Opus 5.5 $0.00018 $0.00717
Sonnet 5.5 $0.00009 $0.00358
Haiku 4.5 $0.00005 $0.00179

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

Security

Grade A, and why

Rule Extraction 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 2mo 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.

skills/rule-extraction/SKILL.md · 205 lines

How it starts

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

Rule Extraction

This skill teaches you how to extract a structured, line-numbered list of rules from a skill directory.

What Counts as a Rule

A rule is any statement that prescribes or constrains agent behavior. Recognize rules by their form:

  • Imperative directives: "Always add type annotations", "Never use var"
  • Prohibition patterns: "Do not X", "Avoid X", "禁止 X"
  • Requirement patterns: "Must X", "Should X", "需要 X", "必须 X"
  • Conditional behavior: "If X, then Y", "When X, do Y"
  • Style/format mandates: "Use camelCase", "Limit lines to 80 characters"
  • Preference statements: "Prefer X over Y", "优先使用 X"

Rules can appear as:

  • Bullet list items (- or * or +)
  • Numbered list items (1., 2.)
  • Bold or emphasized sentences (**Always do X**)
  • Plain sentences within a paragraph that contain directive language
  • Section headers that are themselves imperatives ("Never commit secrets")

What Does NOT Count as a Rule

Exclude the following from extraction:

  • Descriptive text: Explanations of why a rule exists, background context
  • Examples: Code blocks, sample outputs, "for example..." passages
  • Metadata: YAML frontmatter, version info, author notes
  • Headings that introduce a section (unless the heading itself is an imperative rule)
  • Vague non-actionable statements: "Do good work", "Be helpful" — extract these but flag them as vague: true

Output Format

Return a JSON array. Each rule is an object:

[
  {
    "id": 1,
    "file": "SKILL.md",
    "line": 12,
    "text": "Always add type annotations to function parameters",
    "source_text": "- Always add type annotations to function parameters",
    "vague": false
  },
  {
    "id": 2,
    "file": "SKILL.md",
    "line": 15,
    "text": "Do not use var, prefer const or let",
    "source_text": "**Do not use `var`** — prefer `const` or `let`",
    "vague": false
  },
  {
    "id": 3,
    "file": "examples.md",
    "line": 4,
    "text": "Do good work",
    "source_text": "- Do good work",
    "vague": true
  }
]

Read the full file on GitHub · 205 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. 2mo ago First seen · 205 lines · 45 tokens per session scan A f42f83a6a93c

Subscribe to this mod's changes

Rule Extraction is a skill published in the GitHub repository KnowledgeXLab/skill-git (42 stars, last pushed 6mo ago), licensed MIT. It adds 45 tokens to every session and 1,792 once invoked, about $0.0002 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.