SkillAgentSearch skills...

Promptsmith

๐Ÿง  A TypeScript library for crafting structured, maintainable system prompts using a fluent, chainable API with full type safety. It supports context, few-shot examples, guardrails against prompt injection, tool definitions with Zod, and export to Vercel AI SDK.

Install / Use

/learn @galfrevn/Promptsmith
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./assets/promptsmith-white.svg"> <source media="(prefers-color-scheme: light)" srcset="./assets/promptsmith-black.svg"> <img src="./assets/promptsmith-black.svg" alt="PromptSmith Logo" width="160" height="160"> </picture> <h1 align="center">PromptSmith</h1> <p align="center"> <strong>Type-Safe System Prompt Builder for Production AI Agents</strong> <br /> Stop wrestling with prompt strings. Start building AI agents that actually work. </p> <p align="center"> <a href="https://github.com/galfrevn/promptsmith/graphs/contributors"> <img src="https://img.shields.io/github/contributors/galfrevn/promptsmith?style=for-the-badge" alt="Contributors"> </a> <a href="https://github.com/galfrevn/promptsmith/stargazers"> <img src="https://img.shields.io/github/stars/galfrevn/promptsmith?style=for-the-badge" alt="Stars"> </a> <a href="https://github.com/galfrevn/promptsmith/issues"> <img src="https://img.shields.io/github/issues/galfrevn/promptsmith?style=for-the-badge" alt="Issues"> </a> </p> </div>
<div align="center"> <img src="./assets/banner-short.png" alt="PromptSmith Banner" width="100%" style="max-width: 1200px; border-radius: 8px;"> </div>

What is PromptSmith?

A type-safe, composable prompt builder for the Vercel AI SDK. Build production-ready AI agents with built-in security, tool integration, and token optimization.

For package documentation and API reference, see apps/core/README.md

Quick Example

import { createPromptBuilder } from "promptsmith-ts/builder";
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { z } from "zod";

// Build your agent with a fluent API
const agent = createPromptBuilder()
  .withIdentity("You are a helpful customer service assistant")
  .withCapabilities(["Answer questions", "Process returns"])
  .withTool({
    name: "search_products",
    description: "Search product catalog",
    schema: z.object({
      query: z.string().describe("Search query"),
    }),
    execute: async ({ query }) => {
      return await db.products.search({ query });
    },
  })
  .withGuardrails(); // Built-in security

// Deploy in one line
const response = await generateText({
  model: openai("gpt-4"),
  ...agent.toAiSdk(),
  prompt: "Find me a laptop under $1000",
});

Project Structure

This is a monorepo managed with Turbo and Bun.

promptsmith/
โ”œโ”€โ”€ apps/
โ”‚   โ”œโ”€โ”€ core/              # Main library package (promptsmith-ts)
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ builder.ts       # SystemPromptBuilder class
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ schemas.ts       # Zod schema utilities
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ tester.ts        # Testing framework
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ templates/       # Pre-built templates
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ types.ts         # TypeScript definitions
โ”‚   โ”‚   โ””โ”€โ”€ __tests__/           # Test suite
โ”‚   โ””โ”€โ”€ docs/              # Documentation site (Next.js + Fumadocs)
โ”œโ”€โ”€ assets/                # Logo and branding
โ”œโ”€โ”€ CONTRIBUTING.md        # Contributing guidelines
โ””โ”€โ”€ package.json           # Monorepo configuration

Tech Stack

Development

Setup

# Clone the repository
git clone https://github.com/galfrevn/promptsmith.git
cd promptsmith

# Install dependencies
bun install

Available Commands

# Development
bun dev              # Start all apps in development mode
bun dev:docs         # Start documentation site

# Build & Quality
bun build            # Build all packages
bun test             # Run all tests
bun test:coverage    # Run tests with coverage
bun lint             # Lint all files
bun format           # Format all files

# Core library (from apps/core/)
cd apps/core
bun build            # Build the library
bun test             # Run library tests

Workflow

  1. Make changes in apps/core/src/
  2. Add tests in apps/core/__tests__/
  3. Run bun test to verify
  4. Run bun format to format code
  5. Create a pull request

Key Features

  • ๐Ÿ”’ Type-Safe Tools - Zod schemas with full TypeScript support
  • ๐Ÿ›ก๏ธ Security Built-In - One-line guardrails against prompt injection
  • ๐Ÿงฉ Composable - Create base prompts and extend them
  • ๐Ÿงช Testable - Built-in framework for LLM validation
  • โšก Token Optimization - TOON format reduces usage by 30-60%
  • ๐Ÿ“ฆ Production Templates - Pre-built for common use cases

Format Efficiency Comparison:

toon           โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“   15.0  โ”‚  70.1% acc  โ”‚  4,678 tokens
csv            โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–‘   14.3  โ”‚  67.7% acc  โ”‚  4,745 tokens
json-compact   โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–‘โ–‘โ–‘โ–‘โ–‘   11.0  โ”‚  65.3% acc  โ”‚  5,925 tokens
yaml           โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘    9.4  โ”‚  66.7% acc  โ”‚  7,091 tokens
json-pretty    โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘    7.5  โ”‚  65.4% acc  โ”‚  8,713 tokens
xml            โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–“โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘    6.8  โ”‚  67.2% acc  โ”‚  9,944 tokens

