Skip to main content

Prompt Optimizer

Give it a rough prompt. Get back a score and a better version.

CI PyPI version Python 3.12+ License: MIT

Demo

What it does

  1. Scores your prompt from 0 to 100 against 10 prompt-writing principles.
  2. Lists what is good and what is weak, with a fix for each weakness.
  3. Rewrites it into a clear, structured prompt you can copy and use.
  4. Saves the result to a file in saved/.

It runs on Groq, so you need a Groq API key.

Install

uv tool install prompt-optimizer-tool
# or: pipx install prompt-optimizer-tool

Then save your key (get one at https://console.groq.com/keys):

prompt-optimizer setup

Use

# Optimize a prompt
prompt-optimizer optimize "write code in python to fetch api data"

# From a file
prompt-optimizer optimize --file prompt.txt

# From stdin
echo "explain quantum computing to a 5 year old" | prompt-optimizer optimize

# Save somewhere else
prompt-optimizer optimize "write a blog post" --out ~/prompts

# Show the 10 principles
prompt-optimizer list

Each run is saved as saved/optimized-<date>-<time>.md, so nothing gets overwritten.

The 10 principles

  1. Role and persona
  2. Clear objective
  3. Context
  4. Step-by-step instructions
  5. Constraints and rules
  6. Output format
  7. Few-shot examples
  8. Chain of thought
  9. Success criteria
  10. Specific language

Built with

Python, Groq, LangChain, Pydantic, Click, Rich.

Run from source

git clone https://github.com/khadarbashajilan/prompt-optimizer-tool.git
cd prompt-optimizer-tool
cp .env.example .env   # add your GROQ_API_KEY
./run.sh

Develop

uv run pytest

Tests run offline and need no API key. See CONTRIBUTING.md for the code layout and PR guidelines.

Benchmark results: eval/results/20261108-220810.md

License

MIT

Metadata

Release files for prompt-optimizer-tool 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prompt-optimizer-tool 0.1.5
File Size Uploaded Provenance Actions
prompt_optimizer_tool-0.1.5.tar.gz 24.2 kB With provenance Details for prompt_optimizer_tool-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prompt-optimizer-tool 0.1.5
File Interpreter ABI Platform Actions
prompt_optimizer_tool-0.1.5-py3-none-any.whl Python 3 none any Details for prompt_optimizer_tool-0.1.5-py3-none-any.whl

Total release size: 44.0 kB

Release files / prompt_optimizer_tool-0.1.5.tar.gz

Download URL prompt_optimizer_tool-0.1.5.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c34fa3d3f98928717969a6c29443f40fae0e9d69127e72630d05bcbd8587ccc5
BLAKE2b-256 checksum
How to use checksums
bb9cac1e26252fd1cf8971efd4a8b38186a5ee9ed4fe416e892451c08de39fa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 11, 2026.

Transparency log

Release files / prompt_optimizer_tool-0.1.5-py3-none-any.whl

Download URL prompt_optimizer_tool-0.1.5-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2024a16de01a03a0a334cedd56f9303f1cc8805d666c580c0bc6463cd54123ef
BLAKE2b-256 checksum
How to use checksums
9cd78e1f719efb2a3222dfafa16444b1b5e6132eff3961a4b016f727788a3550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 11, 2026.

Transparency log

Security for prompt-optimizer-tool 0.1.5

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prompt_optimizer_tool-0.1.5.tar.gz

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 Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page