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.
- 先理解再行动:探索代码库以了解技术栈和模式。
- 选择适配方案:选择与您架构匹配的方法。
- 遵循约定:尊重现有代码风格和结构。
- 验证集成效果:确认设置正常工作:代理执行检查并报告结果。
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 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:
-
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 to confirm it exists. Prefer the MCPtool over raw
get-project— it returns a typed object you can inspect directly. If you must call the REST API:curlbashcurl -X GET "https://app.launchdarkly.com/api/v2/projects/{projectKey}?expand=environments" \ -H "Authorization: {api_token}"Do not pipe the response straight into a-style.environments.items[]filter. The shape ofjqvaries byenvironmentsparameter — sometimes it'sexpand, sometimes a bare array — and a hand-rolled filter will fail with{items: [...]}. RunCannot index array with string "items"first to inspect the actual shape, or usejq -e .to handle both.jq '.environments | if type == "object" then .items else . end' -
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() -
Report results:
- ✓ Project exists and has environments
- ✓ SDK keys are present and valid
- ✓ SDK can initialize (or flag any issues)
创建项目后,验证其是否正常工作:
-
获取项目信息确认其存在。优先使用MCP的工具而非原生
get-project——它会返回一个可直接查看的类型化对象。如果必须调用REST API:curlbashcurl -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' -
测试SDK集成: 运行快速验证以确保SDK密钥有效:python
import ldclient from ldclient.config import Config ldclient.set_config(Config("{sdk_key}")) # SDK初始化成功 # 关闭前务必刷新事件——否则在短期脚本和长期服务中,末尾的事件都有可能丢失。 ldclient.get().flush() ldclient.get().close() -
报告结果:
- ✓ 项目存在且包含环境
- ✓ 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 Agent
customer-ai → Customer Success Team Agent
internal-ai → Internal Tools Team Agentplatform-ai → 平台团队代理
customer-ai → 客户成功团队代理
internal-ai → 内部工具团队代理By Application/Service
按应用/服务划分
mobile-ai → Mobile App configs
web-ai → Web App configs
api-ai → API Service configsmobile-ai → 移动应用配置
web-ai → Web应用配置
api-ai → API服务配置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 configs - Use the skill
configs-create - Set up SDK Integration - Use the skill
sdk - Configure Targeting - Use the skill
configs-targeting
设置项目后:
- 创建配置 - 使用技能
configs-create - 设置SDK集成 - 使用技能
sdk - 配置目标定位 - 使用技能
configs-targeting
Related Skills
相关技能
- - Create configs in projects
configs-create - - Integrate SDK in your application
sdk - - Configure config targeting
configs-targeting - - Manage config variations
configs-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/自动化
- 管理工具