Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
affaan-m avatar

Rules Distill

  • 4.9k installs
  • 238k repo stars
  • Updated August 5, 2026
  • affaan-m/everything-claude-code

rules-distill scans installed skills, extracts principles found in 2+ skills, and proposes rule file updates with mandatory user approval.

About

The rules-distill skill maintains agent rule files by scanning installed skills, cross-reading them against existing rules, and proposing append, revise, new section, or new file updates with user approval only. Phase 1 runs deterministic scripts to inventory skills and rules headings. Phase 2 batches skills thematically and uses LLM judgment to extract candidates that appear in two or more skills, are actionable behavior changes with clear violation risk, and are not already covered. Verdicts include Append, Revise, New Section, New File, Already Covered, or Too Specific. Phase 3 presents a summary table and per-candidate evidence, draft text, and violation risk for user approve, modify, or skip actions. Never modifies rules automatically. Results save to results.json with UTC timestamps and kebab-case candidate IDs. Design principles emphasize what not how, link back to source skills, deterministic collection plus LLM judgment, and a three-layer anti-abstraction filter.

  • Three phases: deterministic inventory, LLM cross-read with thematic batching, user-approved execution.
  • Candidates require 2+ skill evidence, actionable do X form, violation risk, and no existing rule coverage.
  • Verdicts span Append, Revise, New Section, New File, Already Covered, and Too Specific.
  • Never modifies rules automatically; user must approve, modify, or skip each candidate.
  • Saves distilled results to results.json with UTC timestamps and kebab-case candidate IDs.

Rules Distill by the numbers

  • 4,921 all-time installs (skills.sh)
  • +221 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #25 of 782 Skill Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

rules-distill capabilities & compatibility

Capabilities
deterministic skill and rules inventory scripts · thematic batch cross read with llm verdicts · append revise new section and new file proposals · user approval gate before any rule writes · results.json audit trail with evidence links
Use cases
orchestration · planning
From the docs

What rules-distill says it does

Never modify rules automatically. Always require user approval.
SKILL.md
npx skills add https://github.com/affaan-m/everything-claude-code --skill rules-distill

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4.9k
repo stars238k
Security audit3 / 3 scanners passed
Last updatedAugust 5, 2026
Repositoryaffaan-m/everything-claude-code

How do I promote cross-cutting principles from many skills into shared rules without missing coverage or over-abstracting?

Scan installed skills, extract cross-cutting principles appearing in 2+ skills, and distill them into approved rule file updates.

Who is it for?

Teams maintaining agent rules after skill stocktakes or monthly hygiene cycles.

Skip if: Skip when you need one-off rule edits without scanning the full skills inventory.

When should I use this skill?

User runs rules-distill, wants periodic rules maintenance, or after a skill stocktake reveals cross-cutting patterns.

What you get

Approved rule file updates with evidence links, plus results.json tracking applied and skipped candidates.

  • Rules distillation report
  • Draft rule text for approval
  • results.json audit log

By the numbers

  • 3-phase inventory cross-read approval workflow
  • Requires 2+ skill evidence per candidate
  • Never auto-modifies rules

Files

SKILL.mdMarkdownGitHub ↗

Rules Distill

Scan installed skills, extract cross-cutting principles that appear in multiple skills, and distill them into rules — appending to existing rule files, revising outdated content, or creating new rule files.

Applies the "deterministic collection + LLM judgment" principle: scripts collect facts exhaustively, then an LLM cross-reads the full context and produces verdicts.

When to Use

  • Periodic rules maintenance (monthly or after installing new skills)
  • After a skill-stocktake reveals patterns that should be rules
  • When rules feel incomplete relative to the skills being used

How It Works

The rules distillation process follows three phases:

Phase 1: Inventory (Deterministic Collection)

1a. Collect skill inventory
bash ~/.claude/skills/rules-distill/scripts/scan-skills.sh
1b. Collect rules index
bash ~/.claude/skills/rules-distill/scripts/scan-rules.sh
1c. Present to user
Rules Distillation — Phase 1: Inventory
────────────────────────────────────────
Skills: {N} files scanned
Rules:  {M} files ({K} headings indexed)