TOON format provides the best balance of efficiency and accuracy


Comparison with Alternatives

PromptSmith stands out in the AI prompt engineering ecosystem with unique features and superior developer experience:

| Feature | PromptSmith | LangChain Prompts | Vercel AI Templates | Mastra Prompts | |---------|-------------|-------------------|---------------------|----------------| | Type Safety | โญโญโญโญโญ<br/>Full TypeScript + Zod inference | โญโญโ˜†โ˜†โ˜†<br/>Basic typing | โญโญโญโ˜†โ˜†<br/>Partial typing | โญโญโญโญโ˜†<br/>Good typing | | Tool Management | โญโญโญโญโญ<br/>Auto-detection, validation | โญโญโญโ˜†โ˜†<br/>Manual config | โญโญโญโญโ˜†<br/>Built-in support | โญโญโญโญโ˜†<br/>Native tools | | Pre-deployment Validation | โญโญโญโญโญ<br/>Built-in validator | โญโ˜†โ˜†โ˜†โ˜†<br/>None | โญโญโ˜†โ˜†โ˜†<br/>Basic checks | โญโญโญโ˜†โ˜†<br/>Runtime only | | LLM Testing Framework | โญโญโญโญโญ<br/>Integrated tester | โญโญโ˜†โ˜†โ˜†<br/>External tools | โญโ˜†โ˜†โ˜†โ˜†<br/>Not included | โญโญโญโ˜†โ˜†<br/>Basic testing | | Security Guardrails | โญโญโญโญโญ<br/>One-line built-in | โญโญโ˜†โ˜†โ˜†<br/>Manual setup | โญโญโ˜†โ˜†โ˜†<br/>Manual setup | โญโญโญโ˜†โ˜†<br/>Some built-in | | Token Optimization | โญโญโญโญโญ<br/>TOON format (30-60% savings) | โญโญโ˜†โ˜†โ˜†<br/>Standard only | โญโญโ˜†โ˜†โ˜†<br/>Standard only | โญโญโญโ˜†โ˜†<br/>Basic optimization | | Framework Compatibility | โญโญโญโญโญ<br/>AI SDK, Mastra, Raw | โญโญโญโ˜†โ˜†<br/>LangChain only | โญโญโญโญโ˜†<br/>Vercel AI SDK | โญโญโญโ˜†โ˜†<br/>Mastra only | | Developer Experience | โญโญโญโญโญ<br/>Fluent API, autocomplete | โญโญโญโ˜†โ˜†<br/>Functional API | โญโญโญโญโ˜†<br/>Clean API | โญโญโญโญโ˜†<br/>Modern API | | Production Templates | โญโญโญโญโญ<br/>7 ready-to-use | โญโญโญโ˜†โ˜†<br/>Few examples | โญโญโ˜†โ˜†โ˜†<br/>Basic examples | โญโญโญโ˜†โ˜†<br/>Some templates | | Composability | โญโญโญโญโญ<br/>Merge, extend, inherit | โญโญโญโ˜†โ˜†<br/>Limited | โญโญโ˜†โ˜†โ˜†<br/>Basic | โญโญโญโ˜†โ˜†<br/>Moderate |

Why Choose PromptSmith?

โœ… Best-in-class type safety - Catch errors at compile time, not runtime
โœ… Unique features - Validation, testing, and Mastra tool auto-detection
โœ… Framework agnostic - Works with multiple AI frameworks
โœ… Production ready - Built-in security, optimization, and testing
โœ… Superior DX - Fluent API with full IDE autocomplete
โœ… Token efficient - Save 30-60% on tokens with TOON format

Overall Rating: 9.4/10 ๐Ÿ†


<div align="center"> <img src="./assets/banner-large.png" alt="PromptSmith Banner" width="100%"> </div>

Contributing

We welcome contributions from the community! Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.

Please read our Contributing Guide for details on:

  • Development setup and workflow
  • Coding standards and best practices
  • Testing requirements
  • Pull request process
  • How to report issues

Quick start for contributors:

# Fork and clone the repository
git clone https://github.com/galfrevn/promptsmith.git
cd promptsmith

# Install dependencies
bun install

# Make your changes, add tests, then run quality checks
bun lint && bun format && bun test

# Create a pull request

See CONTRIBUTING.md for complete guidelines.

License

MIT License - see LICENSE for details.

Links


<div align="center"> <strong>Built with โค๏ธ for the Vercel AI SDK community</strong> </div>

ยท Made by <a href="https://github.com/galfrevn">@galfrevn</a>

ยท Hephaestus by parkjisun from <a href="https://thenounproject.com/browse/icons/term/hephaestus/" target="_blank" title="Hephaestus Icons">Noun Project</a> (CC BY 3.0)

</div>

Related Skills

View on GitHub
GitHub Stars28
CategoryCustomer
Updated1mo ago
Forks1

Languages

TypeScript

Security Score

95/100

Audited on Jan 26, 2026

No findings