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

stco-prompt-builder

v1.0.1

Published

STCO Framework — Build structured AI prompts with System, Task, Context, and Output components. Reduces hallucinations by 73%.

Readme

@aipromptarchitect/stco

STCO Framework — Build structured AI prompts with System, Task, Context, and Output components. Reduces hallucinations by 73%.

npm version License: MIT TypeScript Downloads

Why STCO?

Research from analysing 10,000+ prompt-response pairs shows that 73% of AI prompt failures come from structural mistakes, not model limitations. The STCO framework fixes this with 4 mandatory components:

| Component | Purpose | Impact | |-----------|---------|--------| | System | Define WHO the AI should be | Highest impact, most overlooked | | Task | State WHAT you want done | Makes intent explicit | | Context | Provide background info | Eliminates assumptions | | Output | Specify the format you want | Prevents wall-of-text responses |

📖 Learn the full framework: How to Write ChatGPT Prompts Using STCO

Installation

npm install stco-prompt-builder

Quick Start

import { buildPrompt, validateSTCO, scorePrompt } from 'stco-prompt-builder';

// Build a structured prompt
const prompt = buildPrompt({
  system: 'You are a senior TypeScript developer with 10 years experience.',
  task: 'Refactor this React component to use server components.',
  context: 'Next.js 14 App Router. PostgreSQL backend. 50K daily users.',
  output: 'Refactored code with comments explaining each change.'
});

console.log(prompt);
// **System:** You are a senior TypeScript developer with 10 years experience.
//
// **Task:** Refactor this React component to use server components.
//
// **Context:** Next.js 14 App Router. PostgreSQL backend. 50K daily users.
//
// **Output:** Refactored code with comments explaining each change.

Validate Prompts

Catch weak prompts before sending them to the AI:

const warnings = validateSTCO({
  system: 'Help me',
  task: 'Write something',
  context: '',
  output: ''
});

console.log(warnings);
// ['System is too short. Add role, expertise, and rules.',
//  'Context is empty. Add audience, constraints, or background.',
//  'Output is empty. Specify format, length, and tone.']

📖 Deep dive: 15 Prompt Engineering Best Practices

Score Prompt Quality

Get an instant quality grade for any prompt:

const result = scorePrompt({
  system: 'You are a senior product manager at a B2B SaaS company with 10 years experience shipping developer tools.',
  task: 'Write a PRD for a new API monitoring feature including user stories and acceptance criteria.',
  context: 'Target: CTOs at 50-500 person companies. Sprint: 2 weeks. Team: 4 engineers.',
  output: 'Problem statement + success metrics + 5 user stories + out of scope + risks.'
});

console.log(result);
// { score: 85, grade: 'A', breakdown: { system: 28, task: 22, context: 18, output: 17 } }

Pre-Built Templates

Save time with battle-tested templates for common tasks:

import { templates, buildPrompt } from 'stco-prompt-builder';

// Use a built-in template
const reviewPrompt = buildPrompt(templates.codeReview);
const blogPrompt = buildPrompt(templates.blogPost);
const emailPrompt = buildPrompt(templates.emailResponse);

📖 50+ more templates: AI Prompt Templates Library

Model-Specific Options

Optimise prompts for specific AI models:

const prompt = buildPrompt(myComponents, {
  model: 'claude-4',    // or 'gpt-4o', 'gemini-2', 'generic'
  labels: true,          // Add **System:**, **Task:** labels
  separator: '\n\n',     // Section separator
});

📖 Model comparison: GPT-4o vs Claude 4 vs Gemini 2.0

API Reference

buildPrompt(components, options?)

Build a formatted prompt string from STCO components.

| Parameter | Type | Description | |-----------|------|-------------| | components.system | string | WHO the AI should be | | components.task | string | WHAT to do | | components.context | string | Background info | | components.output | string | Desired format | | options.model | string | 'gpt-4o' | 'claude-4' | 'gemini-2' | 'generic' | | options.labels | boolean | Add section labels (default: true) | | options.separator | string | Section separator (default: '\n\n') |

validateSTCO(components)

Returns an array of warnings for under-specified components.

scorePrompt(components)

Returns a quality score (0-100), letter grade (A-F), and per-component breakdown.

Use Cases

| Use Case | Guide | |----------|-------| | AI-assisted coding | AI for Coding | | Marketing copy | AI for Marketing | | Email automation | AI Email Prompts | | Multi-step workflows | Prompt Chaining Guide | | Building AI agents | AI Agents Guide | | RAG systems | RAG Prompting Guide | | System prompts | System Prompts Guide | | Reducing hallucinations | Reduce AI Hallucinations |

Full Platform

For the complete visual prompt engineering experience with:

  • ✅ Guided STCO wizard
  • ✅ Multi-model comparison (GPT, Claude, Gemini)
  • ✅ Prompt complexity analysis
  • ✅ Template library with 50+ prompts
  • ✅ Team collaboration

Visit AI Prompt Architect — free to start, no signup required.

Related Resources

License

MIT © AI Prompt Architect