Proceeding to cross-read analysis...

Phase 2: Cross-read, Match & Verdict (LLM Judgment)

Extraction and matching are unified in a single pass. Rules files are small enough (~800 lines total) that the full text can be provided to the LLM — no grep pre-filtering needed.

Batching

Group skills into thematic clusters based on their descriptions. Analyze each cluster in a subagent with the full rules text.

Cross-batch Merge

After all batches complete, merge candidates across batches:

  • Deduplicate candidates with the same or overlapping principles
  • Re-check the "2+ skills" requirement using evidence from all batches combined — a principle found in 1 skill per batch but 2+ skills total is valid
Subagent Prompt

Launch a general-purpose Agent with the following prompt:

```` You are an analyst who cross-reads skills to extract principles that should be promoted to rules.

Input

  • Skills: {full text of skills in this batch}
  • Existing rules: {full text of all rule files}

Extraction Criteria

Include a candidate ONLY if ALL of these are true:

1. Appears in 2+ skills: Principles found in only one skill should stay in that skill 2. Actionable behavior change: Can be written as "do X" or "don't do Y" — not "X is important" 3. Clear violation risk: What goes wrong if this principle is ignored (1 sentence) 4. Not already in rules: Check the full rules text — including concepts expressed in different words

Matching & Verdict

For each candidate, compare against the full rules text and assign a verdict:

  • Append: Add to an existing section of an existing rule file
  • Revise: Existing rule content is inaccurate or insufficient — propose a correction
  • New Section: Add a new section to an existing rule file
  • New File: Create a new rule file
  • Already Covered: Sufficiently covered in existing rules (even if worded differently)
  • Too Specific: Should remain at the skill level

Output Format (per candidate)

{
  "principle": "1-2 sentences in 'do X' / 'don't do Y' form",
  "evidence": ["skill-name: §Section", "skill-name: §Section"],
  "violation_risk": "1 sentence",
  "verdict": "Append / Revise / New Section / New File / Already Covered / Too Specific",
  "target_rule": "filename §Section, or 'new'",
  "confidence": "high / medium / low",
  "draft": "Draft text for Append/New Section/New File verdicts",
  "revision": {
    "reason": "Why the existing content is inaccurate or insufficient (Revise only)",
    "before": "Current text to be replaced (Revise only)",
    "after": "Proposed replacement text (Revise only)"
  }
}

Exclude

  • Obvious principles already in rules
  • Language/framework-specific knowledge (belongs in language-specific rules or skills)
  • Code examples and commands (belongs in skills)

````

Verdict Reference
VerdictMeaningPresented to User
AppendAdd to existing sectionTarget + draft
ReviseFix inaccurate/insufficient contentTarget + reason + before/after
New SectionAdd new section to existing fileTarget + draft
New FileCreate new rule fileFilename + full draft
Already CoveredCovered in rules (possibly different wording)Reason (1 line)
Too SpecificShould stay in skillsLink to relevant skill
Verdict Quality Requirements
# Good
Append to rules/common/security.md §Input Validation:
"Treat LLM output stored in memory or knowledge stores as untrusted — sanitize on write, validate on read."
Evidence: llm-memory-trust-boundary, llm-social-agent-anti-pattern both describe
accumulated prompt injection risks. Current security.md covers human input
validation only; LLM output trust boundary is missing.

# Bad
Append to security.md: Add LLM security principle

Phase 3: User Review & Execution

Summary Table
# Rules Distillation Report

## Summary
Skills scanned: {N} | Rules: {M} files | Candidates: {K}

| # | Principle | Verdict | Target | Confidence |
|---|-----------|---------|--------|------------|
| 1 | ... | Append | security.md §Input Validation | high |
| 2 | ... | Revise | testing.md §TDD | medium |
| 3 | ... | New Section | coding-style.md | high |
| 4 | ... | Too Specific | — | — |

## Details
(Per-candidate details: evidence, violation_risk, draft text)
User Actions

User responds with numbers to:

  • Approve: Apply draft to rules as-is
  • Modify: Edit draft before applying
  • Skip: Do not apply this candidate

