aiconfig-projects

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LaunchDarkly Projects Setup

LaunchDarkly 项目设置

You're using a skill that will guide you through setting up LaunchDarkly project management in a codebase. Your job is to explore the codebase to understand the stack and patterns, assess what approach makes sense, choose the right implementation path from the references, execute the setup, and verify it works.
您正在使用的技能将引导您在代码库中完成LaunchDarkly项目管理的设置工作。您需要探索代码库以了解其技术栈和模式,评估合适的实现方案,从参考文档中选择正确的实施路径,执行设置操作并验证功能是否正常。

Prerequisites

前提条件

Choose one:
  • LaunchDarkly API access token with
    projects:write
    permission
  • LaunchDarkly MCP server configured in your environment
选择其中一项:
  • 拥有
    projects:write
    权限的LaunchDarkly API访问令牌
  • 环境中已配置LaunchDarkly MCP服务器

Core Principles

核心原则

  1. Understand First: Explore the codebase to understand the stack and patterns.
  2. Choose the Right Fit: Select an approach that matches your architecture.
  3. Follow Conventions: Respect existing code style and structure.
  4. Verify Integration: Confirm the setup works — the agent performs checks and reports results.
  1. 先理解再行动:探索代码库,了解其技术栈和模式。
  2. 选择适配方案:挑选与您的架构匹配的实现方式。
  3. 遵循既有规范:尊重现有代码的风格和结构。
  4. 验证集成效果:确认设置正常工作——Agent会执行检查并报告结果。

API Key Detection

API密钥自动检测

Before prompting the user for an API key, try to detect it automatically:
  1. Check environment variables — Look for
    LAUNCHDARKLY_API_KEY
    ,
    LAUNCHDARKLY_API_TOKEN
    , or
    LD_API_KEY
  2. Check MCP config — If using Claude, read
    ~/.claude/config.json
    for
    mcpServers.launchdarkly.env.LAUNCHDARKLY_API_KEY
  3. Prompt user — Only if detection fails, ask the user for their API key
See Quick Start for API usage patterns.
在向用户请求API密钥之前,先尝试自动检测:
  1. 检查环境变量 — 查找
    LAUNCHDARKLY_API_KEY
    LAUNCHDARKLY_API_TOKEN
    LD_API_KEY
  2. 检查MCP配置 — 如果使用Claude,读取
    ~/.claude/config.json
    中的
    mcpServers.launchdarkly.env.LAUNCHDARKLY_API_KEY
  3. 向用户请求 — 仅当自动检测失败时,再向用户索要API密钥
有关API使用模式,请参阅快速入门

What Are Projects?

什么是Projects?

Projects are LaunchDarkly's top-level organizational containers that hold:
  • All your AI Configs
  • Feature flags and segments
  • Multiple environments (Production and Test created by default)
Think of projects as separate applications, services, or teams that need their own isolated set of configurations.
Projects是LaunchDarkly的顶级组织容器,包含:
  • 所有AI配置
  • 功能标志和用户分群
  • 多套环境(默认创建生产环境和测试环境)
可以将Projects理解为独立的应用、服务或团队,它们需要各自独立的配置集合。

Project Setup Workflow

项目设置流程

Step 1: Explore the Codebase

步骤1:探索代码库

Before implementing anything, understand the existing architecture:
  1. Identify the tech stack:
    • What language(s)? (Python, Node.js, Go, Java, etc.)
    • What framework(s)? (FastAPI, Express, Spring Boot, etc.)
    • Is there an existing LaunchDarkly integration?
  2. Check environment management:
    • How are environment variables stored? (.env files, secrets manager, config files)
    • Where is configuration loaded? (startup scripts, config modules)
    • Are there existing LaunchDarkly SDK keys?
  3. Look for patterns:
    • Are there existing API clients or service modules?
    • How is external API integration typically done?
    • Is there a CLI, scripts directory, or admin tooling?
  4. Understand the use case:
    • Is this a new project being set up?
    • Adding to an existing LaunchDarkly integration?
    • Part of a multi-service architecture?
    • Need for project cloning across regions/teams?
在实施任何操作之前,先了解现有架构:
  1. 识别技术栈:
    • 使用的编程语言?(Python、Node.js、Go、Java等)
    • 使用的框架?(FastAPI、Express、Spring Boot等)
    • 是否已有LaunchDarkly集成?
  2. 检查环境管理方式:
    • 环境变量如何存储?(.env文件、密钥管理器、配置文件)
    • 配置在哪里加载?(启动脚本、配置模块)
    • 是否已有LaunchDarkly SDK密钥?
  3. 寻找现有模式:
    • 是否已有API客户端或服务模块?
    • 外部API集成通常采用什么方式?
    • 是否有CLI、脚本目录或管理工具?
  4. 明确使用场景:
    • 这是一个全新的项目设置吗?
    • 是在现有LaunchDarkly集成基础上添加功能吗?
    • 属于多服务架构的一部分吗?
    • 需要跨区域/团队克隆项目吗?

