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

@wpopera/prompter-language

v1.0.7

Published

A semantic language for creating consistent AI prompts

Downloads

93

Readme

Prompter Language

Prompter Language is a domain-specific language (DSL) designed to bring structure, type safety, and reusability to AI prompt engineering. It provides a declarative way to define, validate, and execute prompts for AI language models.

Overview

Think of Prompter Language as "TypeScript for prompts" - it adds static typing, validation, and structured composition to what would otherwise be plain text prompts. Key aspects include:

Declarative Syntax

prompt NewsArticle {
  source: url("https://api.news.com/data") {
    depth: 1
  }
  variables {
    title: string;
    tone: "neutral" | "critical";
  }
  validation {
    title: required, minLength(10);
  }
}

Type Safety

  • Strong typing for variables and parameters
  • Union types for constrained choices
  • Runtime validation of inputs
  • Compile-time checking of prompt structure

Content Pipeline

  1. Source: Fetch content from URLs, files, or Git repos
  2. Variables: Define and validate input parameters
  3. Processing: Transform content before/after AI processing
  4. Output: Format and structure the final result

Integration Features

  • Built-in support for OpenAI and other AI providers
  • Extensible source system for content fetching
  • Markdown and other output formats
  • Version control friendly

The language aims to solve common prompt engineering challenges:

  • Inconsistent prompt formatting
  • Lack of input validation
  • Difficulty in maintaining prompt versions
  • Poor reusability across projects
  • Missing type safety
  • Ad-hoc content processing

Features

  • 🎯 Semantic Prompt Definition: Define prompts using a clear, structured language
  • 🔍 Source Integration: Support for multiple content sources (URL, File, Git)
  • Variable Validation: Type checking and validation for prompt variables
  • 📝 Multiple Output Formats: Support for Markdown and other output formats
  • 🔄 Processing Pipeline: Pre and post-processing hooks for content
  • 🎨 Style Control: Fine-grained control over tone, style, and formatting

Installation

# Install using npm
npm install prompter-language

# Or using yarn
yarn add prompter-language

Quick Start

  1. Create a .env file with your API keys:
OPENAI_API_KEY=your_openai_api_key_here
  1. Create a prompt file (e.g., article.prompt):
prompt NewsArticle {
  source: url("https://example.com/news") {
    depth: 0
  }

  variables {
    title: string;
    summary: string;
    tone: "neutral" | "analytical" | "critical";
    style: "news" | "editorial" | "feature";
  }

  validation {
    title: required;
    summary: required;
    tone: required;
    style: required;
  }

  output {
    format: "markdown"
  }
}
  1. Run the prompt:
yarn start path/to/your/prompt.file

Prompt Language Syntax

Source Types

  • URL Source:

    source: url("https://example.com") {
      depth: 0,
      timeout: 5000
    }
  • File Source:

    source: file("./template.txt") {
      format: "text",
      encoding: "utf-8"
    }
  • Git Source:

    source: git("https://github.com/user/repo.git") {
      branch: "main",
      depth: 1
    }

Variables

variables {
  name: string;
  age: number;
  tags: string[];
  metadata: {
    created: string;
    author: string;
  };
}

Validation

validation {
  name: required, minLength(2), maxLength(50);
  age: required, min(0), max(150);
  tags: required, minItems(1);
}

Output Configuration

output {
  format: "markdown";
  maxLength: 2000;
  temperature: 0.7;
}

Development

Prerequisites

  • Node.js (v16 or higher)
  • Yarn or npm
  • OpenAI API key

Setup

  1. Clone the repository:
git clone https://github.com/yourusername/prompter-language.git
cd prompter-language
  1. Install dependencies:
yarn install
  1. Build the project:
yarn build
  1. Run tests:
yarn test

Project Structure

src/
  ├── cli/           # Command-line interface
  ├── parser/        # Prompt language parser
  ├── services/      # AI service integrations
  ├── sources/       # Content source handlers
  ├── types/         # TypeScript type definitions
  └── examples/      # Example prompts

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • OpenAI for their GPT models and API
  • PeggyJS for the parser generator
  • All contributors who have helped shape this project