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/schema

v0.1.3

Published

PromptForge schema package

Readme


Why this package exists

One of the biggest challenges in working with LLMs is ensuring they return structured data (like JSON) that perfectly matches your application's expected types.

@promptforgee/schema is designed to bridge the gap between @promptforgee/core and popular schema validation libraries like Zod, Yup, and TypeBox. It will automatically translate your TypeScript schemas into strict prompt constraints and provide parsers to validate the LLM's response.

[!WARNING]
This package is currently in early development. The APIs described below are planned features.

Features

  • 🚧 Zod Integration: Convert Zod schemas directly into prompt instructions.
  • 🚧 Auto-parsing: Automatically parse and validate LLM string responses against the schema.
  • 🚧 Retry Logic Generation: Generate automated "correction" prompts when the LLM outputs invalid JSON.
  • 🚧 Type-safe End-to-End: Ensure the data returned by the LLM matches your TypeScript interfaces.

Installation

# npm
npm install @promptforgee/schema

# pnpm
pnpm add @promptforgee/schema

# yarn
yarn add @promptforgee/schema

# bun
bun add @promptforgee/schema

Quick Start

import { hello } from '@promptforgee/schema';

// Currently exports a placeholder testing function.
console.log(hello());
// Outputs: "Hello from @promptforgee/schema"

API Overview

Current API

| Export | Description | | --------- | ------------------------------------------------ | | hello() | A placeholder function ensuring package linking. |

🚧 Planned API

| Export | Description | | ------------------------------------ | ---------------------------------------------------------- | | 🚧 withZod(prompt, schema) | Injects a Zod schema definition into a Prompt builder. | | 🚧 parseResponse(response, schema) | Parses an LLM response and strictly validates it. | | 🚧 withTypeBox(prompt, schema) | Injects a TypeBox schema definition into a Prompt builder. |

Real-world Example (🚧 Planned)

The following code demonstrates how we envision this package being used in the future:

import { Prompt } from '@promptforgee/core';
import { withZod, parseResponse } from '@promptforgee/schema';
import { z } from 'zod';

const UserSchema = z.object({
  name: z.string(),
  age: z.number(),
  email: z.string().email(),
});

async function extractUserData(rawText: string) {
  // 1. Build prompt and inject schema constraints
  const prompt = Prompt.create().task(`Extract user data from: ${rawText}`);

  // 🚧 Planned API
  const strictPrompt = withZod(prompt, UserSchema);

  // 2. Fetch from LLM
  const llmResponseString = await runLLM(strictPrompt.build());

  // 3. Parse and validate
  // 🚧 Planned API
  const parsedData = parseResponse(llmResponseString, UserSchema);

  // parsedData is fully typed as { name: string, age: number, email: string }
  return parsedData;
}

Ecosystem

@promptforgee/schema acts as the data-contract layer for PromptForge.

@promptforgee/core (Builds the prompt) ↓ @promptforgee/schema (You are here)

Documentation

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

Examples

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

Roadmap

  • 🚧 Full integration with zod.
  • 🚧 Full integration with @sinclair/typebox.
  • 🚧 Auto-retry middleware for failed validations.

Contributing

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

License

MIT © Omnikon-Org