Step 2: Assess the Situation

步骤2:评估现状

Based on your exploration, determine the right approach:
ScenarioRecommended Path
New project, no LaunchDarkly integrationQuick Setup - Create project and save SDK keys
Existing LaunchDarkly usageAdd to Existing - Create new project or use existing
Multiple services/microservicesMulti-Project - Create projects per service
Multi-region or multi-tenantProject Cloning - Clone template project
Infrastructure-as-Code (IaC) setupAutomated Setup - Script-based creation
Need project management toolingCLI/Admin Tools - Build project management utilities
基于探索结果,确定合适的实现方案:
场景推荐方案
新项目,无LaunchDarkly集成快速设置 - 创建项目并保存SDK密钥
已有LaunchDarkly使用经验集成到现有体系 - 创建新项目或使用现有项目
多服务/微服务架构多项目模式 - 为每个服务创建独立项目
多区域或多租户场景项目克隆 - 克隆模板项目
基础设施即代码(IaC)环境自动化设置 - 基于脚本的项目创建
需要项目管理工具CLI/管理工具 - 构建项目管理实用程序

Step 3: Choose Your Implementation Path

步骤3:选择实施路径

Select the reference guide that matches your stack and use case:
By Language/Stack:
  • Python Implementation - For Python applications (FastAPI, Django, Flask)
  • Node.js/TypeScript Implementation - For Node.js/Express/NestJS applications
  • Go Implementation - For Go services
  • Multi-Language Setup - For polyglot architectures
By Use Case:
  • Quick Start - Create first project and get SDK keys
  • Environment Configuration - Save SDK keys to .env, secrets, or config
  • Project Cloning - Clone projects for regions/teams
  • IaC/Automation - Terraform, scripts, CI/CD integration
  • Admin Tooling - Build CLI or admin utilities
选择与您的技术栈和使用场景匹配的参考指南:
按语言/技术栈分类:
  • Python 实现 - 适用于Python应用(FastAPI、Django、Flask)
  • Node.js/TypeScript 实现 - 适用于Node.js/Express/NestJS应用
  • Go 实现 - 适用于Go服务
  • 多语言设置 - 适用于多语言架构
按使用场景分类:
  • 快速入门 - 创建首个项目并获取SDK密钥
  • 环境配置 - 将SDK密钥保存到.env、密钥管理器或配置文件
  • 项目克隆 - 为不同区域/团队克隆项目
  • IaC/自动化 - Terraform、脚本、CI/CD集成
  • 管理工具 - 构建CLI或管理实用程序

Step 4: Implement the Integration

步骤4:实施集成

Follow the chosen reference guide to implement project management. Key considerations:
  1. API Authentication:
    • Store API token securely
    • Follow existing secrets management patterns
    • Never commit tokens to version control
  2. Project Naming:
    • Use consistent, descriptive names
    • Follow existing naming conventions
    • Project keys: lowercase, hyphens, start with letter
  3. SDK Key Management:
    • Extract and store SDK keys for each environment
    • Use the same pattern as other secrets in your codebase
    • Consider separate keys for test/staging/production
  4. Error Handling:
    • Handle existing projects gracefully (409 conflict)
    • Provide clear error messages
    • Don't fail silently
遵循选定的参考指南完成项目管理集成。关键注意事项:
  1. API认证:
    • 安全存储API令牌
    • 遵循现有密钥管理模式
    • 绝对不要将令牌提交到版本控制系统
  2. 项目命名:
    • 使用一致且具有描述性的名称
    • 遵循现有命名规范
    • 项目密钥:小写、连字符分隔、以字母开头
  3. SDK密钥管理:
    • 提取并存储每个环境的SDK密钥
    • 使用与代码库中其他密钥相同的管理模式
    • 考虑为测试/预发布/生产环境使用独立密钥
  4. 错误处理:
    • 优雅处理项目已存在的情况(409冲突)
    • 提供清晰的错误信息
    • 不要静默失败

Step 5: Verify the Setup

步骤5:验证设置

After creating the project, verify it works:
  1. Fetch via API to confirm it exists:
    bash
    curl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}?expand=environments" \
      -H "Authorization: {api_token}"
    Confirm the response includes the project, environments, and SDK keys.
  2. Test SDK integration: Run a quick verification to ensure the SDK key works:
    python
    from ldclient import set_config, Config
    set_config(Config("{sdk_key}"))
    # SDK initializes successfully
  3. Report results:
    • ✓ Project exists and has environments
    • ✓ SDK keys are present and valid
    • ✓ SDK can initialize (or flag any issues)
