aiconfig-snippets

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AI Config Prompt Snippets

AI Config Prompt Snippets

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-prompt-snippet
    -- create a new reusable text block
  • list-prompt-snippets
    -- browse existing snippets in the project
  • get-prompt-snippet
    -- inspect a specific snippet's content
Optional MCP tools:
  • update-prompt-snippet
    -- edit a snippet's text, name, or tags
  • delete-prompt-snippet
    -- permanently remove a snippet
  • update-ai-config-variation
    -- update variation prompts to reference snippets
使用此技能需要在你的环境中配置远程托管的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

何时使用片段

ScenarioExample
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 knowledgeCompany-specific terminology, product names, or process descriptions
Regulatory textCompliance disclaimers that must appear in every response
场景示例
共享角色设定被5个不同配置使用的“你是Acme Corp的友好客户支持Agent...”
安全准则“绝不透露内部定价。绝不生成访问生产数据库的代码。”
输出格式“始终以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

核心原则

  1. Reusability First: Only create a snippet if the text will be used in 2+ places
  2. Single Responsibility: Each snippet should cover one concern (persona OR guardrails, not both)
  3. Descriptive Keys: Use keys like
    safety-guardrails
    ,
    json-output-format
    ,
    support-persona
  4. Tag for Discovery: Add tags so teammates can find snippets by category
  5. Verify References: After creating a snippet, confirm it appears in the project
  1. 重用优先:仅当文本将在2个及以上位置使用时才创建片段
  2. 单一职责:每个片段应仅覆盖一个关注点(角色设定或安全准则,而非两者兼而有之)
  3. 描述性键名:使用类似
    safety-guardrails
    json-output-format
    support-persona
    的键名
  4. 标签便于发现:添加标签以便团队成员按类别查找片段
  5. 验证引用:创建片段后,确认它已出现在项目中

Workflow

工作流程

Step 1: Identify Reusable Text

步骤1:识别可重用文本

Before creating snippets, understand what's shared:
  1. List existing AI Configs in the project using
    get-ai-config
    for each
  2. Look for repeated text across variation prompts
  3. Identify text that should stay consistent (guardrails, personas, formats)
  4. Check existing snippets with
    list-prompt-snippets
    to avoid duplicates
创建片段之前,先明确哪些内容是共享的:
  1. 使用
    get-ai-config
    列出项目中的所有现有AI Config
  2. 查找变体提示中重复出现的文本
  3. 识别需要保持一致的文本(安全准则、角色设定、格式)
  4. 使用
    list-prompt-snippets
    检查现有片段,避免重复

Step 2: Create Snippets

步骤2:创建片段

Use
create-prompt-snippet
with:
  • key
    -- unique identifier (lowercase, hyphens, e.g.
    safety-guardrails
    )
  • name
    -- human-readable display name
  • text
    -- the reusable prompt text content
  • description
    (optional) -- explain when/why to use this snippet
  • tags
    (optional) -- categorize for discovery (e.g.
    ["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:验证

  1. Use
    get-prompt-snippet
    to confirm the snippet was created with the correct text
  2. Use
    list-prompt-snippets
    to see it in the project listing
  3. Check that version is 1 for newly created snippets
Report results:
  • Snippet created with key, name, and text
  • Version number confirmed
  • Tags applied correctly
  1. 使用
    get-prompt-snippet
    确认片段已创建且文本正确
  2. 使用
    list-prompt-snippets
    查看它是否出现在项目列表中
  3. 确认新创建的片段版本为1
报告结果:
  • 已创建包含指定键名、名称和文本的片段
  • 版本号已确认
  • 标签已正确应用

Step 4: Update Snippets (When Needed)

步骤4:更新片段(必要时)

Use
update-prompt-snippet
to modify an existing snippet. Only pass the fields you want to change:
json
{
  "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-snippet
修改现有片段。仅传递需要更改的字段:
json
{
  "projectKey": "my-project",
  "snippetKey": "safety-guardrails",
  "text": "Updated guardrail text with new compliance requirements..."
}
每次更新都会创建一个新版本。引用该片段的现有AI Config变体可以获取新版本。

Edge Cases

边缘情况

SituationAction
Snippet key already existsUse
get-prompt-snippet
to check, then either update or choose a different key
Very long textSnippets can hold large blocks — but consider splitting into multiple snippets for modularity
Snippet referenced by configsUpdate carefully — changes propagate to all referencing configs
Deleting a referenced snippetWarn the user that configs will lose the reference. Use
delete-prompt-snippet
with
confirm: true
情况操作
片段键名已存在使用
get-prompt-snippet
检查,然后选择更新或更换键名
文本过长片段可以容纳大文本块——但考虑拆分为多个片段以实现模块化
片段被配置引用更新时需谨慎——更改会传播到所有引用该片段的配置
删除被引用的片段提醒用户配置将丢失引用。使用
delete-prompt-snippet
并添加
confirm: true
参数

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
    list-prompt-snippets
    first
  • 不要为仅在一个位置使用的文本创建片段
  • 不要将完整提示放入单个片段中——拆分为多个聚焦的模块
  • 删除片段前不要忘记检查哪些配置引用了它
  • 不要重复创建现有片段——先使用
    list-prompt-snippets
    检查