snippets
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAI Config Prompt Snippets
AI Config 提示片段
You're using a skill that will guide you through creating and managing prompt snippets in LaunchDarkly. Your job is to identify reusable text, create snippets, reference them in AI Config variations, and verify everything is wired correctly.
你正在使用一项技能,它将引导你在LaunchDarkly中创建和管理提示片段。你的任务是识别可重用文本、创建片段、在AI Config变体中引用它们,并验证所有配置是否正确关联。
Prerequisites
前提条件
This skill requires the remotely hosted LaunchDarkly MCP server to be configured in your environment.
Required MCP tools:
- -- create a new reusable text block
create-prompt-snippet - -- browse existing snippets in the project
list-prompt-snippets - -- inspect a specific snippet's content
get-prompt-snippet
Optional MCP tools:
- -- edit a snippet's text, name, or tags
update-prompt-snippet - -- permanently remove a snippet
delete-prompt-snippet - -- update variation prompts to reference snippets
update-ai-config-variation
使用此技能需要在你的环境中配置远程托管的LaunchDarkly MCP服务器。
必备MCP工具:
- —— 创建新的可重用文本块
create-prompt-snippet - —— 浏览项目中已有的片段
list-prompt-snippets - —— 查看特定片段的内容
get-prompt-snippet
可选MCP工具:
- —— 编辑片段的文本、名称或标签
update-prompt-snippet - —— 永久删除片段
delete-prompt-snippet - —— 更新变体提示以引用片段
update-ai-config-variation
Core Concepts
核心概念
What Are Prompt Snippets?
什么是提示片段?
Prompt snippets are named, versioned text blocks stored at the project level. They contain reusable pieces of prompt text — personas, guardrails, output format instructions, domain knowledge — that can be shared across multiple AI Config variations.
When a snippet is updated, a new version is created. AI Config variations that reference the snippet can pick up the latest version, keeping all your configs in sync.
提示片段是存储在项目级别的命名、带版本的文本块。它们包含可重用的提示文本片段——角色设定、安全准则、输出格式指令、领域知识——可在多个AI Config变体之间共享。
当片段更新时,会创建一个新版本。引用该片段的AI Config变体可以获取最新版本,确保所有配置保持同步。
When to Use Snippets
何时使用片段
| Scenario | Example |
|---|---|
| Shared persona | "You are a helpful customer support agent for Acme Corp..." used by 5 different configs |
| Safety guardrails | "Never reveal internal pricing. Never generate code that accesses production databases." |
| Output format | "Always respond in JSON with keys: answer, confidence, sources." |
| Domain knowledge | Company-specific terminology, product names, or process descriptions |
| Regulatory text | Compliance disclaimers that must appear in every response |
| 场景 | 示例 |
|---|---|
| 共享角色设定 | "你是Acme Corp的贴心客户支持专员……" 被5个不同配置使用 |
| 安全准则 | "切勿透露内部定价。切勿生成访问生产数据库的代码。" |
| 输出格式 | "始终以JSON格式响应,包含键:answer、confidence、sources。" |
| 领域知识 | 公司特定术语、产品名称或流程描述 |
| 合规文本 | 必须出现在每个响应中的合规声明 |
When NOT to Use Snippets
何时不使用片段
- Text that is unique to a single variation — just put it in the prompt directly
- Dynamic content that changes per-request — use template variables instead
- Entire prompts — snippets are building blocks, not complete prompts
- 仅属于单个变体的文本——直接放入提示中即可
- 随请求变化的动态内容——改用模板变量
- 完整提示——片段是构建块,而非完整提示
Core Principles
核心原则
- Reusability First: Only create a snippet if the text will be used in 2+ places
- Single Responsibility: Each snippet should cover one concern (persona OR guardrails, not both)
- Descriptive Keys: Use keys like ,
safety-guardrails,json-output-formatsupport-persona - Tag for Discovery: Add tags so teammates can find snippets by category
- Verify References: After creating a snippet, confirm it appears in the project
- 重用优先:仅当文本会在2个及以上地方使用时才创建片段
- 单一职责:每个片段应仅覆盖一个关注点(角色设定或安全准则,不可两者兼具)
- 描述性键名:使用、
safety-guardrails、json-output-format这类键名support-persona - 标签便于发现:添加标签,方便团队成员按类别查找片段
- 验证引用:创建片段后,确认它已出现在项目中
Workflow
工作流程
Step 1: Identify Reusable Text
步骤1:识别可重用文本
Before creating snippets, understand what's shared:
- List existing AI Configs in the project using for each
get-ai-config - Look for repeated text across variation prompts
- Identify text that should stay consistent (guardrails, personas, formats)
- Check existing snippets with to avoid duplicates
list-prompt-snippets
创建片段前,先明确哪些内容是共享的:
- 使用列出项目中所有现有AI Config
get-ai-config - 查找变体提示中重复出现的文本
- 确定需要保持一致的文本(安全准则、角色设定、格式)
- 使用检查现有片段,避免重复
list-prompt-snippets
Step 2: Create Snippets
步骤2:创建片段
Use with:
create-prompt-snippet- -- unique identifier (lowercase, hyphens, e.g.
key)safety-guardrails - -- human-readable display name
name - -- the reusable prompt text content
text - (optional) -- explain when/why to use this snippet
description - (optional) -- categorize for discovery (e.g.
tags)["guardrails", "safety"]
json
{
"projectKey": "my-project",
"key": "support-persona",
"name": "Customer Support Persona",
"text": "You are a friendly, knowledgeable customer support agent for Acme Corp. Always greet the customer by name when available. Be empathetic but concise. If you don't know the answer, say so honestly and offer to escalate.",
"description": "Standard persona for all customer-facing support configs",
"tags": ["persona", "support"]
}使用时需提供以下参数:
create-prompt-snippet- —— 唯一标识符(小写、连字符分隔,例如
key)safety-guardrails - —— 便于阅读的显示名称
name - —— 可重用的提示文本内容
text - (可选)—— 说明何时/为何使用此片段
description - (可选)—— 分类以便查找(例如
tags)["guardrails", "safety"]
json
{
"projectKey": "my-project",
"key": "support-persona",
"name": "Customer Support Persona",
"text": "You are a friendly, knowledgeable customer support agent for Acme Corp. Always greet the customer by name when available. Be empathetic but concise. If you don't know the answer, say so honestly and offer to escalate.",
"description": "Standard persona for all customer-facing support configs",
"tags": ["persona", "support"]
}Step 3: Verify
步骤3:验证
- Use to confirm the snippet was created with the correct text
get-prompt-snippet - Use to see it in the project listing
list-prompt-snippets - Check that version is 1 for newly created snippets
Report results:
- Snippet created with key, name, and text
- Version number confirmed
- Tags applied correctly
- 使用确认片段已按正确文本创建
get-prompt-snippet - 使用确认它出现在项目列表中
list-prompt-snippets - 确认新建片段的版本为1
报告结果:
- 已创建包含指定键名、名称和文本的片段
- 版本号已确认
- 标签已正确添加
Step 4: Update Snippets (When Needed)
步骤4:更新片段(必要时)
Use to modify an existing snippet. Only pass the fields you want to change:
update-prompt-snippetjson
{
"projectKey": "my-project",
"snippetKey": "safety-guardrails",
"text": "Updated guardrail text with new compliance requirements..."
}Each update creates a new version. Existing AI Config variations referencing the snippet can pick up the new version.
使用修改现有片段。只需传入你想要更改的字段:
update-prompt-snippetjson
{
"projectKey": "my-project",
"snippetKey": "safety-guardrails",
"text": "Updated guardrail text with new compliance requirements..."
}每次更新都会创建一个新版本。引用该片段的现有AI Config变体可以获取新版本。
Edge Cases
边缘情况
| Situation | Action |
|---|---|
| Snippet key already exists | Use |
| Very long text | Snippets can hold large blocks — but consider splitting into multiple snippets for modularity |
| Snippet referenced by configs | Update carefully — changes propagate to all referencing configs |
| Deleting a referenced snippet | Warn the user that configs will lose the reference. Use |
| 情况 | 操作 |
|---|---|
| 片段键名已存在 | 使用 |
| 文本过长 | 片段可以容纳大段文本——但为了模块化,建议拆分为多个片段 |
| 片段被多个配置引用 | 更新时需谨慎——更改会同步到所有引用该片段的配置 |
| 删除被引用的片段 | 警告用户相关配置将丢失引用。使用 |
What NOT to Do
禁忌操作
- Don't create snippets for text used in only one place
- Don't put an entire prompt in a single snippet — break it into focused pieces
- Don't delete snippets without checking which configs reference them
- Don't duplicate existing snippets — check first
list-prompt-snippets
- 不要为仅在一处使用的文本创建片段
- 不要将完整提示放入单个片段中——拆分为多个专注的模块
- 未检查哪些配置引用该片段前,不要删除片段
- 不要重复创建现有片段——先使用检查
list-prompt-snippets