Promptfmt
Description
A composable prompt formatting library with runtime parameter substitution and conditional logic
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
README
promptfmt
A composable prompt formatting library with runtime parameter substitution and conditional logic.
Features
- Component-based architecture: Build prompts from composable components (role, goal, input, output, context, persona, tone, few-shots, guardrails, constraints, tasks, steps)
- Runtime parameter substitution: Use template strings with
${paramName}syntax - Conditional logic: Include/exclude components based on runtime conditions
- Fluent API: Chain methods for intuitive prompt building
- Type-safe: Full TypeScript support
Installation
npm install promptfmt
Quick Start
import { PromptBuilder, createCondition } from 'promptfmt';
const prompt = new PromptBuilder()
.role('You are a wise numerology guide')
.goal('Generate a numerology interpretation for ${userName}')
.input({
name: '${userName}',
birthday: '${birthday}',
numberType: '${numberType}',
numberValue: '${numberValue}'
})
.persona((params) => {
if (params.age > 10) {
return 'The Steady Anchor persona';
}
return 'The Clear Mirror persona';
})
.output('Write ${maxSentences} sentences')
.constraints('Do not include predictions')
.build({
userName: 'John',
birthday: '1990-01-01',
numberType: 'lifePath',
numberValue: 5,
age: 34,
maxSentences: 10
});
Component Types
Role
Defines the AI's role/identity.
builder.role('You are a helpful assistant');
Goal
Defines the objective of the prompt.
builder.goal('Answer user questions');
Input
Defines input data/parameters. Can accept strings or objects.
// String format
builder.input('Question: ${question}');
// Object format (auto-formatted with "- key: value")
builder.input({
name: '${userName}',
age: '${age}',
metadata: { key: 'value' } // Non-string values are JSON.stringify'd
});
// Results in:
// "- name: John
// - age: 25
// - meta
Related Skills
Awesome Go
A curated list of awesome Go frameworks, libraries and software
Development next.js
| The React Framework | 138360 | 1503 | 1 |
Development sharing-skills
skill for guidance.
Development root-cause-tracing
Use when errors occur deep in execution and you need to trace back to find the original trigger.
Development Template Skill
Minimal skeleton for a new skill project structure.
Development Third-party Notices
THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THI
Development