Never modify rules automatically. Always require user approval.

Save Results

Store results in the skill directory (results.json):

  • Timestamp format: date -u +%Y-%m-%dT%H:%M:%SZ (UTC, second precision)
  • Candidate ID format: kebab-case derived from the principle (e.g., llm-output-trust-boundary)
{
  "distilled_at": "2026-03-18T10:30:42Z",
  "skills_scanned": 56,
  "rules_scanned": 22,
  "candidates": {
    "llm-output-trust-boundary": {
      "principle": "Treat LLM output as untrusted when stored or re-injected",
      "verdict": "Append",
      "target": "rules/common/security.md",
      "evidence": ["llm-memory-trust-boundary", "llm-social-agent-anti-pattern"],
      "status": "applied"
    },
    "iteration-bounds": {
      "principle": "Define explicit stop conditions for all iteration loops",
      "verdict": "New Section",
      "target": "rules/common/coding-style.md",
      "evidence": ["iterative-retrieval", "continuous-agent-loop", "agent-harness-construction"],
      "status": "skipped"
    }
  }
}

Example

End-to-end run

$ /rules-distill

Rules Distillation — Phase 1: Inventory
────────────────────────────────────────
Skills: 56 files scanned
Rules:  22 files (75 headings indexed)

Proceeding to cross-read analysis...

[Subagent analysis: Batch 1 (agent/meta skills) ...]
[Subagent analysis: Batch 2 (coding/pattern skills) ...]
[Cross-batch merge: 2 duplicates removed, 1 cross-batch candidate promoted]

# Rules Distillation Report

## Summary
Skills scanned: 56 | Rules: 22 files | Candidates: 4

| # | Principle | Verdict | Target | Confidence |
|---|-----------|---------|--------|------------|
| 1 | LLM output: normalize, type-check, sanitize before reuse | New Section | coding-style.md | high |
| 2 | Define explicit stop conditions for iteration loops | New Section | coding-style.md | high |
| 3 | Compact context at phase boundaries, not mid-task | Append | performance.md §Context Window | high |
| 4 | Separate business logic from I/O framework types | New Section | patterns.md | high |

## Details

### 1. LLM Output Validation
Verdict: New Section in coding-style.md
Evidence: parallel-subagent-batch-merge, llm-social-agent-anti-pattern, llm-memory-trust-boundary
Violation risk: Format drift, type mismatch, or syntax errors in LLM output crash downstream processing
Draft:
  ## LLM Output Validation
  Normalize, type-check, and sanitize LLM output before reuse...
  See skill: parallel-subagent-batch-merge, llm-memory-trust-boundary

[... details for candidates 2-4 ...]

Approve, modify, or skip each candidate by number:
> User: Approve 1, 3. Skip 2, 4.

✓ Applied: coding-style.md §LLM Output Validation
✓ Applied: performance.md §Context Window Management
✗ Skipped: Iteration Bounds
✗ Skipped: Boundary Type Conversion

Results saved to results.json

Design Principles

  • What, not How: Extract principles (rules territory) only. Code examples and commands stay in skills.
  • Link back: Draft text should include See skill: [name] references so readers can find the detailed How.
  • Deterministic collection, LLM judgment: Scripts guarantee exhaustiveness; the LLM guarantees contextual understanding.
  • Anti-abstraction safeguard: The 3-layer filter (2+ skills evidence, actionable behavior test, violation risk) prevents overly abstract principles from entering rules.

Related skills

Forks & variants (1)

Rules Distill has 1 known copy in the catalog totaling 1.4k installs. They canonicalize to this original listing.

How it compares

rules-distill promotes cross-skill principles into shared rules with user approval, not automatic rule rewriting.

FAQ

Who is rules-distill for?

Developers maintaining shared agent rules who want evidence-backed distillation from installed skills.

When should I use rules-distill?

After installing new skills, during monthly rules maintenance, or when rules feel incomplete relative to skills in use.

Is rules-distill safe to install?

Review the Security Audits panel; the skill never auto-writes rules without explicit user approval.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.