Communitygithub.com

ルール蒸留

スキルをスキャンして横断的な原則を抽出し、ルールとして蒸留します。既存のルールファイルへの追記、修正、または新規作成を行います。同じ原則が複数のスキルに繰り返し出現し、ルールファイルにまとめるべき場合に使用します。

ルール蒸留 とは?

「ルール蒸留」スキルは、インストールされた複数のスキルを横断的にスキャンし、共通する原則(クロスカッティング原則)を抽出してルールファイルにまとめるためのツールです。このスキルは、AIエージェント(Claude Codeなど)の開発環境で、スキル管理が煩雑になるのを防ぎ、ルールの一貫性を保つために設計されています。 プロセスは3つのフェーズで構成されます。まず「フェーズ1:インベントリ」では、スクリプトを使ってすべてのスキルとルールファイルを決定的に収集します。次に「フェーズ2:クロスリード・マッチ・評価」では、収集したスキルをテーマ別クラスタにグループ化し、サブエージェントを用いてLLMが全文を読み込み、各原則が既存ルールに「追記」「修正」「新規セクション追加」「新規ファイル作成」「既存でカバー済み」「詳細すぎる(スキルレベルに留めるべき)」のいずれかの評価を下します。重複排除や複数バッチにまたがる原則の統合もここで行います。最後に「フェーズ3:ユーザーレビューと実行」では、候補ごとに原則、根拠、違反リスク、評価、ターゲットルール、草案が提示され、ユーザーが承認、修正、スキップを選択します。ルールは自動では変更されず、必ずユーザーの承認が必要です。 このスキルは、ルールの定期メンテナンス(月次や新スキルインストール後)、スキル一覧の棚卸し後にパターンが見つかった場合、または現在のルールが使用中のスキルに対して不完全に感じられる場合に特に有用です。出力はルール変更の草案とレポートファイル(results.json)で、ユーザーが最終判断を下します。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/rules-distill

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Rules Distill

インストールされているスキルをスキャンし、複数のスキルにまたがる横断的な原理原則を抽出し、ルールに蒸留します。既存のルールファイルへの追加、古い内容の修正、または新しいルールファイルの作成を行います。

「決定的収集 + LLM判断」の原則を適用します。スクリプトが網羅的に事実を収集し、LLMが全コンテキストを横断的に読み込み、判断を下します。

使用すべきタイミング

  • 定期的なルールメンテナンス(毎月、または新しいスキルのインストール後)
  • スキルの棚卸し後に、ルールとすべきパターンが明らかになった場合
  • 使用しているスキルと比較してルールが不十分だと感じられる場合

仕組み

ルール蒸留プロセスは3つのフェーズで構成されます。

フェーズ1: 棚卸し(決定的収集)

1a. スキル一覧の収集

bash ~/.claude/skills/rules-distill/scripts/scan-skills.sh

1b. ルール一覧の収集

bash ~/.claude/skills/rules-distill/scripts/scan-rules.sh

1c. ユーザーへの表示

ルール蒸留 — フェーズ1: 棚卸し
────────────────────────────────────────
スキル: {N} ファイルスキャン完了
ルール:  {M} ファイル ({K} 見出しインデックス済み)

横断読み取り分析に進みます...

フェーズ2: 横断読み取り、マッチング、判断(LLM判断)

抽出とマッチングは単一のパスで統合されます。ルールファイルは十分に小さいため(合計約800行)、全文をLLMに提供できます。grepによる事前フィルタリングは不要です。

バッチ処理

スキルをその説明に基づいてテーマ別クラスタにグループ化します。各クラスタを、完全なルールテキストとともにサブエージェントで分析します。

バッチ間マージ

すべてのバッチが完了したら、バッチ間で候補をマージします。

  • 同一または重複する原理を持つ候補を重複排除
  • すべてのバッチからの証拠を組み合わせて「2つ以上のスキル」要件を再確認 — 各バッチで1つのスキルに見つかった原理でも、合計で2つ以上のスキルに見つかれば有効

サブエージェントプロンプト

汎用エージェントを起動し、以下のプロンプトを与えます。

あなたは、ルールに昇格させるべき原理を抽出するためにスキルを横断的に読み取るアナリストです。

## 入力
- スキル: {このバッチのスキルの全文}
- 既存のルール: {すべてのルールファイルの全文}

## 抽出基準

以下の**すべて**が真の場合にのみ候補を含めます。

1. **2つ以上のスキルに出現**: 1つのスキルにしか見られない原理はそのスキルに留めるべき
2. **実行可能な行動変容**: 「Xをせよ」「Yをするな」の形で記述可能 — 「Xは重要」ではない
3. **明確な違反リスク**: この原理が無視された場合に何が問題になるか(1文)
4. **ルールにまだない**: 全文のルールを確認 — 異なる表現で表された概念も含む

## マッチングと判断

各候補について、全文のルールと比較し、以下の判断を割り当てます。

- **追加**: 既存のルールファイルの既存セクションに追加
- **修正**: 既存のルール内容が不正確または不十分 — 修正案を提案
- **新規セクション**: 既存のルールファイルに新しいセクションを追加
- **新規ファイル**: 新しいルールファイルを作成
- **既存でカバー済み**: 既存のルールで十分にカバーされている(表現が異なっていても)
- **特化しすぎ**: スキルレベルに留めるべき

## 出力形式(候補ごと)

```json
{
  "principle":

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

関連スキル