创建项目后,验证其功能是否正常:
  1. 通过API获取项目信息以确认其存在:
    bash
    curl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}?expand=environments" \
      -H "Authorization: {api_token}"
    确认响应包含项目、环境和SDK密钥信息。
  2. 测试SDK集成: 运行快速验证以确保SDK密钥有效:
    python
    from ldclient import set_config, Config
    set_config(Config("{sdk_key}"))
    # SDK初始化成功
  3. 报告结果:
    • ✓ 项目存在且包含对应环境
    • ✓ SDK密钥存在且有效
    • ✓ SDK可以成功初始化(或标记所有问题)

Project Key Best Practices

项目密钥最佳实践

Project keys must follow these rules:
✓ Good examples:
  - "support-ai"
  - "chat-bot-v2"
  - "internal-tools"

✗ Bad examples:
  - "Support_AI"     # No uppercase or underscores
  - "123-project"    # Must start with letter  
  - "my.project"     # No dots allowed
Naming Recommendations:
  • Keep keys short but descriptive
  • Use team/service/purpose as naming scheme
  • Be consistent across your organization
项目密钥必须遵循以下规则:
✓ 良好示例:
  - "support-ai"
  - "chat-bot-v2"
  - "internal-tools"

✗ 不良示例:
  - "Support_AI"     # 不允许大写或下划线
  - "123-project"    # 必须以字母开头  
  - "my.project"     # 不允许使用点号
命名建议:
  • 保持密钥简短但具有描述性
  • 采用团队/服务/用途的命名方案
  • 在整个组织内保持一致性

Common Organization Patterns

常见组织模式

By Team

按团队划分

platform-ai       → Platform Team AI
customer-ai       → Customer Success Team AI
internal-ai       → Internal Tools Team AI
platform-ai       → 平台团队AI
customer-ai       → 客户成功团队AI
internal-ai       → 内部工具团队AI

By Application/Service

按应用/服务划分

mobile-ai         → Mobile App AI Configs
web-ai            → Web App AI Configs
api-ai            → API Service AI Configs
mobile-ai         → 移动应用AI配置
web-ai            → 网页应用AI配置
api-ai            → API服务AI配置

By Region/Deployment

按区域/部署环境划分

ai-us             → US Region
ai-eu             → Europe Region
ai-apac           → Asia-Pacific Region
ai-us             → 美国区域
ai-eu             → 欧洲区域
ai-apac           → 亚太区域

Edge Cases

边缘情况处理

SituationAction
Project already existsCheck if it's the right one; use it or create with different key
Need multiple projectsCreate separately for each service/region/team
Shared configs across servicesUse same project, separate by SDK context
Token lacks permissionsRequest
projects:write
or use MCP server
Project name conflictKeys must be unique, names can be similar
场景处理方式
项目已存在检查是否为目标项目;直接使用或创建不同密钥的新项目
需要多个项目为每个服务/区域/团队分别创建项目
服务间共享配置使用同一个项目,通过SDK上下文区分
令牌权限不足申请
projects:write
权限或使用MCP服务器
项目名称冲突密钥必须唯一,名称可以相似

What NOT to Do

禁止操作

  • Don't create projects without understanding the use case first
  • Don't commit API tokens or SDK keys to version control
  • Don't use production SDK keys in test/development environments
  • Don't create duplicate projects unnecessarily
  • Don't skip the exploration phase
  • 不要在未明确使用场景的情况下创建项目
  • 不要将API令牌或SDK密钥提交到版本控制系统
  • 不要在测试/开发环境中使用生产环境SDK密钥
  • 不要不必要地创建重复项目
  • 不要跳过探索阶段

Next Steps

后续步骤

After setting up projects:
  1. Create AI Configs - Use the
    aiconfig-create
    skill
  2. Set up SDK Integration - Use the
    aiconfig-sdk
    skill
  3. Configure Targeting - Use the
    aiconfig-targeting
    skill
完成项目设置后:
  1. 创建AI配置 - 使用
    aiconfig-create
    技能
  2. 设置SDK集成 - 使用
    aiconfig-sdk
    技能
  3. 配置目标定位 - 使用
    aiconfig-targeting
    技能

Related Skills

相关技能

  • aiconfig-create
    - Create AI Configs in projects
  • aiconfig-sdk
    - Integrate SDK in your application
  • aiconfig-targeting
    - Configure AI Config targeting
  • aiconfig-variations
    - Manage config variations
  • aiconfig-create
    - 在项目中创建AI配置
  • aiconfig-sdk
    - 在应用中集成SDK
  • aiconfig-targeting
    - 配置AI目标定位
  • aiconfig-variations
    - 管理配置变体

References

参考文档

  • Python Implementation
  • Node.js Implementation
  • Go Implementation
  • Quick Start Guide
  • Environment Configuration
  • Project Cloning
  • IaC/Automation
  • Admin Tooling
  • Python 实现
  • Node.js 实现
  • Go 实现
  • 快速入门指南
  • 环境配置
  • 项目克隆
  • IaC/自动化
  • 管理工具