yibudak/cc-prompt-enhance-mod
cc-prompt-enhance-mod
Claude Code mod,在提示列上方加入 Enhance 按鈕,使用 Sonnet 與最近的對話,把模糊草稿轉成精確提示訊息。
關於這個 mod
Claude Code mod,在提示列上方加入 Enhance 按鈕。按下 Ctrl+E(或先按 Ctrl+X Tab,再按 E)會請 Sonnet 以最近的對話為背景,把模糊草稿改寫成精確的提示訊息,釐清模糊的指涉、修正錯字、帶入限制條件,並拆分多部分的要求。清楚的草稿會維持不變,再按一次就能還原編輯。需要終端機中的 Claude Code v2.1.287 或更新版本,附帶 VHS 錄製的示範 GIF,並透過外掛市集安裝;還要在 ~/.claude/keybindings.json 中一次加入按鍵繫結。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add yibudak/cc-prompt-enhance-mod claude plugin install cc-prompt-enhance-mod
原文 / README
You type fix that error so the test pases. Claude already knows which error you mean, but your prompt doesn't say. Enhance asks Sonnet to fill that in:
- fix that error so the test pases
+ fix the `KeyError: 'mail'` in `app/users.py:2` so `tests.test_users.TestUsers.test_create_user` passes
- Grounded edits. It fixes typos, resolves "this", "that file" or "the error" from the recent conversation, names what "done" looks like, carries over constraints you already settled, and splits multi-part asks into steps. Everything it adds comes from your draft or the conversation; choices you left open stay open.
- Leaves clear drafts alone. If there's nothing to resolve, your draft comes back unchanged, in the language you wrote it in.
- One key, both ways. Ctrl+E enhances. Press it again to revert.
Install
Run these as two separate prompts in Claude Code:
/plugin marketplace add yibudak/cc-prompt-enhance-mod
/plugin install cc-prompt-enhance-mod@cc-prompt-enhance-mod
Then run /reload-plugins, or start a new session. The button appears once you type. Drafts under two words or ten characters turn red with "This prompt is too short to enhance".
Ctrl+E (one-time setup)
A plugin can't add key bindings, so add this to ~/.claude/keybindings.json. Run /keybindings to open the file, and merge the entry if you already have bindings:
{
"bindings": [
{ "context": "Global", "bindings": { "ctrl+e": "app:cycleDiffBase" } }
]
}
<details>
<summary>Why this action, and why <code>Global</code></summary>
- A mod's button can only be pressed through an existing Claude Code action.
app:cycleDiffBaseis used only by the/diffpanel, so it's free at the prompt. While/diffis open, Ctrl+E goes to the panel. - In the
Chatcontext, the prompt's own Ctrl+E (move to end of line) wins.Globaldoesn't have that problem. - While the button shows, Ctrl+E doesn't move to the end of the line. Use End instead.
Without the binding, press Ctrl+X Tab, then E. In fullscreen rendering (/tui), you can also click the button.
How it works
| | |
| :- | :- |
| Model | sonnet, through your own Claude Code session and account. The alias resolves on Anthropic, Bedrock and Vertex. |
| What's sent | The system prompt in hooks/register.tsx, your draft, and the session's last 10 messages. Each message is capped at 2,000 characters and the whole context at 12,000. Tool calls are listed by name and file path or command. |
| Your draft | Replaced with the edit. If you kept typing while Sonnet answered, your version stays. |
| Revert | Brings back the original. Editing the text or sending it clears Revert. |
Requirements
- Claude Code v2.1.287 or later, in a terminal
- Not tested in the Desktop app's Code tab. The app draws its own prompt box, and the mods API says a mod can't read or fill a box like that, so expect it not to work there.
Permissions
A mod runs with your permissions, so check what it reaches before you install it:
claude plugin validate .claude-plugin/plugin.json
It reads the conversation and the prompt box, fills the prompt box, makes one model call per press and shows toasts. It doesn't read files, start processes or make other network requests.
Development
git clone https://github.com/yibudak/cc-prompt-enhance-mod
claude --plugin-dir ./cc-prompt-enhance-mod # loads it and hot-reloads on save
claude plugin validate ./cc-prompt-enhance-mod/.claude-plugin/plugin.json
claude plugin test ./cc-prompt-enhance-mod
cd cc-prompt-enhance-mod && vhs scripts/demo.tape # re-records assets/demo.gif
Claude Code writes the API types to .claude-plugin/types/ when it loads the mod. That folder is ignored by git.
License
MIT © Yigit Budak
