Developer-native TUI for refining prompts using Claude Code
Project description
⚡ 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_prompt_refiner-1.0.0.tar.gz.
File metadata
- Download URL: claude_prompt_refiner-1.0.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fa02d4df1a709554e8f44f34b859f032688a8b18c58fd89df178722eecc0c01
|
|
| MD5 |
7e1b85db96df7700743cb59e981f55f2
|
|
| BLAKE2b-256 |
b753b9e04b90154f01b7c2c16d2a7b30b1056f8a0ea992122c73f84d5234c5da
|
Provenance
The following attestation bundles were made for claude_prompt_refiner-1.0.0.tar.gz:
Publisher:
publish.yml on richeshgupta/claude-prompt-refiner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_prompt_refiner-1.0.0.tar.gz -
Subject digest:
9fa02d4df1a709554e8f44f34b859f032688a8b18c58fd89df178722eecc0c01 - Sigstore transparency entry: 1239357155
- Sigstore integration time:
-
Permalink:
richeshgupta/claude-prompt-refiner@166825788f7f2d1bed9b23bf0b6e1cff005b25c1 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/richeshgupta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@166825788f7f2d1bed9b23bf0b6e1cff005b25c1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file claude_prompt_refiner-1.0.0-py3-none-any.whl.
File metadata
- Download URL: claude_prompt_refiner-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f971ec4b37b15602e341c1888297d42f244c6f2e78042d362c323db410a3c196
|
|
| MD5 |
80c3dec5a3c5d00d9e6069c8709a0875
|
|
| BLAKE2b-256 |
5a0671d8dba99283160ee9ca4c17acd4781460f69f2eda7322b60f6e6f383bf2
|
Provenance
The following attestation bundles were made for claude_prompt_refiner-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on richeshgupta/claude-prompt-refiner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_prompt_refiner-1.0.0-py3-none-any.whl -
Subject digest:
f971ec4b37b15602e341c1888297d42f244c6f2e78042d362c323db410a3c196 - Sigstore transparency entry: 1239357157
- Sigstore integration time:
-
Permalink:
richeshgupta/claude-prompt-refiner@166825788f7f2d1bed9b23bf0b6e1cff005b25c1 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/richeshgupta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@166825788f7f2d1bed9b23bf0b6e1cff005b25c1 -
Trigger Event:
push
-
Statement type: