Prompt Refiner
Note: Chat (claude.ai) may have a differently-scoped skill also named
prompt-refiner — general-purpose prompt improvement, not craft's --refine
flag plumbing. Unconfirmed from this repo; if cross-referencing
"prompt-refiner" in docs or conversation, specify which one is meant.
Rewrites a raw user request into a sharper prompt, then confirms. Called
by the --refine flag on brainstorm / do / orchestrate / plan:feature /
arch:plan, or standalone ("refine and print").
Default Policy (D6, 2026-07-04)
--refine's default is ON for deliberation-entry commands, OFF for execution
engines — stated once here; callers reference this section instead of each
re-explaining the same on/off choice independently.
| Command file |
Default |
Category |
commands/do.md |
ON |
Deliberation-entry (routes a task; refining sharpens what gets routed) |
commands/brainstorm.md |
ON |
Deliberation-entry |
commands/plan.md |
ON |
Deliberation-entry (universal planning router) |
commands/plan/feature.md |
ON |
Deliberation-entry |
commands/grill.md |
ON (topic-scoped — skipped when the argument is a path, nothing to refine) |
Deliberation-entry |
commands/orch.md |
OFF |
Execution engine (task is already decided by the time it reaches here; refining would re-litigate a settled scope) |
commands/orch/workflow.md |
OFF |
Execution engine |
commands/arch/plan.md |
OFF |
Predates D6 (Conflict 1.1.1 didn't cover it) — kept OFF, not revisited here |
commands/smart-help.md |
OFF |
Lookup/help, not deliberation — most topic args are a single keyword or short question |
Rule of thumb for any future command: if the command's job is deciding what to
do, default ON. If its job is doing the already-decided thing, default OFF. This
table is exhaustive over current --refine declarers — a dogfood test
(tests/test_interactive_commands_dogfood.py) asserts every command file that
declares the flag has a matching row here, so add a row in the same change that
adds a new caller.
Inputs
prompt — the raw argument the user typed.
context — project type (DESCRIPTION / package.json / pyproject.toml),
current git branch, and .STATUS current-task if present.
Procedure (the canonical --refine flow — callers MUST delegate here)
Read context (read-only): detect project type, branch, .STATUS.
- Software project (default): DESCRIPTION / package.json / pyproject.toml,
current git branch,
.STATUS current-task if present.
- Manuscript/research project (parallel branch — detect by presence of
references.bib alongside a .qmd/.tex main file, same pattern
/savant:restore uses): additionally note whether the main file has a
notation/symbol glossary table, whether docs/reviews/ (or an equivalent
existing-reports folder) has prior review docs on the same topic, and
whether .flow/research-config.yml exists (journal/register context).
Still read-only — a wider file set to check, not a different constraint.
Skip-gate (terse action-verb prompts): before rewriting, check the raw
prompt against the action-verb-execution pattern — a single clear verb
plus an already-scoped target, no compound clauses (e.g. "render the
article", "commit and push"). If it matches, skip straight to step 5 and
return the prompt unchanged — no rewrite, no before/after box, no confirm.
This round-trip has zero information gain on prompts that are already
unambiguous; it stays valuable (and still runs in full) for anything
compound or ambiguous. When unsure whether a prompt qualifies, do NOT
skip — fall through to the full procedure below.
Rewrite the prompt to add scope, specifics, and intent — without
inventing requirements the user didn't imply.
Show before/after in a boxed display, THEN print the refined prompt
in its own fenced, copy-paste-ready code block — two separate visible
blocks, both emitted as response text:
╭─ --refine ─────────────────────────────────────╮
│ Original: RAW │
│ Refined: REWRITTEN │
│ Changed: ONE-LINE WHAT CHANGED │
╰─────────────────────────────────────────────────╯
REWRITTEN
Ordering constraint (fixes a confirmed bug — do not skip): both blocks
above MUST render as visible response text in this turn BEFORE the
AskUserQuestion tool call in step 5 fires. Never collapse steps 4 and 5
into a single tool-call-only turn with no interstitial text — that
produces a confirm question with nothing shown first, which is exactly
the failure this ordering constraint exists to prevent.
Confirm via AskUserQuestion, exactly these four options:
| Option |
Meaning |
| Execute now (Recommended when a clear action is implied) |
Accept the rewrite AND act on it in this session (dispatch, run a command, apply as a rule). Falls back to just returning the text when no downstream action is implied — never force an artificial action. |
| Copy for elsewhere |
Accept the rewrite, take NO further action here — the refined prompt was for pasting into a different session/context. Short-circuits whatever called --refine: the caller's own downstream flow (e.g. brainstorm's depth/focus questions) must not start in this branch. |
| Edit first |
Present the refined text and take the user's edited version inline (no $EDITOR), then re-ask this same question with the edited version. |
| Skip |
Keep the original, unrefined text — proceed with it, not an abort. |
With --yes or auto mode, skip the picker and auto-accept Execute now,
printing refined (auto-accepted). This is the --yes cascade: one flag
both auto-accepts the prompt-refiner AND suppresses the caller's
interactive loop — fully headless.
Return the chosen prompt string to the caller (empty/no-op return on
Copy for elsewhere, since that branch takes no further action). The
skip-gate in step 2 also returns here, with the original prompt unchanged.
Constraints
- NEVER execute the prompt or call tools — rewrite text only.
- NEVER write files — context reads are read-only.
- NEVER touch secrets/tokens.
Standalone use
Invoked with no downstream command, stop after step 4–5 (or after the step-2
skip-gate, if it fires) and print the
refined prompt — this preserves the deprecated /refine behavior.
Optional: explain mode
If the user passes --explain or asks "why" after seeing the refined
prompt, add a one-line rationale per change under "Changed:" (e.g.
"directive > question — clearer instructions get better results").
Skip by default; only triggered on request to keep the standard flow lean.
1---2name: prompt-refiner3description: This skill should be used when a command's --refine flag is set, or the user asks to "refine my prompt", "optimize this prompt", "make this request sharper" — rewrites a vague natural-language request into a specific, well-structured prompt using project context, shows before/after, and confirms before the caller proceeds. Replaces the deprecated /craft:refine command.4---56# Prompt Refiner78> **Note:** Chat (claude.ai) may have a differently-scoped skill also named9> `prompt-refiner` — general-purpose prompt improvement, not craft's `--refine`10> flag plumbing. Unconfirmed from this repo; if cross-referencing11> "prompt-refiner" in docs or conversation, specify which one is meant.1213Rewrites a raw user request into a sharper prompt, then confirms. Called14by the `--refine` flag on brainstorm / do / orchestrate / plan:feature /15arch:plan, or standalone ("refine and print").1617## Default Policy (D6, 2026-07-04)1819`--refine`'s default is **ON for deliberation-entry commands, OFF for execution20engines** — stated once here; callers reference this section instead of each21re-explaining the same on/off choice independently.2223| Command file | Default | Category |24|---|---|---|25| `commands/do.md` | **ON** | Deliberation-entry (routes a task; refining sharpens what gets routed) |26| `commands/brainstorm.md` | **ON** | Deliberation-entry |27| `commands/plan.md` | **ON** | Deliberation-entry (universal planning router) |28| `commands/plan/feature.md` | **ON** | Deliberation-entry |29| `commands/grill.md` | **ON** (topic-scoped — skipped when the argument is a path, nothing to refine) | Deliberation-entry |30| `commands/orch.md` | **OFF** | Execution engine (task is already decided by the time it reaches here; refining would re-litigate a settled scope) |31| `commands/orch/workflow.md` | **OFF** | Execution engine |32| `commands/arch/plan.md` | **OFF** | Predates D6 (Conflict 1.1.1 didn't cover it) — kept OFF, not revisited here |33| `commands/smart-help.md` | **OFF** | Lookup/help, not deliberation — most `topic` args are a single keyword or short question |3435**Rule of thumb for any future command:** if the command's job is *deciding what to36do*, default ON. If its job is *doing the already-decided thing*, default OFF. This37table is exhaustive over current `--refine` declarers — a dogfood test38(`tests/test_interactive_commands_dogfood.py`) asserts every command file that39declares the flag has a matching row here, so add a row in the same change that40adds a new caller.4142## Inputs4344- `prompt` — the raw argument the user typed.45- `context` — project type (DESCRIPTION / package.json / pyproject.toml),46 current git branch, and `.STATUS` current-task if present.4748## Procedure (the canonical --refine flow — callers MUST delegate here)49501. **Read context** (read-only): detect project type, branch, `.STATUS`.51 - **Software project** (default): DESCRIPTION / package.json / pyproject.toml,52 current git branch, `.STATUS` current-task if present.53 - **Manuscript/research project** (parallel branch — detect by presence of54 `references.bib` alongside a `.qmd`/`.tex` main file, same pattern55 `/savant:restore` uses): additionally note whether the main file has a56 notation/symbol glossary table, whether `docs/reviews/` (or an equivalent57 existing-reports folder) has prior review docs on the same topic, and58 whether `.flow/research-config.yml` exists (journal/register context).59 Still read-only — a wider file set to check, not a different constraint.60612. **Skip-gate (terse action-verb prompts):** before rewriting, check the raw62 prompt against the `action-verb-execution` pattern — a single clear verb63 plus an already-scoped target, no compound clauses (e.g. "render the64 article", "commit and push"). If it matches, skip straight to step 5 and65 return the prompt unchanged — no rewrite, no before/after box, no confirm.66 This round-trip has zero information gain on prompts that are already67 unambiguous; it stays valuable (and still runs in full) for anything68 compound or ambiguous. When unsure whether a prompt qualifies, do NOT69 skip — fall through to the full procedure below.70713. **Rewrite** the prompt to add scope, specifics, and intent — without72 inventing requirements the user didn't imply.734. **Show before/after** in a boxed display, THEN print the refined prompt74 in its own fenced, copy-paste-ready code block — two separate visible75 blocks, both emitted as response text:7677 ```7879 ╭─ --refine ─────────────────────────────────────╮80 │ Original: RAW │81 │ Refined: REWRITTEN │82 │ Changed: ONE-LINE WHAT CHANGED │83 ╰─────────────────────────────────────────────────╯8485 ```8687 ```text88 REWRITTEN89 ```9091 **Ordering constraint (fixes a confirmed bug — do not skip):** both blocks92 above MUST render as visible response text in this turn BEFORE the93 `AskUserQuestion` tool call in step 5 fires. Never collapse steps 4 and 594 into a single tool-call-only turn with no interstitial text — that95 produces a confirm question with nothing shown first, which is exactly96 the failure this ordering constraint exists to prevent.97985. **Confirm** via AskUserQuestion, exactly these four options:99100 | Option | Meaning |101 |---|---|102 | **Execute now** (Recommended when a clear action is implied) | Accept the rewrite AND act on it in this session (dispatch, run a command, apply as a rule). Falls back to just returning the text when no downstream action is implied — never force an artificial action. |103 | **Copy for elsewhere** | Accept the rewrite, take NO further action here — the refined prompt was for pasting into a different session/context. Short-circuits whatever called `--refine`: the caller's own downstream flow (e.g. brainstorm's depth/focus questions) must not start in this branch. |104 | **Edit first** | Present the refined text and take the user's edited version **inline** (no $EDITOR), then re-ask this same question with the edited version. |105 | **Skip** | Keep the original, unrefined text — proceed with it, not an abort. |106107 With `--yes` or auto mode, skip the picker and auto-accept **Execute now**,108 printing `refined (auto-accepted)`. This is the `--yes` cascade: one flag109 both auto-accepts the prompt-refiner AND suppresses the caller's110 interactive loop — fully headless.1116. **Return** the chosen prompt string to the caller (empty/no-op return on112 **Copy for elsewhere**, since that branch takes no further action). The113 skip-gate in step 2 also returns here, with the original prompt unchanged.114115## Constraints116117- NEVER execute the prompt or call tools — rewrite text only.118- NEVER write files — context reads are read-only.119- NEVER touch secrets/tokens.120121## Standalone use122123Invoked with no downstream command, stop after step 4–5 (or after the step-2124skip-gate, if it fires) and print the125refined prompt — this preserves the deprecated `/refine` behavior.126127## Optional: explain mode128129If the user passes `--explain` or asks "why" after seeing the refined130prompt, add a one-line rationale per change under "Changed:" (e.g.131"directive > question — clearer instructions get better results").132Skip by default; only triggered on request to keep the standard flow lean.