A Claude Code agent skill that silently rewrites your prompt into a stronger form before answering, using task-type recipes — plus visible modes when you want to see the work.
While active, Refine detects the type of each request, reshapes it with the matching recipe, then answers the improved version. You see only the final answer (unless a visible mode is on). It never changes what you ask — only how it is framed — and always answers in your language.
Ten input-type recipes, each loaded only when it matches:
| Recipe | Fires on |
|---|---|
debug |
a stack trace or error log |
sql |
a query to optimize, or an EXPLAIN plan |
regex |
a pattern to write, explain, or fix |
commit-msg |
a diff + "write a commit message" |
ticket |
a ticket / user-story to turn into a mini-spec |
api-design |
"design an API / endpoints for X" |
test-gen |
"write tests for X" |
review |
code pasted with "take a look" |
interview |
a big, vague build request |
agent |
a direct order to change code in this project |
Unrecognized input gets a light generic cleanup — no recipe is forced.
git clone https://github.com/dafuct/prompt-refine.git
ln -s "$(pwd)/prompt-refine/skill" ~/.claude/skills/refineThen restart your Claude Code session.
| Command | Effect |
|---|---|
/refine |
turn on silent refinement |
/refine off |
turn off |
/refine teach |
show an annotated rewrite before each answer |
/refine vs <prompt> |
answer twice — raw vs refined — side by side |
/refine audit |
post-mortem of the previous answer |
!raw <prompt> |
skip refinement for one message |
To keep the mode alive across context compaction, register a UserPromptSubmit hook in
~/.claude/settings.json:
{ "hooks": { "UserPromptSubmit": [ { "hooks": [ { "type": "command",
"command": "sh ~/.claude/skills/refine/hooks/refine-gate.sh" } ] } ] } }The gate is controlled by the flag file skill/hooks/.refine-active: /refine creates it,
/refine off deletes it. Without the flag the hook stays silent.
- Zero runtime dependencies — Markdown + POSIX shell only.
- Token-budgeted:
SKILL.md≤ 8 KB, each recipe ≤ 2 KB. Runsh scripts/check-budget.shbefore changing skill files. - Silent by default; the rewrite is shown only in
vs/teachmode.