返回 Skill 列表
extension
分类: AI Agent 能力无需 API Key

libprompt

libprompt - 使用Mustache进行提示模板管理。PromptLoader从目录中加载.prompt.md文件,并通过变量替换来渲染它们。用于管理LLM系统提示、创建可重用的提示模板以及动态生成提示。

person作者: jakexiaohubgithub

libprompt Skill

When to Use

  • Managing LLM system prompts as templates
  • Loading prompt files from directories
  • Rendering prompts with dynamic variables
  • Organizing prompts for different agents

Key Concepts

PromptLoader: Loads .prompt.md files from a directory and renders them using Mustache templating syntax.

Mustache templating: Use {{variable}} syntax for dynamic content insertion.

Usage Patterns

Pattern 1: Load and render prompt

import { PromptLoader } from "@copilot-ld/libprompt";

const loader = new PromptLoader("./prompts");
const systemPrompt = await loader.render("system", {
  agentName: "Assistant",
  capabilities: ["search", "calculate"],
});

Pattern 2: Prompt file structure

<!-- prompts/system.prompt.md -->

You are {{agentName}}.

Your capabilities: {{#capabilities}}

- {{.}} {{/capabilities}}

Integration

Used by Memory service to load agent system prompts. Prompts stored in config/agents/*/prompts/.