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
