Distillation de règles

VérifiéPrudence

Analyse les compétences installées pour en extraire les principes récurrents et les transformer en règles — ajout, révision ou création de fichiers de règles.

Spar Skills Guide Bot
ProductiviteIntermédiaire
29/08/2026
Claude Code
#skills-audit#rule-management#distillation#meta#claude-code

Recommandé pour

Synthèse automatique

Analyse les skills installés et les fichiers de règles existants, puis s'appuie sur une analyse LLM par lots pour repérer les principes transversaux récurrents et proposer de les ajouter, réviser ou créer de nouvelles règles.

Points forts

  • Sépare la collecte déterministe des faits de l'analyse LLM, ce qui rend l'inventaire reproductible.
  • Fournit des critères explicites pour retenir un principe : présence dans 2+ skills, actionnabilité, risque en cas de violation et absence de doublon dans les règles.
  • Structure les verdicts (Append, Revise, New Section, New File, Already Covered, Too Specific) avec preuves et niveau de confiance.
  • Prévoit un traitement par lots thématiques puis une fusion inter-lots pour éviter les doublons et requalifier les principes répétés.

Limites

  • Dépend de chemins et scripts précis dans ~/.claude/skills/rules-distill/ ; le skill ne décrit pas de solution de repli s'ils sont absents.
  • La qualité des résultats repose fortement sur la lecture du texte complet des règles et sur la revue humaine des propositions.
  • Le workflow produit des candidats, verdicts et brouillons ; l'application effective des modifications n'est pas entièrement décrite.

Analyse de sécurité

Prudence
Score qualité82/100

The skill is a meta/tooling workflow: it shells out to two local scanner scripts, feeds collected skill and rules text to LLM subagents, and proposes (never auto-applies) edits to rule files. There is no exfiltration, no destructive command, no obfuscated payload, and writes are explicitly user-gated, so it is not risky. It earns 'caution' only because it uses Bash, reads broad local file trees, and writes config files — and because the two shell scripts it depends on are not part of the submission and cannot be audited.

Points d'attention
  • •No allowed-tools declared, yet the skill instructs execution of Bash scripts (scan-skills.sh, scan-rules.sh) — the tool declaration does not match actual runtime behavior.
  • •Both invoked scripts (`~/.claude/skills/rules-distill/scripts/scan-skills.sh` and `scan-rules.sh`) are referenced by path but their contents are not included, so their file-access scope and side effects cannot be verified; the shell script is a blind dependency.
  • •The skill mutates configuration files (rule files under rules/) and writes results.json into its own skill directory; edits are gated behind explicit user approval ('Never modify rules automatically'), which is good, but write access to rules/ is still a powerful capability.
  • •Spawns general-purpose subagents with full skill and rule text injected into the prompt, enlarging the prompt-injection surface (skill bodies are untrusted input to those subagents).
  • •Executes two external bash scripts (`scan-skills.sh`, `scan-rules.sh`) from `~/.claude/skills/rules-distill/scripts/` whose contents are not included in the skill; their behavior cannot be audited from this file alone.
  • •Untrusted-content ingestion: the skill copies full text of installed third-party skills into subagent prompts and drafts excerpts of that text into persistent rule files that later steer agent behavior — an indirect prompt-injection pathway into long-lived config, only partially mitigated by the mandatory user-approval gate.
  • •Writes persistent state (`results.json`) and, after approval, edits files outside the skill directory (rule files), though the skill explicitly forbids automatic modification without user sign-off.
Comment cette analyse est faite

Exemples

Periodic rules maintenance
Run rules-distill on my installed Claude Code skills and existing rules, then propose which recurring principles should be appended, revised, or turned into new rule files.
After installing new skills
I just installed several new skills. Scan them alongside my current rules and distill any cross-cutting principles that appear in at least two skills.
Review rule coverage
Use rules-distill to check whether my existing rules already cover the principles repeated across my skills, and flag gaps with draft rule text.

name: rules-distill description: "Scan skills to extract cross-cutting principles and distill them into rules — append, revise, or create new rule files. Use when the same principle keeps recurring across skills and belongs in a rule file instead." metadata: origin: ECC

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)

```json
{
  "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

| Verdict | Meaning | Presented to User | |---------|---------|-------------------| | Append | Add to existing section | Target + draft | | Revise | Fix inaccurate/insufficient content | Target + reason + before/after | | New Section | Add new section to existing file | Target + draft | | New File | Create new rule file | Filename + full draft | | Already Covered | Covered in rules (possibly different wording) | Reason (1 line) | | Too Specific | Should stay in skills | Link 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.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/rules-distillation-mte1llei/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/rules-distillation-mte1llei' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/rules-distillation-mte1llei/download' --output '.skill-downloads/rules-distillation-mte1llei/SKILL.md.part' && mv '.skill-downloads/rules-distillation-mte1llei/SKILL.md.part' '.skill-downloads/rules-distillation-mte1llei/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/rules-distillation-mte1llei/SKILL.md' && test -s '.skill-downloads/rules-distillation-mte1llei/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/rules-distill' && cp -R '.skill-downloads/rules-distillation-mte1llei' '.claude/skills/rules-distill'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/rules-distillation-mte1llei'

openskills read 'rules-distillation-mte1llei'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/rules-distillation-mte1llei/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires