rules-capture について
rules-capture は、再利用できるルールや好みをスコープ付きの保留記録にまとめるエージェントスキルです。機密情報を伏せ、確認後にのみ恒久ルールへ反映します。
主な機能
- 01ルールや好み、修正の検出
- 02スコープと抽出ルールの記録
- 03機密らしい値のマスキング
- 04恒久保存先の提案
- 05確認後の恒久ルール化
活用シーン
- 01会話からコーディング規約を記録
- 02後で確認するユーザーの好みを保存
- 03再利用可能なワークフローを skill-capture に委任
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ shipshitdev/ skills --skill rules-captureインストール後、Claude Code で/rules-captureを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
plugin.jsonlicenses/LICENSENOTICE.txtreferences/correct-procedure.md詳細
ルール記録スキル
契約
入力:
- 再利用可能なルール、好み、標準、または修正を表すユーザーの発言
- 任意の対象範囲:user、repo、project、skill、session
出力:
- 根拠となる引用を伏せ字にした、記録待ちのルール。抽出したルール、対象範囲、ステータスを含みます
- 永続的な保存場所の推奨
作成/変更するもの:
.agents/memory/captured-rules.mdに追記される記録待ちのルール(status: temporaryとして記録)- 永続的なルールへの変更は、明示的な確認を得た後に限ります
- 秘密情報に類する値は、決してそのまま書き込みません。記録内容を保存または表示する前に、トークン、パスワード、API キー、Cookie、秘密の認証情報を伏せ字にします。
外部への副作用:
- ありません
確認が必要な場合:
- 記録待ちのルールを永続的なプロジェクトルールまたはユーザールールに移行する前
- 記録したルールに基づいて共有/公開スキルを編集する前
委譲先:
- ルールがスキルにするべき再利用可能なワークフローである場合は、
skill-capture - ルールが複数の設定ファイルに影響する可能性がある場合は、
agent-config-audit
このスキルが有効になる場合
ユーザーが以下のいずれかに言及した場合、自動的に有効になります。
直接的なルール表現
- 「常に X をする」/「X は絶対にしない」
- 「X が好みです」/「X は好きではありません」
- 「X は二度としないで」/「X をやめて」
- 「これからは X」/「今後は X」
- 「それは私たちのやり方ではありません」/「私たちはこうしています」
- 「ルールは X です」/「標準は X です」
コーディングスタイルに関する表現
- 「X パターンを使う」/「X パターンを使わない」
- 「名前は X のようにする」/「X のようにフォーマットする」
- 「X からインポートする」/「X からインポートしない」
- 「規約は X です」
- 「X パターンに従う」
不満の兆候(特に記録してください!)
- 「なぜ X したの」/「X をやめて」
- 「前にも言いました」/「もう言いました」
- 「それは間違っています」/「それは正しくありません」
- 「これを直して」/「これを変更して」
- 罵り言葉と指示の組み合わせ(強い兆候です!)
標準についての質問
- 「X のルールは何ですか」/「X はどうすればよいですか」
- 「X と Y のどちらですか」/「どちらが正しいですか」
- 「X のコーディングスタイルは何ですか」
記録プロセス
ルールや好みを検出した場合:
1. 検出を知らせる
I noticed you expressed a preference/rule. Let me capture this.
2. ルールの詳細を抽出する
ユーザーの発言を解析して、以下を特定します。
- カテゴリー:何の領域に適用されますか?(コーディング、命名、インポート、パターン、ツール、コミュニケーション)
- ルールの種類:ALWAYS、NEVER、PREFER、AVOID
- 具体的な行動:具体的に何をするべきか/するべきでないか
- コンテキスト:いつ適用されますか
- 例:言及されている場合は、良い例と悪い例
3. 記録ファイルに記載する
.agents/memory/captured-rules.md に追記します(ファイルがない場合は、status: temporary を含む YAML フロントマターを付けて作成します)。
### [YYYY-MM-DD HH:MM] - [Category]: [Short Title]
**User said (redacted):**
> "[Short supporting quote with secrets replaced by [REDACTED_SECRET]]"
**Rule extracted:**
- **Type**: [ALWAYS | NEVER | PREFER | AVOID]
- **Action**: [What to do/not do]
- **Context**: [When this applies]
- **Category**: [coding | naming | imports | patterns | tools | communication | workflow]
**Example:**
```[language]
// Good
[good example]
// Bad
[bad example]
```
ステータス:PENDING_REVIEW
### 4. Confirm with User
このルールを記録しました:
- [ルールの簡単な要約]
これを永続的なルールに追加しますか?[はい/いいえ/修正]
### 5. On Confirmation
- **Personal preferences** → append to the user's platform-level instruction file under the appropriate section
- **Shared project coding standards** → append to the applicable `AGENTS.md`
- **Scoped project overrides** → use `AGENTS.override.md` only when inherited guidance must be replaced for a subtree
- **Claude-specific behavior** → append to `CLAUDE.md`
- **Durable project facts** (architecture, deployment notes, gotchas) → add/update a file in `.agents/memory/`
- Remove the entry from `.agents/memory/captured-rules.md` (or mark it PROCESSED)
---
## Escalate Before Documenting
A rule that repeats, or that an agent keeps breaking, belongs in structure, not prose. Before recording it as permanent text, check whether architecture, types, a lint that names the fix, or a behavior test can make the mistake impossible. Read [correct procedure](references/correct-procedure.md) for the ladder, the proof that each check fails on a real past mistake, and the rule-to-enforcer table. Record the rule as text only for judgment calls nothing can enforce.
---
## Rule Categories
### Coding Rules
- Pattern preferences
- Import conventions
- Naming conventions
- File structure
- Component patterns
### Workflow Rules
- Build/test preferences
- Git workflow
- Documentation requirements
- Communication style
### Tool Rules
- CLI preferences
- IDE settings
- Terminal behavior
- Background processes
### Communication Rules
- Response style
- Verbosity preferences
- Explanation depth
- Acknowledgment patterns
---
## Storage Locations
| Rule Type | Storage Location |
|-----------|------------------|
| Personal preferences | User-level platform instruction file |
| Project coding standards | Repo-level agent instruction file |
| Durable project facts | `.agents/memory/<topic>.md` |
| Pending review | `.agents/memory/captured-rules.md` (`status: temporary`) |
---
## Redaction Rules
Before writing or displaying a captured quote:
- Replace API keys, tokens, passwords, cookies, private URLs, and credentials
with `[REDACTED_SECRET]`.
- Keep only the shortest quote needed to justify the rule. Summarize the rest.
- If the rule itself is about handling a secret, capture the policy, not the
secret value.
## Auto-Capture File Format
File: `.agents/memory/captured-rules.md`
```markdown
---
status: temporary
last_verified: YYYY-MM-DD
---
# Captured Rules - Pending Review
Rules automatically captured from conversations. Review and promote to permanent storage.
---
## Pending Rules
[Auto-captured rules appear here]
---
## Processed Rules
[Rules that have been promoted to CLAUDE.md or .agents/memory/]
```
---
## Integration with Other Skills
This skill works with:
- **docs**: For formatting captured rules properly
---
## Cleanup Command
When user says "clean up rules" or "process captured rules":
1. Read `.agents/memory/captured-rules.md`
2. Present each pending rule for review
3. User can: Approve, Modify, Delete
4. Approved rules get promoted to CLAUDE.md or `.agents/memory/` as appropriate
5. File is cleaned up
---
## Example Interaction
**User**: "stop using console.log for debugging, use the logger service"
**Agent**:
```
I noticed a new rule. Let me capture it:
Rule: Use logger service instead of console.log for debugging
Category: Coding
Type: NEVER (console.log) / ALWAYS (logger service)
Added to captured rules. Should I promote this to permanent coding rules?
```
---
## Activation Triggers
The skill activates on these regex patterns:
```regex
# Direct commands
(always|never|don't|stop|from now on|going forward)\s+.+
(prefer|like|want|need)\s+(you to|it to|this to)\s+.+
(the rule is|the standard is|the convention is)\s+.+
# Frustration signals
(why (did|do) you|stop doing|I told you|I already said)\s+.+
(that's (wrong|not right|incorrect)|fix this|change this)\s+.+
# Questions about standards
(what's the (rule|standard|convention) for|how should I|which way is)\s+.+
```
コメント
Markdown 対応