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

@lukefryer4/stco-prompt-builder

v1.0.0

Published

A lightweight, type-safe builder for the **STCO Prompt Engineering Framework**.

Readme

@lukefryer4/stco-prompt-builder

A lightweight, type-safe builder for the STCO Prompt Engineering Framework.

npm license

Note: This package is a structural utility for formatting and validating STCO prompts in TypeScript/JavaScript. To generate, grade, and automatically test these prompts using our proprietary AI algorithms, visit the official visual builder at AI Prompt Architect.

What is STCO?

STCO (System, Task, Context, Output) is a deterministic framework designed to drastically reduce LLM hallucinations and standardise prompt engineering across large enterprise teams.

Instead of writing unstructured paragraphs to language models, you break your prompt into four explicit components. This library provides the type-safety and formatting engine to do exactly that in your codebase.

Installation

npm install @lukefryer4/stco-prompt-builder
# or
pnpm add @lukefryer4/stco-prompt-builder
# or
yarn add @lukefryer4/stco-prompt-builder

Usage

1. Type-Safe Prompt Definitions

Define your prompts with absolute type safety in your codebase.

import { STCOPrompt } from '@lukefryer4/stco-prompt-builder';

const prompt: STCOPrompt = {
  system: 'You are a senior React developer and performance expert.',
  task: 'Refactor the provided component to reduce unnecessary re-renders.',
  context: 'We are using React 18, Next.js App Router, and TailwindCSS.',
  output: 'Provide the complete refactored code block with brief inline comments.'
};

2. Building the Prompt

Compile your structured prompt into a unified string formatted perfectly for LLMs (GPT-4, Claude 3, Gemini, etc.).

import { buildPrompt } from '@lukefryer4/stco-prompt-builder';

// Formats with clean Markdown headers (### System, ### Task, etc.)
const llmReadyString = buildPrompt(prompt);

// Send to OpenAI, Anthropic, or your LLM provider
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: llmReadyString }]
});

3. Lightweight Static Validation

Before sending prompts to production models, perform a sanity check to ensure no crucial piece of the framework was left empty or dangerously short.

import { validatePrompt } from '@lukefryer4/stco-prompt-builder';

const issues = validatePrompt(prompt);

if (issues.length > 0) {
  console.warn("Prompt validation warnings:", issues);
}

Note: This static validator only checks for empty or chronically short fields. For advanced AI-driven prompt grading and heuristic scoring, please use the Free Prompt Scorer Tool.

API Reference

buildPrompt(prompt: STCOPrompt, options?: BuildOptions): string

Takes your STCO object and formats it. Options include:

  • includeHeaders (boolean) - Adds ### System, ### Task etc. Default: true
  • wrapContent (boolean) - Wraps content in markdown text blocks. Default: false

Why Use This Package?

When you embed raw strings in your codebase, prompts become disorganised and difficult to maintain:

// BAD ❌
const prompt = `You are a developer. Fix this code. We use React. Give me code only.`;

By enforcing the STCO framework via this package, you ensure consistent results across your entire engineering team.

// GOOD ✅
const llmReadyString = buildPrompt({
    system: "You are a developer.",
    task: "Fix this code.",
    context: "We use React.",
    output: "Give me code only."
});

Learn More