A Claude Code Button That Improves Your Prompt
Build a Claude Code mod that asks only necessary questions, rewrites a rough draft, and leaves the result for you to review and send.
Ask Claude Code to build a small mod with an Improve prompt button above the prompt box. It asks for missing details, rewrites your draft, and leaves the result for review.
This works in Claude Code in the terminal, Claude Desktop’s Code tab, or the VS Code extension. It does not add a button to the regular claude.ai chat.
What you’ll build
- A draft field and an Improve prompt button above the composer.
- Up to three questions with answer buttons, only when needed.
- A rewritten prompt to copy and review. It is never sent automatically.
What is a Claude Code mod?
A mod is a small JavaScript or TypeScript plugin that can add controls to Claude Code or change prompts. Claude Code can write one from a description. Mods run with your account’s permissions, so review the code and only run what you trust. Read Anthropic’s Mods overview and mod guide.
Step 1. Check Claude Code
Use Claude Code CLI 2.1.287 or later. Check with claude --version. In Claude Desktop, open the Code tab and run /status. Start an interactive session in default or accept-edits mode.
Step 2. Ask Claude Code to build the mod
Paste this into Claude Code. The mod uses its own draft field; it does not read or change the native prompt box.
Make me a Claude Code mod called improve-prompt.
Add an “Improve prompt” button in a small panel above the prompt box, with its own multiline draft field.
When I press the button:
1. Read only the text in the mod’s draft field.
2. Ask up to three short questions only if important context is missing. Show answer choices as buttons and allow a custom answer.
3. Rewrite the draft with a role, task, supplied context, tone, and output format. Keep its language; invent no facts, names, or numbers.
4. Show the result with Copy, Cancel, and Restore draft controls. Never send it automatically.
Use the current supported mod API. Use a separate model request only if the API allows it. If a feature is unsupported, explain why and provide a safe copy-to-clipboard alternative. Show reading, asking, rewriting, and error states. Test the mod and explain how to keep it beyond this session.Review the files Claude creates. When asked to enable hot reloading, allow it for this session. Claude Code should load the mod after it finishes.
Step 3. Try a rough prompt
Paste this into the mod’s field:
Write a post about a coffee shopPress Improve prompt. The mod may ask for a platform, tone, or length. Choose answers, review the result, and copy it to Claude’s prompt box. Edit it if needed, then send it yourself.
Example: “You are a social media copywriter for a neighborhood coffee shop. Write a 120-word Instagram post for local customers. Use a warm, natural tone and avoid clichés. Start with a hook, use three short paragraphs, and end with an invitation. Do not invent shop details.”
If something goes wrong
- No button: run
/plugin, check Installed, then ask Claude Code to inspect the load message. - Not in another session: ask Claude Code to copy the development mod and load it with
--plugin-diror package it as a plugin. - It invents details: ask it to use only your draft and selected answers.
Done when
- The panel appears above the prompt box and asks only necessary questions.
- You can copy or restore the draft, and the mod never sends the result automatically.