rules-distill

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.

By affaan-m · 2,813 installs

npx skills add affaan-m/ecc --skill rules-distill

Source repository · Upstream listing

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 1b. Collect rules index 1c. Present to user 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: 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)" } } 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 Phase 3: User Review & Execution Summary Table 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 ) Example End to end run 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.