agentleFS
Data-WiseData-Wise/craft/skills/workflow/prompt-refiner/SKILL.md

prompt-refiner

Skill4 starsChanged 13 days agoMITView on GitHub

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.

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Rule of thumb for any future command: if the command's job is *deciding what to do*, default ON.

    line 35
  2. Very specific:

    Skip-gate (terse action-verb prompts): before rewriting, check the raw prompt against the action-verb-execution pattern — a single clear …

    line 61
  3. Distinctive:

    NEVER execute the prompt or call tools — rewrite text only.

    line 117
  4. Distinctive:

    NEVER write files — context reads are read-only.

    line 118
  5. Distinctive:

    NEVER touch secrets/tokens.

    line 119
  6. Very specific:

    If the user passes --explain or asks "why" after seeing the refined prompt, add a one-line rationale per change under "Changed:" (e.g.

    line 129

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 fileDefaultCategory
commands/do.mdONDeliberation-entry (routes a task; refining sharpens what gets routed)
commands/brainstorm.mdONDeliberation-entry
commands/plan.mdONDeliberation-entry (universal planning router)
commands/plan/feature.mdONDeliberation-entry
commands/grill.mdON (topic-scoped — skipped when the argument is a path, nothing to refine)Deliberation-entry
commands/orch.mdOFFExecution engine (task is already decided by the time it reaches here; refining would re-litigate a settled scope)
commands/orch/workflow.mdOFFExecution engine
commands/arch/plan.mdOFFPredates D6 (Conflict 1.1.1 didn't cover it) — kept OFF, not revisited here
commands/smart-help.mdOFFLookup/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)

  1. 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.
  2. 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.
  3. Rewrite the prompt to add scope, specifics, and intent — without inventing requirements the user didn't imply.
  4. 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.

  5. Confirm via AskUserQuestion, exactly these four options:

    OptionMeaning
    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 elsewhereAccept 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 firstPresent the refined text and take the user's edited version inline (no $EDITOR), then re-ask this same question with the edited version.
    SkipKeep 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.

  6. 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.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.