@promptforgee/templates
v0.1.4
Published
PromptForge templates package
Readme
Why this package exists
Crafting the perfect system prompt for specific roles (like a Code Reviewer, Security Engineer, or Translator) requires significant trial and error.
@promptforgee/templates provides a library of pre-configured @promptforgee/core Prompt instances. These templates have been highly optimized and battle-tested in production to yield reliable, high-quality responses from leading LLMs. Instead of reinventing the wheel, simply import a template, inject your context, and execute.
Features
- Plug-and-Play: Import a template and use it immediately.
- Highly Tuned: Pre-configured with optimal roles, tasks, constraints, and tones.
- Composable: Templates are
Promptinstances, meaning you can chain additional.context()or.constraint()calls to customize them further. - Type-safe: Fully integrated with
@promptforgee/core.
Installation
# npm
npm install @promptforgee/templates @promptforgee/core
# pnpm
pnpm add @promptforgee/templates @promptforgee/core
# yarn
yarn add @promptforgee/templates @promptforgee/core
# bun
bun add @promptforgee/templates @promptforgee/coreQuick Start
import { FrontendEngineer } from '@promptforgee/templates';
import { MarkdownFormatter } from '@promptforgee/core';
async function generateReactComponent(requirements: string) {
// 1. Extend the pre-built template
const myPrompt = FrontendEngineer.context(`Component Requirements: ${requirements}`).constraint(
'Use Tailwind CSS for styling.',
);
// 2. Format it to a string
const promptString = myPrompt.build(new MarkdownFormatter());
// 3. Send to LLM...
console.log(promptString);
}API Overview
Each export is a pre-configured Prompt builder instance from @promptforgee/core.
| Export | Ideal Use Case |
| ------------------ | ----------------------------------------------------------- |
| FrontendEngineer | Generating UI components, HTML/CSS, React/Vue code. |
| BackendEngineer | Writing server logic, API endpoints, database queries. |
| ReactExpert | Highly specialized React development with modern hooks. |
| CodeReviewer | Identifying bugs, performance issues, and code smells. |
| Teacher | Explaining complex technical concepts clearly to beginners. |
| Interviewer | Conducting simulated technical interviews. |
| Debugger | Analyzing stack traces and suggesting fixes. |
| SecurityEngineer | Auditing code for vulnerabilities (XSS, SQLi, etc.). |
| Researcher | Summarizing academic papers or technical documentation. |
| Translator | Translating text across spoken or programming languages. |
| TechnicalWriter | Generating API documentation, READMEs, and guides. |
Real-world Example
Building a multi-agent CI/CD pipeline step:
import { CodeReviewer, SecurityEngineer } from '@promptforgee/templates';
async function performAutomatedCodeReview(pullRequestDiff: string) {
// Generate the review prompt
const reviewPrompt = CodeReviewer.context(`PR Diff:\n${pullRequestDiff}`).build();
// Generate the security audit prompt
const securityPrompt = SecurityEngineer.context(`PR Diff:\n${pullRequestDiff}`)
.constraint('Focus strictly on OWASP Top 10 vulnerabilities.')
.build();
// Execute both prompts in parallel via your LLM provider
const [review, security] = await Promise.all([runLLM(reviewPrompt), runLLM(securityPrompt)]);
return { review, security };
}Ecosystem
@promptforgee/templates provides the starting point for your PromptForge workflows.
@promptforgee/templates (You are here) ↓ @promptforgee/core (Customize the template) ↓ @promptforgee/analyzer (Validate your additions) ↓ @promptforgee/optimizer (Optimize the final prompt)
Documentation
For full documentation and advanced usage, visit promptforge.dev/docs/templates.
Examples
Check out our Examples directory for more real-world use cases.
Roadmap
- 🚧
DataScientisttemplate for pandas/numpy data manipulation. - 🚧
DevOpsEngineertemplate for Docker/Kubernetes/Terraform configurations. - 🚧 Domain-specific templates (e.g., Legal Assistant, Financial Analyst).
Contributing
We welcome contributions! Please read our Contributing Guide to get started.
License
MIT © Omnikon-Org
