aiconfig-projects
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLaunchDarkly 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 permission
projects:write - LaunchDarkly MCP server configured in your environment
选择其中一项:
- 拥有权限的LaunchDarkly API访问令牌
projects:write - 环境中已配置LaunchDarkly MCP服务器
Core Principles
核心原则
- Understand First: Explore the codebase to understand the stack and patterns.
- Choose the Right Fit: Select an approach that matches your architecture.
- Follow Conventions: Respect existing code style and structure.
- Verify Integration: Confirm the setup works — the agent performs checks and reports results.
- 先理解再行动:探索代码库,了解其技术栈和模式。
- 选择适配方案:挑选与您的架构匹配的实现方式。
- 遵循既有规范:尊重现有代码的风格和结构。
- 验证集成效果:确认设置正常工作——Agent会执行检查并报告结果。
API Key Detection
API密钥自动检测
Before prompting the user for an API key, try to detect it automatically:
- Check environment variables — Look for ,
LAUNCHDARKLY_API_KEY, orLAUNCHDARKLY_API_TOKENLD_API_KEY - Check MCP config — If using Claude, read for
~/.claude/config.jsonmcpServers.launchdarkly.env.LAUNCHDARKLY_API_KEY - Prompt user — Only if detection fails, ask the user for their API key
See Quick Start for API usage patterns.
在向用户请求API密钥之前,先尝试自动检测:
- 检查环境变量 — 查找、
LAUNCHDARKLY_API_KEY或LAUNCHDARKLY_API_TOKENLD_API_KEY - 检查MCP配置 — 如果使用Claude,读取中的
~/.claude/config.jsonmcpServers.launchdarkly.env.LAUNCHDARKLY_API_KEY - 向用户请求 — 仅当自动检测失败时,再向用户索要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:
-
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?
-
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?
-
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?
-
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?
在实施任何操作之前,先了解现有架构:
-
识别技术栈:
- 使用的编程语言?(Python、Node.js、Go、Java等)
- 使用的框架?(FastAPI、Express、Spring Boot等)
- 是否已有LaunchDarkly集成?
-
检查环境管理方式:
- 环境变量如何存储?(.env文件、密钥管理器、配置文件)
- 配置在哪里加载?(启动脚本、配置模块)
- 是否已有LaunchDarkly SDK密钥?
-
寻找现有模式:
- 是否已有API客户端或服务模块?
- 外部API集成通常采用什么方式?
- 是否有CLI、脚本目录或管理工具?
-
明确使用场景:
- 这是一个全新的项目设置吗?
- 是在现有LaunchDarkly集成基础上添加功能吗?
- 属于多服务架构的一部分吗?
- 需要跨区域/团队克隆项目吗?
Step 2: Assess the Situation
步骤2:评估现状
Based on your exploration, determine the right approach:
| Scenario | Recommended Path |
|---|---|
| New project, no LaunchDarkly integration | Quick Setup - Create project and save SDK keys |
| Existing LaunchDarkly usage | Add to Existing - Create new project or use existing |
| Multiple services/microservices | Multi-Project - Create projects per service |
| Multi-region or multi-tenant | Project Cloning - Clone template project |
| Infrastructure-as-Code (IaC) setup | Automated Setup - Script-based creation |
| Need project management tooling | CLI/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:
-
API Authentication:
- Store API token securely
- Follow existing secrets management patterns
- Never commit tokens to version control
-
Project Naming:
- Use consistent, descriptive names
- Follow existing naming conventions
- Project keys: lowercase, hyphens, start with letter
-
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
-
Error Handling:
- Handle existing projects gracefully (409 conflict)
- Provide clear error messages
- Don't fail silently
遵循选定的参考指南完成项目管理集成。关键注意事项:
-
API认证:
- 安全存储API令牌
- 遵循现有密钥管理模式
- 绝对不要将令牌提交到版本控制系统
-
项目命名:
- 使用一致且具有描述性的名称
- 遵循现有命名规范
- 项目密钥:小写、连字符分隔、以字母开头
-
SDK密钥管理:
- 提取并存储每个环境的SDK密钥
- 使用与代码库中其他密钥相同的管理模式
- 考虑为测试/预发布/生产环境使用独立密钥
-
错误处理:
- 优雅处理项目已存在的情况(409冲突)
- 提供清晰的错误信息
- 不要静默失败
Step 5: Verify the Setup
步骤5:验证设置
After creating the project, verify it works:
-
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. -
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 -
Report results:
- ✓ Project exists and has environments
- ✓ SDK keys are present and valid
- ✓ SDK can initialize (or flag any issues)
创建项目后,验证其功能是否正常:
-
通过API获取项目信息以确认其存在:bash
curl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}?expand=environments" \ -H "Authorization: {api_token}"确认响应包含项目、环境和SDK密钥信息。 -
测试SDK集成: 运行快速验证以确保SDK密钥有效:python
from ldclient import set_config, Config set_config(Config("{sdk_key}")) # SDK初始化成功 -
报告结果:
- ✓ 项目存在且包含对应环境
- ✓ 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 allowedNaming 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 AIplatform-ai → 平台团队AI
customer-ai → 客户成功团队AI
internal-ai → 内部工具团队AIBy Application/Service
按应用/服务划分
mobile-ai → Mobile App AI Configs
web-ai → Web App AI Configs
api-ai → API Service AI Configsmobile-ai → 移动应用AI配置
web-ai → 网页应用AI配置
api-ai → API服务AI配置By Region/Deployment
按区域/部署环境划分
ai-us → US Region
ai-eu → Europe Region
ai-apac → Asia-Pacific Regionai-us → 美国区域
ai-eu → 欧洲区域
ai-apac → 亚太区域Edge Cases
边缘情况处理
| Situation | Action |
|---|---|
| Project already exists | Check if it's the right one; use it or create with different key |
| Need multiple projects | Create separately for each service/region/team |
| Shared configs across services | Use same project, separate by SDK context |
| Token lacks permissions | Request |
| Project name conflict | Keys must be unique, names can be similar |
| 场景 | 处理方式 |
|---|---|
| 项目已存在 | 检查是否为目标项目;直接使用或创建不同密钥的新项目 |
| 需要多个项目 | 为每个服务/区域/团队分别创建项目 |
| 服务间共享配置 | 使用同一个项目,通过SDK上下文区分 |
| 令牌权限不足 | 申请 |
| 项目名称冲突 | 密钥必须唯一,名称可以相似 |
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:
- Create AI Configs - Use the skill
aiconfig-create - Set up SDK Integration - Use the skill
aiconfig-sdk - Configure Targeting - Use the skill
aiconfig-targeting
完成项目设置后:
- 创建AI配置 - 使用技能
aiconfig-create - 设置SDK集成 - 使用技能
aiconfig-sdk - 配置目标定位 - 使用技能
aiconfig-targeting
Related Skills
相关技能
- - Create AI Configs in projects
aiconfig-create - - Integrate SDK in your application
aiconfig-sdk - - Configure AI Config targeting
aiconfig-targeting - - Manage config variations
aiconfig-variations
- - 在项目中创建AI配置
aiconfig-create - - 在应用中集成SDK
aiconfig-sdk - - 配置AI目标定位
aiconfig-targeting - - 管理配置变体
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/自动化
- 管理工具