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 🙏

© 2026 – Pkg Stats / Ryan Hefner

prompt-optimizer-mcp-engine

v0.1.1

Published

Give every AI coding agent better instructions before it starts working. Local-first MCP server and portable Agent Skill.

Readme

Install an MCP server + portable Agent Skill. Your existing agent gains the ability to turn vague, complex or context-heavy requests into focused instructions, then execute them. No API key required.

Quick start · Install guides · Examples · API · Troubleshooting

Why Prompt Optimizer?

Small gaps in a request can become large implementation assumptions. Prompt Optimizer helps the agent clarify relevant requirements, preserve constraints and verify its work without turning every task into a lengthy specification.

  • Local-first and deterministic: useful optimization without network access or an external model.
  • Selective and proportional: complex tasks get structure; trivial requests stay out of the optimizer.
  • Repository-aware and scope-aware: reuse project conventions, avoid unnecessary abstractions and preserve the requested features.
  • Portable and inspectable: MCP, an instruction-only Agent Skill and a TypeScript SDK share one engine. Context ranking, compression and pass explanations are built in.

How it works

Prompt Optimizer improves instructions. Your AI agent executes the work.

The skill decides whether optimization would help, reads only necessary repository context, calls optimize_prompt, then uses the validated result as an execution contract. The host implements and verifies that contract while respecting higher-priority instructions and explicit user requirements.

Supported AI agents

| Host | MCP | Agent Skill | Evidence | | ------------------ | --- | -------------------- | --------------------------------------------------- | | OpenAI Codex | Yes | Yes | Integration supported; MCP protocol tested | | Claude Code | Yes | Yes | Integration supported; MCP protocol tested | | Google Antigravity | Yes | Yes | CLI live tested, user-reported v0.1.x; IDE untested | | Cursor | Yes | Yes | Integration supported; MCP protocol tested | | OpenCode | Yes | Yes | Integration supported; MCP protocol tested | | Generic MCP hosts | Yes | If supported by host | Protocol tested; portable skill available |

Protocol tests use the official MCP client; they do not substitute for live testing each host. Agent names identify integrations and imply no endorsement. See the compatibility matrix and evidence.

Quick start

With Node.js 22+, check the package and local server health:

npx -y [email protected] --version
npx -y [email protected] doctor

Install MCP

Codex:

codex mcp add prompt-optimizer -- npx -y [email protected]

Claude Code, project scope:

claude mcp add --transport stdio --scope project prompt-optimizer -- npx -y [email protected]

For Antigravity, Cursor, OpenCode and other clients, use the host guides. Stdio and Streamable HTTP are supported.

Install Agent Skill

The skill teaches the host when and how to optimize. Install the package globally to access its portable installer; from your target project, in a POSIX shell:

npm install --global [email protected]
PROMPTOPT_ROOT="$(npm root -g)/prompt-optimizer-mcp-engine"
node "$PROMPTOPT_ROOT/scripts/install-skill.mjs" --agent codex --scope project --project "$PWD"

Replace codex with claude-code, antigravity, cursor, opencode or generic as appropriate. Antigravity CLI global installs use --agent antigravity-cli --scope user. The installer refuses to overwrite an existing skill: review and refresh a previous copy when upgrading. Updating npm alone does not update a copied skill.

Restart the host. For a quick discovery test, ask: “Use Prompt Optimizer's inspect_prompt tool to analyze ‘fix auth’ without executing it.” For explicit optimization: “Use the prompt-optimizer skill to optimize this task, then execute it: …”

Install guides

Codex · Claude Code · Google Antigravity · Cursor · OpenCode · Generic MCP / VS Code / Gemini · Local build · Portable Agent Skill

Example: request → contract → execution

Before, from the Antigravity CLI field test:

Buat dashboard admin untuk platform AI yang menampilkan penggunaan token,
status model, biaya, dan riwayat request.
Gunakan Next.js dan sesuaikan dengan project yang sudah ada.

In the user's v0.1.1 fresh-session replay, the skill recognized this multi-feature, repository-aware task and invoked optimize_prompt before implementation.

Optimized guidance, abbreviated and representative rather than a verbatim trace:

Build the requested Next.js admin dashboard within the existing project. Cover token usage, model status, costs and request history. Reuse existing components and conventions. Keep changes focused; include responsive behavior, accessibility and relevant interaction states. Run the appropriate checks and report the result.

Execution: the same host agent implements that scope. It should not invent a prompt studio, model registry, webhook system or other major features. Necessary repository-specific details may be added to carry out the task.

Selective optimization

| Request | Expected skill decision | | --------------------------------------------------- | -------------------------------------- | | “Buat dashboard AI modern pakai Next.js.” | Optimize before implementation | | “Fix authentication ini dan rapikan arsitekturnya.” | Optimize and surface scope/constraints | | “Ubah warna tombol utama jadi merah.” | Skip; make the direct edit | | “Apa arti dependency?” / “jalankan npm run build” | Skip; answer or execute directly | | “Optimize this prompt…” | Optimize explicitly |

A successful result stays the execution contract, not a starting point for a broader specification. Normally use one primary optimization pass; do not recursively optimize its output or run all nine tools on every task. Automatic discovery remains host-controlled. Activation troubleshooting.

Tools

| MCP tool | Purpose | | ------------------------------ | ------------------------------------------------------------- | | optimize_prompt | Improve a request with proportional execution guidance | | inspect_prompt | Analyze intent, gaps, conflicts and context without rewriting | | adapt_prompt | Apply documented target-agent conventions | | evaluate_prompt | Return clearly labeled heuristic quality diagnostics | | compare_prompts | Compare strengths and weaknesses by dimension | | compress_context | Rank, deduplicate and budget relevant context | | build_agent_instruction | Assemble explicit task information into instructions | | explain_optimization | Explain supplied optimization records | | suggest_optimization_profile | Recommend a proportional local profile |

Also available: five read-only resources and five optional task templates. Full API.

Architecture

Selective optimization flow and the shared engine

The independent TypeScript core powers the MCP server and SDK. The portable skill contains workflow guidance, not a duplicate optimization engine. Tools work without skills; skills offer a lightweight fallback without MCP.

import { PromptOptimizer } from 'prompt-optimizer-mcp-engine';

const result = await new PromptOptimizer().optimize({
  prompt: 'buat dashboard ai keren pake nextjs',
  targetAgent: 'codex',
  profile: 'balanced',
  mode: 'local',
});
console.log(result.optimizedPrompt);

Architecture · Optional OpenAI-compatible, Anthropic and Gemini providers

Security and privacy

Local mode makes no remote model requests and needs no API key. No telemetry is collected. Remote AI requires explicit configuration and mode selection. Context is untrusted data; optimizer advice cannot override higher-priority instructions or host approvals.

Secret redaction is defense-in-depth, not a guarantee. Classification, conflict checks, token estimates and quality diagnostics are heuristic. They do not prove semantic fidelity or safe execution. Security model · Report a vulnerability

Development

pnpm install --frozen-lockfile
pnpm build
pnpm check
pnpm examples
pnpm run doctor

Verification · Release process · Reference projects and licenses

Roadmap

Broaden live host coverage, benchmark multilingual intent preservation and improve context provenance. New capabilities must preserve selective activation and bounded scope.

Contributing

Bug reports, reproducible host traces and focused contributions are welcome. See CONTRIBUTING.md and the code of conduct.

License

MIT. Built for the open agent ecosystem.