@ironbackend/prompts
v1.0.2
Published
AI prompt templates for IronBackend
Maintainers
Readme
@ironbackend/prompts
AI prompt builders for IronBackend architecture knowledge.
What's Inside
Transform architecture knowledge from @ironbackend/core into AI-consumable prompts.
- System Prompt Builder - Generate complete system prompts for AI assistants
- Context Builder - Build context-aware prompts with style + stack + rules
- Rule Formatter - Format design rules for LLM consumption
Installation
npm install @ironbackend/prompts @ironbackend/coreUsage
import { buildSystemPrompt } from '@ironbackend/prompts';
import { getStyle, getStack, allRules } from '@ironbackend/core';
// Build a complete system prompt
const prompt = buildSystemPrompt({
style: getStyle('hexagonal'),
stack: getStack('node-nestjs'),
rules: allRules,
});
console.log(prompt);
// Output:
// # IronBackend System Prompt
//
// You are a senior backend engineer with 10+ years of experience
// in Hexagonal Architecture using Node.js/NestJS.
//
// ## Core Principles
// 1. Domain and application core have no external dependencies
// 2. Ports define what the application needs or provides
// ...API Reference
buildSystemPrompt
interface BuildSystemPromptOptions {
style: ArchitectureStyle;
stack: TechStack;
rules: DesignRule[];
includeSecurityPlaybook?: boolean;
}
function buildSystemPrompt(options: BuildSystemPromptOptions): string;buildContext
interface BuildContextOptions {
style?: ArchitectureStyle;
stack?: TechStack;
rules?: DesignRule[];
}
function buildContext(options: BuildContextOptions): string;formatRulesForPrompt
function formatRulesForPrompt(rules: DesignRule[]): string;Example Output
The generated prompt includes:
- Role Definition - Senior engineer persona with chosen style/stack
- Core Principles - Architecture fundamentals
- Folder Structure - Recommended project layout
- Enforced Rules - Design rules with severity levels
- Code Generation Guidelines - Best practices for the AI
# IronBackend System Prompt
You are a senior backend engineer specializing in
Hexagonal Architecture with Node.js/NestJS.
## Enforced Rules
[ERROR] API-001: All endpoints must have explicit request/response schemas
[ERROR] DOM-005: Domain logic must not depend on framework code
[WARN] ERR-003: Log errors with correlation IDs
## When Generating Code
- Controllers handle HTTP only, delegate to services
- All external dependencies injected via interfaces
- Include proper error handling per ERR-* rulesRelated Packages
@ironbackend/cli- CLI tool@ironbackend/core- Knowledge base
License
MIT
