npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

prompt-validation

v0.1.2

Published

Validate and standardize AI prompt outputs, detect hallucinations, enforce patterns, and auto-correct issues.

Readme

prompt-validation

Validate, improve, and standardize AI prompt outputs.
Catch issues early, fix formatting, and craft clearer prompts for better LLM results.


✨ Highlights

  • 🔎 Validate text/JSON with rules (email, JSON schema, length, “no-hallucination” demo)
  • 🔧 Auto-fix common formatting problems
  • ✨ Improve prompts locally or via OpenAI/Gemini for better outputs
  • 🧭 Incredible interactive menu (loops until quit) with banner, spinner, emojis
  • ⚙️ Simple project config via .promptvalidationrc.json

📦 Install

npm install -g prompt-validation

🚀 Quick Start

Validate

# Validate a file with rules
prompt-validation check output.txt --rules email,length-limit

# Validate JSON & auto-fix formatting
prompt-validation check response.json --rules json-schema --fix

If issues are fixed, a response.json.fixed file is written.

Improve a prompt

# Improve prompt and print to stdout (local improver)
prompt-validation improve prompt.txt

# Improve with JSON target and save to file
prompt-validation improve prompt.txt --format json --out improved.txt

# Pipe from stdin
cat prompt.txt | prompt-validation improve - --format markdown

# Copy result to clipboard
prompt-validation improve prompt.txt --copy

Interactive mode

prompt-validation interactive
  • Loops until you choose Quit or press Ctrl+C
  • Paste from clipboard, validate files, or improve prompts

🤖 OpenAI / Gemini (optional)

Set one of the environment variables, then add --llm:

# OpenAI
export OPENAI_API_KEY=sk-...
prompt-validation improve prompt.txt --llm openai --model gpt-4o-mini

# Gemini
export GEMINI_API_KEY=...
prompt-validation improve prompt.txt --llm gemini --model gemini-1.5-pro

Falls back to local improvement if API calls aren’t available.


⚙️ Config

Create .promptvalidationrc.json:

{
  "rules": ["json-schema", "length-limit", "no-hallucination"]
}

Running check without --rules will use these.


🧪 Develop

npm install
npm test
npm run build

📣 Why this CLI?

  • Guardrails for LLM outputs: basic checks and fixes out-of-the-box
  • Prompt enhancement: structure, constraints, evaluation criteria
  • Pluggable direction: designed to add new rules and providers easily

🛠 Roadmap

  • Custom JSON Schema path (--schema schema.json)
  • Directory scan and glob support
  • Machine-readable reports (JSON) with exit codes
  • Plugin API for custom rules

🤝 Contributing


🧭 Project Links

  • Homepage: https://github.com/korybantes/prompt-validation#readme
  • Issues: https://github.com/korybantes/prompt-validation/issues
  • npm: https://www.npmjs.com/package/prompt-validation

📄 License

MIT © Ertaç Toptutan