prompt-template-builder
Creates reusable prompt templates with strict output contracts, style rules, few-shot examples, and do/don't guidelines. Provides system/user prompt files, variable placeholders, output formatting instructions, and quality criteria. Use when building "prompt templates", "LLM prompts", "AI system prompts", or "prompt engineering".
What this skill does
# Prompt Template Builder
Build robust, reusable prompt templates with clear contracts and consistent outputs.
## Core Components
**System Prompt**: Role, persona, constraints, output format
**User Prompt**: Task, context, variables, examples
**Few-Shot Examples**: Input/output pairs demonstrating desired behavior
**Output Contract**: Strict format specification (JSON schema, Markdown structure)
**Style Rules**: Tone, verbosity, formatting preferences
**Guardrails**: Do's and don'ts, safety constraints
## System Prompt Template
````markdown
# System Prompt: Code Review Assistant
You are an expert code reviewer specializing in {language} and {framework}. Your role is to provide constructive, actionable feedback on code quality, best practices, and potential issues.
## Output Format
Provide your review in the following JSON structure:
```json
{
"summary": "Brief 1-2 sentence overview",
"issues": [
{
"severity": "critical|major|minor",
"line": number,
"message": "Description of the issue",
"suggestion": "How to fix it"
}
],
"strengths": ["List of positive aspects"],
"overall_score": 1-10
}
```
````
## Style Guidelines
- Be constructive and specific
- Cite line numbers for issues
- Provide actionable suggestions
- Balance criticism with praise
- Use professional, respectful tone
## Constraints
- Do NOT suggest unnecessary refactors
- Do focus on correctness, security, performance
- Do NOT be overly pedantic about style
- Do consider the context and project requirements
````
## User Prompt Template with Variables
```typescript
// prompt-templates/code-review.ts
export const codeReviewPrompt = (variables: {
language: string;
framework: string;
code: string;
context?: string;
}) => `
Please review the following ${variables.language} code:
${variables.context ? `Context: ${variables.context}\n` : ''}
\`\`\`${variables.language}
${variables.code}
\`\`\`
Provide a thorough code review following the output format specified in the system prompt.
`;
// Usage
const prompt = codeReviewPrompt({
language: 'typescript',
framework: 'React',
code: userSubmittedCode,
context: 'This is a production component for user authentication',
});
````
## Few-Shot Examples
````markdown
# Few-Shot Examples
## Example 1: Good Code
**Input:**
```typescript
function calculateTotal(items: Item[]): number {
return items.reduce((sum, item) => sum + item.price, 0);
}
```
````
**Output:**
```json
{
"summary": "Clean, type-safe implementation with no issues found.",
"issues": [],
"strengths": [
"Type safety with TypeScript",
"Functional approach with reduce",
"Clear, descriptive naming"
],
"overall_score": 9
}
```
## Example 2: Code with Issues
**Input:**
```typescript
function calc(arr) {
let total = 0;
for (var i = 0; i < arr.length; i++) {
total = total + arr[i].price;
}
return total;
}
```
**Output:**
```json
{
"summary": "Functional but has type safety and modern syntax issues.",
"issues": [
{
"severity": "major",
"line": 1,
"message": "Missing type annotations for parameters and return value",
"suggestion": "Add types: function calc(arr: Item[]): number"
},
{
"severity": "minor",
"line": 3,
"message": "Using 'var' instead of 'let' or 'const'",
"suggestion": "Replace 'var' with 'let': for (let i = 0; ...)"
}
],
"strengths": ["Logic is correct", "Handles empty array case"],
"overall_score": 6
}
```
````
## Output Contracts
```typescript
// Define strict output schema
import { z } from 'zod';
export const codeReviewSchema = z.object({
summary: z.string().min(10).max(200),
issues: z.array(z.object({
severity: z.enum(['critical', 'major', 'minor']),
line: z.number().int().positive(),
message: z.string(),
suggestion: z.string(),
})),
strengths: z.array(z.string()),
overall_score: z.number().int().min(1).max(10),
});
// Validate LLM output
export const parseCodeReview = (output: string) => {
try {
const parsed = JSON.parse(output);
return codeReviewSchema.parse(parsed);
} catch (error) {
throw new Error('Invalid code review output format');
}
};
````
## Template Variables
```typescript
export interface PromptVariables {
// Required
required_field: string;
// Optional with defaults
optional_field?: string;
// Constrained values
severity_level: "low" | "medium" | "high";
// Numeric with ranges
max_tokens: number; // 1-4096
}
export const buildPrompt = (vars: PromptVariables): string => {
// Validate variables
if (!vars.required_field) {
throw new Error("required_field is required");
}
// Set defaults
const optional = vars.optional_field ?? "default value";
// Build prompt
return `Task: ${vars.required_field}
Options: ${optional}
Severity: ${vars.severity_level}`;
};
```
## Style Rules
```markdown
## Tone Guidelines
- **Professional**: Formal language, no slang
- **Friendly**: Conversational but respectful
- **Technical**: Precise terminology, assume expertise
- **Educational**: Explain concepts, teach as you go
## Verbosity Levels
- **Concise**: 1-2 sentences, bullet points
- **Standard**: 1 paragraph per point
- **Detailed**: Full explanations with examples
- **Comprehensive**: Deep dive with references
## Formatting Preferences
- Use markdown headers for structure
- Bold important terms
- Code blocks for technical content
- Lists for enumeration
- Tables for comparisons
```
## Do's and Don'ts
```markdown
## Do's
✓ Provide specific, actionable feedback
✓ Include code examples when relevant
✓ Reference line numbers for issues
✓ Suggest concrete improvements
✓ Balance criticism with praise
✓ Consider context and constraints
## Don'ts
✗ Don't be vague ("this is bad")
✗ Don't suggest unnecessary rewrites
✗ Don't ignore security issues
✗ Don't be overly pedantic
✗ Don't assume unlimited resources
✗ Don't make assumptions without context
```
## Prompt Chaining
```typescript
// Multi-step prompts
export const chainedPrompts = {
step1_analyze: (code: string) => `
Analyze this code and identify potential issues:
${code}
List issues in JSON array format with severity and description.
`,
step2_suggest: (issues: Issue[]) => `
Given these code issues:
${JSON.stringify(issues)}
Provide detailed fix suggestions for each issue.
`,
step3_summarize: (suggestions: Suggestion[]) => `
Summarize these code review suggestions into a final report:
${JSON.stringify(suggestions)}
`,
};
// Execute chain
const issues = await llm(chainedPrompts.step1_analyze(code));
const suggestions = await llm(chainedPrompts.step2_suggest(issues));
const report = await llm(chainedPrompts.step3_summarize(suggestions));
```
## Version Control
```typescript
// Track prompt versions
export const PROMPT_VERSIONS = {
"v1.0": {
system: "Original system prompt...",
user: (vars) => `Original user prompt...`,
deprecated: false,
},
"v1.1": {
system: "Improved system prompt with better constraints...",
user: (vars) => `Updated user prompt...`,
deprecated: false,
changes: "Added JSON schema validation, improved examples",
},
"v1.0-deprecated": {
system: "...",
user: (vars) => `...`,
deprecated: true,
deprecation_reason: "Replaced by v1.1 with better output format",
},
};
// Use specific version
const prompt = PROMPT_VERSIONS["v1.1"];
```
## Testing Prompts
```typescript
// Test cases for prompt validation
const testCases = [
{
input: { code: "function test() {}", language: "javascript" },
expected: {
hasIssues: false,
scoreRange: [8, 10],
},
},
{
input: { code: "func test(arr) { return arr[0] }", language: "javascript" },
expected: {
hasIssues: true,
minIssues: 2,
severities: ["major", "minor"],
},
},
];
// Run tests
for (const test of testCases) {
const output = await llm(buRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.