refine

A prompt editor that turns vague requests into clearer, more specific instructions for Claude, using information about the project and recent work.

In plain words
What is it for?
Use it to improve a single prompt or work interactively on a request for an R, Python, Node.js, Quarto, or other Git project.
Why use it?
Unclear prompts can produce incomplete or irrelevant results; this helps define what is needed before asking.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/data-wise/claude-plugins/refine
Clone the repo
git clone --depth 1 https://github.com/Data-Wise/claude-plugins
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,486 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03486
Opus 5 $0.00000 $0.01743
Sonnet 5 $0.00000 $0.00697
Haiku 4.5 $0.00000 $0.00349

Measured 2d ago against content hash 473e3ca2a58e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

refine scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

workflow/commands/refine.md · 597 lines

How it starts

The opening of the file, as written. The whole thing — 597 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/refine - Prompt Optimizer

Optimize vague or unclear prompts into specific, well-structured requests that get better results from Claude.

Purpose

Help users write better prompts by:

  • Analyzing clarity and specificity
  • Checking project context
  • Rewriting with improvements
  • Explaining what changed and why
  • Learning prompt engineering patterns

Usage

  • /refine "<your prompt>" - Optimize a specific prompt
  • /refine - Interactive mode (will ask for prompt)

When invoked:

Step 1: Get the Prompt

If provided as argument:

/refine "Can you help me write a function that does X?"

Use the provided text.

If invoked without argument:

💡 PROMPT OPTIMIZER

Paste or type the prompt you want to optimize:

(Type 'cancel' to exit)
>

Wait for user input.

Step 2: Analyze Context

Before optimizing, gather context:

  1. Project type - Check for:

    • R package (DESCRIPTION file)
    • Python (pyproject.toml, setup.py)
    • Node.js (package.json)
    • Quarto (_quarto.yml)
    • General (git repo)
  2. Project instructions - Read if exists:

    • CLAUDE.md in project
    • ~/.claude/CLAUDE.md for user preferences
  3. Recent work - Check git log (last 3 commits) for context

  4. Coding patterns - Infer from context:

    • Language/framework in use
    • Testing framework
    • Documentation style
    • Type hints/annotations preference

Step 3: Analyze the Prompt

Identify issues:

  • Vague requirements - "make it better", "fix this", "help with X"
  • No language specified - "write a function" (which language?)
  • Question phrasing - "Can you..." instead of directive
  • Missing quality criteria - No mention of tests, docs, types
  • Unclear scope - What exactly should be done?
  • No edge cases - What should handle errors, empty input, etc.
  • Context missing - Doesn't mention relevant constraints

Step 4: Optimize the Prompt

Rewrite to be:

  • Specific - Clear language, framework, requirements
  • Directive - "Write X" not "Can you write X?"
  • Structured - Use bullets for multi-part requests
  • Complete - Include quality criteria (tests, docs, types)
  • Contextual - Reference project context when relevant
  • Edge-case aware - Mention error handling, validation

Read the full file on GitHub · 597 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 597 lines · 0 tokens per session scan A 473e3ca2a58e

Subscribe to this mod's changes

refine is a command published in the GitHub repository Data-Wise/claude-plugins (7 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,486 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.