By Hav1d
Prompt refinement middleware for Claude Code — intercepts, structures, and reviews prompts before Claude processes them
This plugin requires configuration values that are prompted when the plugin is enabled. Sensitive values are stored in your system keychain.
api_keyYour API key for the selected provider
${user_config.api_key}base_urlCustom API endpoint. Leave empty for provider default.
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
${user_config.base_url}providerProvider ID (e.g. deepseek, openrouter, claude, siliconflow). See 'prf providers list' for all options.
${user_config.provider}English | 中文
A prompt refinement middleware for Claude Code. Intercepts user prompts, reads session context, and produces a clearer, more structured version before Claude processes it.
Two modes of operation:
prf refine): Interactive TUI with Accept/Edit/Original/Skip reviewUserPromptSubmit): Automatic refinement with two-step block reviewSupports 47 built-in providers across 5 categories: Official, Domestic (China), Gateway, Coding, and Custom.
User Input
|
v
[Skip Check] -- /no-refine, short inputs, slash commands, greetings
|
v
[Read Transcript] -- Recent Claude Code session history (.jsonl)
| including thinking, tool calls, and results
v
[Summarize Context] -- Heuristic extraction of structured fields
| (Task / Tech stack / Tried / Blocker / Modified / Constraints)
v
[Refine Prompt] -- LLM rewrites input with conversation context
|
v
[Review / Inject] -- CLI: TUI review (Accept/Edit/Original/Skip)
Hook: block with comparison, user chooses a/e/o
# Step 1: Register the marketplace (one-time)
/plugin marketplace add https://github.com/Hav1d/Claude-Code-prompt-refiner
# Step 2: Install the plugin from that marketplace
/plugin install prompt-refiner
Claude Code will prompt you for:
deepseek, openrouter, claude (default: deepseek)On first session after install, SessionStart bootstraps Python dependencies automatically. The UserPromptSubmit hook then runs on every prompt — no manual config needed.
# Install
cd prompt-refiner
pip install -e ".[dev]"
# First-time setup (pick a provider, enter API key)
prf config set
# Refine a prompt (interactive)
prf refine
# Refine with direct input
prf refine "fix the login bug"
# Pipe input
echo "fix the user creation endpoint" | prf refine
# Continuous mode
prf batch
# Show config
prf config show
Note: The CLI command is
prf, notpr. Theprname conflicts with the GNUprutility.
| Command | Description |
|---|---|
prf refine [PROMPT] | Refine a prompt (interactive or with argument) |
prf batch | Continuous refinement loop |
prf config show | Show current configuration (key masked) |
prf config set | Set or update provider via interactive wizard |
prf config clear | Remove saved provider config |
prf providers list | List all 47 built-in providers |
prf providers show ID | Show provider details |
prf providers search Q | Search providers by name/ID/notes |
prf clear-cache | Clear summarization cache |
prf hook EVENT | Hook entry point for Claude Code (legacy, prefer hook_entry.py) |
| Flag | Description |
|---|---|
--config, -c | Path to config file |
--no-submit, -n | Don't submit to Claude Code after refinement |
--dry-run, -d | Show what would happen without executing |
--output, -o | Write final prompt to a file |
--skip, -s | Skip refinement entirely |
--auto, -a | Auto-accept refined version (no TUI) |
--debug | Enable debug logging |
prf config set
Launches an interactive wizard that:
~/.prompt-refiner/config.json with 0600 permissionsOn startup, credentials are resolved in this order (first match wins):
CLAUDE_PLUGIN_OPTION_API_KEY env var (set by Claude Code from keychain)~/.prompt-refiner/config.json → active provider's api_key~/.prompt-refiner/config.json → active provider's auth_tokenANTHROPIC_API_KEY env varANTHROPIC_AUTH_TOKEN env var (Bearer token)~/.claude/config.json → primaryApiKey (auto-detect)If no API key is available:
prf config set # Set or update provider + API key
prf config show # Show config (key is masked: ********abcd)
prf config clear # Remove saved provider config
npx claudepluginhub hav1d/claude-code-prompt-refiner --plugin prompt-refinerClaude harness - A harness for solo developers (Vibecoders) to handle full-cycle contract development.
Core skills library for Claude Code: TDD, debugging, collaboration patterns, and proven techniques
Harness-native ECC operator layer - 67 agents, 271 skills, 92 legacy command shims, reusable hooks, rules, selective install profiles, and production-ready workflows for Claude Code, Codex, OpenCode, Cursor, and related agent harnesses
Plugin-safe Claude Code distribution of Antigravity Awesome Skills with 1,561 supported skills.
Superpowers Plus core skills library for Claude Code: planning, execution routing, TDD, debugging, and collaboration workflows