en un clic
smart-compact
// セッションのコンテキストを分析し、重要な情報を保持するためのプロンプトを生成して /compact コマンドの実行を支援するスキル。コンテキストウィンドウが逼迫してきた時や、セッションを整理したい時に使用。
// セッションのコンテキストを分析し、重要な情報を保持するためのプロンプトを生成して /compact コマンドの実行を支援するスキル。コンテキストウィンドウが逼迫してきた時や、セッションを整理したい時に使用。
Persist mid-session progress (plan refinements, task progress notes, scope changes, decisions, blockers) to the bit issues created by start-work. Use as a checkpoint before context compaction, after meaningful progress (multiple tasks done, plan refined, scope shifted), before pausing work, or when the user mentions 'save session', 'snapshot', 'checkpoint', 'update bit issue', or 'persist progress'.
Restore session state (plan, target files, in-flight tasks) from bit issues created by the start-work skill. Use when resuming work after Claude Code restart, when the in-memory task list is empty but bit issues exist for the current branch, or when the user mentions "restore session", "repair session", "pick up where I left off", or references a prior bit-issue-tracked session.
Guide for writing, refactoring, and testing MoonBit projects. Use when working in MoonBit modules or packages, organizing MoonBit files, using moon tooling (build/check/run/test/doc/ide etc.), or following MoonBit-specific layout, documentation, and testing conventions.
Guide for writing MoonBit bindings to C libraries using native FFI. Use when adding extern "c" declarations, writing C stubs with moonbit.h, configuring native-stub and link.native in moon.pkg, choosing
Use when writing or refactoring proof-carrying code in MoonBit, especially for Why3-backed specifications, abstraction functions, representation invariants, proof assertions, recursive verified data structures, or reducing trusted proof bridges.
Refactor MoonBit code to be idiomatic: shrink public APIs, convert functions to methods, use pattern matching with views, add loop invariants, and ensure test coverage without regressions. Use when updating MoonBit packages or refactoring MoonBit APIs, modules, or tests.
| name | smart-compact |
| description | セッションのコンテキストを分析し、重要な情報を保持するためのプロンプトを生成して /compact コマンドの実行を支援するスキル。コンテキストウィンドウが逼迫してきた時や、セッションを整理したい時に使用。 |
| disable-model-invocation | true |
セッションのコンテキストを分析し、ユーザーの意図に沿った /compact プロンプトを生成する。
会話履歴全体を分析し、以下の要素を抽出する:
分析結果を簡潔に箇条書きで表示する。
Phase 1の分析結果に基づき、AskUserQuestionでユーザーにヒアリングする。
質問の生成ルール:
質問テンプレート:
質問: "compactで重点的に保持したい情報はどれですか?"
header: "保持情報"
multiSelect: true
選択肢の例(セッション内容に応じて動的生成):
- "<具体的なタスク名>の実装進捗と残作業"
- "<ファイル名>周辺のエラー調査コンテキスト"
- "<技術名>に関する設計判断と理由"
- "<機能名>のAPI仕様と型定義"
重要: プリセットの汎用的な選択肢ではなく、セッション分析結果から導出した具体的な選択肢を生成すること。
ユーザーの回答に基づき、/compact に渡すプロンプトを生成する。
プロンプト生成ガイドライン:
生成フォーマット:
以下の情報を重点的に保持してコンテキストを圧縮してください:
1. [保持項目1の具体的な内容]
2. [保持項目2の具体的な内容]
3. [保持項目3の具体的な内容]
特に以下は正確に保持してください:
- [重要な固有名詞、パス、コマンドなど]
生成したプロンプトをユーザーに提示
以下のコマンドをコピーして実行してください:
/compact <生成したプロンプト>
> /smart-compact
=== Phase 1: セッションコンテキスト分析 ===
このセッションの主な内容:
- dotfiles CLIのMCPMerger機能の実装
- defu を使ったディープマージのバグ修正
- tests/core/mcp-merger.test.ts のテスト追加
=== Phase 2: ヒアリング ===
[AskUserQuestion]
compactで重点的に保持したい情報はどれですか?
[1] MCPMergerのdefu統合バグの調査経緯と修正内容
[2] mcp-merger.test.ts の追加テストケースと意図
[3] claude.jsonのマージ仕様(キー保持ルール)
[4] Other
> 1, 3 を選択
=== Phase 3: プロンプト生成 ===
生成したプロンプト:
---
以下の情報を重点的に保持してコンテキストを圧縮してください:
1. MCPMergerでdefuを使ったmcpServersマージ時に、既存キーが上書きされるバグの原因と修正内容(src/core/mcp-merger.ts の mergeConfig 関数)
2. claude.jsonのマージ仕様:mcpServersキーのみマージし、apiKey等の他キーはdefu経由で保持する設計判断
特に以下は正確に保持してください:
- src/core/mcp-merger.ts, tests/core/mcp-merger.test.ts のファイルパス
- defu の非破壊マージ挙動(ターゲット側の値が優先される仕様)
---
以下のコマンドをコピーして実行してください:
/compact 以下の情報を重点的に保持してコンテキストを圧縮してください:...
/compact はClaude Codeの組み込みコマンドのため、スキルから直接実行はできない