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. 验证集成效果:确认设置正常工作:代理执行检查并报告结果。

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 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的顶级组织容器,包含:
  • 所有配置项
  • 功能旗标和用户分群
  • 多个环境(默认创建生产和测试环境)
可以将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 to confirm it exists. Prefer the MCP
    get-project
    tool over raw
    curl
    — it returns a typed object you can inspect directly. If you must call the REST API:
    bash
    curl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}?expand=environments" \
      -H "Authorization: {api_token}"
    Do not pipe the response straight into a
    .environments.items[]
    -style
    jq
    filter.
    The shape of
    environments
    varies by
    expand
    parameter — sometimes it's
    {items: [...]}
    , sometimes a bare array — and a hand-rolled filter will fail with
    Cannot index array with string "items"
    . Run
    jq -e .
    first to inspect the actual shape, or use
    jq '.environments | if type == "object" then .items else . end'
    to handle both.
  2. Test SDK integration: Run a quick verification to ensure the SDK key works:
    python
    import ldclient
    from ldclient.config import Config
    
    ldclient.set_config(Config("{sdk_key}"))
    # SDK initializes successfully
    
    # Always flush events before closing — trailing events are at risk of being
    # lost otherwise, in short-lived scripts and long-running services alike.
    ldclient.get().flush()
    ldclient.get().close()
  3. Report results:
    • ✓ Project exists and has environments
    • ✓ SDK keys are present and valid
    • ✓ SDK can initialize (or flag any issues)
创建项目后,验证其是否正常工作:
  1. 获取项目信息确认其存在。优先使用MCP的
    get-project
    工具而非原生
    curl
    ——它会返回一个可直接查看的类型化对象。如果必须调用REST API:
    bash
    curl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}?expand=environments" \
      -H "Authorization: {api_token}"
    不要直接将响应传入
    .environments.items[]
    风格的
    jq
    过滤器
    environments
    的结构会因
    expand
    参数而异——有时是
    {items: [...]}
    , 有时是裸数组——手动编写的过滤器会因
    Cannot index array with string "items"
    而失败。先运行
    jq -e .
    检查实际结构,或使用
    jq '.environments | if type == "object" then .items else . end'
    来处理两种情况。
  2. 测试SDK集成: 运行快速验证以确保SDK密钥有效:
    python
    import ldclient
    from ldclient.config import Config
    
    ldclient.set_config(Config("{sdk_key}"))
    # SDK初始化成功
    
    # 关闭前务必刷新事件——否则在短期脚本和长期服务中,末尾的事件都有可能丢失。
    ldclient.get().flush()
    ldclient.get().close()
  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 Agent
customer-ai       → Customer Success Team Agent
internal-ai       → Internal Tools Team Agent
platform-ai       → 平台团队代理
customer-ai       → 客户成功团队代理
internal-ai       → 内部工具团队代理

By Application/Service

按应用/服务划分

mobile-ai         → Mobile App configs
web-ai            → Web App configs
api-ai            → API Service configs
mobile-ai         → 移动应用配置
web-ai            → Web应用配置
api-ai            → API服务配置

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 configs - Use the
    configs-create
    skill
  2. Set up SDK Integration - Use the
    sdk
    skill
  3. Configure Targeting - Use the
    configs-targeting
    skill
设置项目后:
  1. 创建配置 - 使用
    configs-create
    技能
  2. 设置SDK集成 - 使用
    sdk
    技能
  3. 配置目标定位 - 使用
    configs-targeting
    技能

Related Skills

相关技能

  • configs-create
    - Create configs in projects
  • sdk
    - Integrate SDK in your application
  • configs-targeting
    - Configure config targeting
  • configs-variations
    - Manage config variations
  • configs-create
    - 在项目中创建配置
  • sdk
    - 在应用中集成SDK
  • configs-targeting
    - 配置目标定位
  • configs-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/自动化
  • 管理工具