Skip to main content

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.

Python License PyPI

Screenshot

Prompt Refiner in action

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_prompt_refiner-1.0.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_prompt_refiner-1.0.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

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

Hashes for claude_prompt_refiner-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9fa02d4df1a709554e8f44f34b859f032688a8b18c58fd89df178722eecc0c01
MD5 7e1b85db96df7700743cb59e981f55f2
BLAKE2b-256 b753b9e04b90154f01b7c2c16d2a7b30b1056f8a0ea992122c73f84d5234c5da

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_prompt_refiner-1.0.0.tar.gz:

Publisher: publish.yml on richeshgupta/claude-prompt-refiner

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_prompt_refiner-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for claude_prompt_refiner-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f971ec4b37b15602e341c1888297d42f244c6f2e78042d362c323db410a3c196
MD5 80c3dec5a3c5d00d9e6069c8709a0875
BLAKE2b-256 5a0671d8dba99283160ee9ca4c17acd4781460f69f2eda7322b60f6e6f383bf2

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page