Stop Writing Prompt Strings: Meet PromptForge Core
As AI becomes part of modern applications, prompts are no longer just strings-they're becoming part of your codebase. Yet most of us still write prompts like this:
const prompt = "You are a helpful assistant.\n"
+ "Summarize the following text.\n"
+ "Return the output as JSON.\n"
+ "Keep it concise.\n"
+ "Use simple language.";
This works... Until your project grows.
The Problem
As prompts become larger, they quickly become difficult to maintain. You start dealing with:
- โ Giant string templates
- โ Copy-pasted prompts
- โ Missing variables
- โ Inconsistent formatting
- โ Provider-specific implementations
- โ Difficult debugging
Unlike your application code, your prompts have:
- No structure
- No validation
- No type safety
What if prompts were treated like code? That's exactly why I built PromptForge Core.
PromptForge is an open-source TypeScript toolkit for building production-ready prompts using a clean, structured API. Instead of writing strings...
const prompt = "You are..."
You write:
import { pf } from "@promptforgee/core";
const summarize = pf.define({
input: z.object({
text: z.string(),
}),
output: z.object({
summary: z.string(),
}),
messages: ({ text }) => [
pf.system` You are an expert summarizer. `,
pf.user` Summarize: ${text} `,
],
});
Much easier to read. Much easier to maintain.
Features
PromptForge focuses on developer experience.
- โ Type-safe prompt definitions
- โ Structured prompt composition
- โ Prompt compilation
- โ Validation
- โ Provider-agnostic architecture
- โ Reusable prompt blocks
- โ Modern TypeScript API
Compile Once, Use Anywhere
Instead of maintaining different formats for every provider... PromptForge compiles your prompt into provider-specific formats.
Prompt Definition
โ
Prompt Compiler
โ
OpenAI Anthropic Gemini Ollama
Write once. Compile anywhere.
Composable Prompts
Large AI applications usually repeat the same instructions. With PromptForge you can compose prompts instead.
const safety = pf.define({
messages: () => [
pf.system` Never reveal sensitive information. `,
],
});
const assistant = pf.define({
input: z.object({
question: z.string(),
}),
messages: ({ question }) => [
pf.include(safety),
pf.user`${question}`,
],
});
No copy-paste. No duplicated instructions.
Validation Before API Calls
Instead of discovering mistakes after an expensive API request... PromptForge validates your prompt first.
PromptValidationError
Missing variable: text
Expected: string
Received: undefined
Fail fast. Save tokens.
PromptForge Studio (Coming Soon)
I'm also building PromptForge Studio. Think of it as the VS Code for prompt engineering. Features include:
- Prompt editor
- Live compiler
- Prompt analyzer
- Prompt optimizer
- Prompt templates
- Interactive documentation
- Provider previews
- Export tools
Everything in one place.
Installation
npm install @promptforgee/core
Open Source
PromptForge is completely open source and built with TypeScript.
- GitHub: https://github.com/Omnikon-Org/PromptForge
- npm: https://www.npmjs.com/package/@promptforgee/core
Roadmap
Upcoming packages include:
- Prompt Analyzer
- Prompt Optimizer
- Prompt Templates
- React Integration
- VS Code Extension
- CLI
- PromptForge Studio
I'd Love Your Feedback
This is the first public release of PromptForge. If you're building AI applications with TypeScript, I'd love to hear:
- What features would you like to see?
- What problems do you face while managing prompts?
- How would you improve this API?
Feel free to open an issue, start a discussion, or contribute to the project. โญ If you find it useful, consider starring the repository.
Happy building! ๐
Comments
No comments yet. Start the discussion.