⚡ Prompt Refiner
A developer-native terminal UI that automatically refines your prompts using proven prompt engineering techniques — powered by your existing Claude Code subscription. No separate API key required.
Screenshot
Demo
┌─────────────────────────────────────────────────────────────────────┐
│ ⚡ Prompt Refiner Model: [claude-sonnet-4-6 ▾] │
├────────────────────────┬────────────────────────────────────────────┤
│ YOUR PROMPT │ REFINED PROMPT │
│ │ │
│ write a function to │ You are an expert software engineer. │
│ parse json │ │
│ │ <instructions> │
│ │ Write a function to parse JSON input. │
│ │ Think step by step before answering. │
│ │ </instructions> │
│ │ │
│ │ <output_format> │
│ │ Provide a complete, documented function │
│ │ with type hints and error handling. │
│ │ </output_format> │
├────────────────────────┴────────────────────────────────────────────┤
│ ANNOTATIONS │
│ ► Role prompting — code generation task detected │
│ ► Chain-of-thought — improves accuracy on multi-step logic │
│ ► XML structuring — delineates sections clearly for Claude │
│ ► Output format — specifies expected structure and style │
├─────────────────────────────────────────────────────────────────────┤
│ ^R Refine y Accept n Reject e Edit+Refine Tab Model q Quit │
└─────────────────────────────────────────────────────────────────────┘
Features
- Auto-detects task type — code, debug, explanation, or general
- Applies relevant techniques — role prompting, chain-of-thought, XML structuring, output format, constraint injection
- Annotates every change — explains why each technique was applied
- 3-action workflow — Accept (copies to clipboard), Reject, or Refine with comments
- Model switching — cycle between Haiku, Sonnet, and Opus with
Tab - Zero setup — uses your existing Claude Code login
Prerequisites
- Claude Code installed and logged in (
claude login) - Python 3.11+
Installation
Via pipx (recommended — isolated, no venv management):
pipx install claude-prompt-refiner
Via Homebrew:
brew tap richeshgupta/claude-prompt-refiner https://github.com/richeshgupta/claude-prompt-refiner
brew install claude-prompt-refiner
Via pip:
pip install claude-prompt-refiner
Usage
cpr # short alias
claude-prompt-refiner # full command
Keybindings
| Key | Action |
|---|---|
Ctrl+R |
Refine the prompt |
y |
Accept — copies refined prompt to clipboard |
n |
Reject — clears output, back to input |
e |
Refine with comments — add guidance for the next pass |
Tab |
Cycle model (Haiku → Sonnet → Opus) |
q |
Quit |
Prompt Techniques Applied
| Task Type | Techniques |
|---|---|
| Code generation | Role prompting, Chain-of-thought, XML structuring, Output format, Constraint injection |
| Debugging | Role prompting, Constraint injection, Chain-of-thought, XML structuring |
| Explanation | Role prompting, Audience injection, XML structuring, Output format |
| General | Role prompting, XML structuring, Output format, Chain-of-thought |
Project Structure
├── main.py # Entry point
├── app.py # Textual TUI (layout, keybindings, workers)
├── engine.py # RefinerEngine — prompt building + JSON parsing
├── claude.py # Subprocess wrapper for claude CLI
├── techniques.py # Task detection + technique catalogue
├── requirements.txt
└── tests/ # 17 unit tests
Running Tests
python -m pytest tests/ -v
Models
| Model | Use case |
|---|---|
claude-haiku-4-5 |
Fast, lightweight refinements |
claude-sonnet-4-6 |
Default — best balance of speed and quality |
claude-opus-4-6 |
Most thorough refinements |
Contributing
See CONTRIBUTING.md.
License
MIT
Metadata
Release files for claude-prompt-refiner 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| claude_prompt_refiner-1.0.1.tar.gz | 10.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| claude_prompt_refiner-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.1 kB
Release files / claude_prompt_refiner-1.0.1.tar.gz
| Download URL | claude_prompt_refiner-1.0.1.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74f1380dad5791c05d8d8e150f9aab4947ee7ce7bfae1d5f445f6c23940e1a50
|
|
BLAKE2b-256 checksum How to use checksums |
3bb4a5389ed58c9c24be02fa9d6a78baeae2cfff9bd493cdb9f3a2843ca35ad0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency logRelease files / claude_prompt_refiner-1.0.1-py3-none-any.whl
| Download URL | claude_prompt_refiner-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac6db6c83450c3f8fa3cabbace5398cc0da1fef61d5b9c9c251701f5a3b8edaa
|
|
BLAKE2b-256 checksum How to use checksums |
80aabfc051a5e3567ec3bd4f14b27812721b30156e0e7a279829fa0270cc8b8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency log