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

@promptforgee/analyzer

v0.1.3

Published

PromptForge analyzer package

Downloads

496

Readme


Why this package exists

Even well-crafted prompts can suffer from hidden flaws like ambiguity, lack of context, or weak constraints.

@promptforgee/analyzer provides a static analysis engine for prompts. It evaluates your prompt text and returns a structured diagnostic report detailing its strengths, weaknesses, and a quantitative score. This empowers you to identify issues before wasting tokens on poor LLM inferences.

[!NOTE] The current engine uses a fast, heuristic-based approach. It is designed to be easily swappable with an LLM-based analysis engine in the future without breaking the API contract.

Features

  • Heuristic Engine: Fast, local evaluation without network latency.
  • Detailed Diagnostics: Highlights missing constraints, context gaps, and ambiguity.
  • Scoring System: Receive a numeric score (0-100) to benchmark prompt quality.
  • Actionable Feedback: Get specific recommendations for improvement.

Installation

# npm
npm install @promptforgee/analyzer

# pnpm
pnpm add @promptforgee/analyzer

# yarn
yarn add @promptforgee/analyzer

# bun
bun add @promptforgee/analyzer

Quick Start

import { analyzePrompt } from '@promptforgee/analyzer';

async function main() {
  const promptText = 'Write a function to sort an array. Make it fast.';

  const report = await analyzePrompt(promptText);

  console.log(`Score: ${report.score}/100`);
  // Score: 30/100

  console.log('Strengths:', report.strengths);
  // Strengths: [ 'Has a clear action verb.' ]

  console.log('Weaknesses:', report.weaknesses);
  // Weaknesses: [ 'Missing clear constraints.', 'Lacks context about the input data type.' ]

  console.log('Suggestions:', report.suggestions);
  // Suggestions: [ 'Specify the expected time complexity (e.g., O(n log n)).', 'Define the type of elements in the array.' ]
}

main();

API Overview

analyzePrompt(promptText: string): Promise<AnalysisReport>

The primary exported function. Analyzes a raw prompt string and returns a comprehensive report.

HeuristicAnalyzer

The underlying class implementing the PromptAnalyzer interface. You can instantiate this directly if you prefer an object-oriented approach.

| Method | Description | | ---------------------- | ----------------------------------------------------- | | .analyze(promptText) | Evaluates the prompt and returns an AnalysisReport. |

AnalysisReport (Interface)

The structured output of the analysis.

| Property | Type | Description | | ------------- | ---------- | ----------------------------------------------- | | score | number | A normalized score from 0 to 100. | | strengths | string[] | A list of positive aspects of the prompt. | | weaknesses | string[] | A list of identified flaws or missing elements. | | suggestions | string[] | Actionable steps to improve the prompt. |

Real-world Example

Integrating the analyzer into a CI/CD pipeline or a local testing script to ensure baseline prompt quality:

import { analyzePrompt } from '@promptforgee/analyzer';
import { Prompt } from '@promptforgee/core';

// Assume this is built via @promptforgee/core
const myPrompt = Prompt.create().task('Generate a weekly report summary').build();

const report = await analyzePrompt(myPrompt);

if (report.score < 80) {
  throw new Error(
    `Prompt quality check failed! Score: ${report.score}. Suggestions: ${report.suggestions.join(', ')}`,
  );
}

Ecosystem

@promptforgee/analyzer works best when evaluating prompts generated by @promptforgee/core.

@promptforgee/core (Builds the prompt) ↓ @promptforgee/analyzer (You are here) ↓ @promptforgee/optimizer (Automatically fixes issues) ↓ @promptforgee/registry (Stores the improved prompt)

Documentation

For full documentation and advanced usage, visit promptforge.dev/docs/analyzer.

Examples

Check out our Examples directory for more real-world use cases.

Roadmap

  • 🚧 LLM-backed analysis engine (OpenAI / Anthropic support)
  • 🚧 Custom heuristic rules injection
  • 🚧 Integration with ESLint for inline prompt linting

Contributing

We welcome contributions! Please read our Contributing Guide to get started.

License

MIT © Omnikon-Org