parallel-debug-orchestrator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseParallel Debug Orchestrator
并行调试编排器
Overview
概述
This skill provides guidance for debugging tasks using modern best practices and proven patterns.
本Skill为使用现代最佳实践和成熟模式完成调试任务提供指导。
When to Use This Skill
何时使用本Skill
Use this skill when:
- Working with debugging projects
- Implementing debugging-related features
- Following best practices for debugging
在以下场景使用本Skill:
- 处理调试项目时
- 实现与调试相关的功能时
- 遵循调试最佳实践时
Core Principles
核心原则
1. Follow Industry Standards
1. 遵循行业标准
Always adhere to established conventions and best practices
undefined始终遵守既定的规范和最佳实践
undefinedExample: Follow naming conventions and structure
示例:遵循命名规范和结构
Adapt this to your specific domain and language
根据你的特定领域和语言进行调整
undefinedundefined2. Prioritize Code Quality
2. 优先保证代码质量
Write clean, maintainable, and well-documented code
- Use consistent formatting and style
- Add meaningful comments for complex logic
- Follow SOLID principles where applicable
编写简洁、可维护且文档完善的代码
- 使用一致的格式和风格
- 为复杂逻辑添加有意义的注释
- 适用时遵循SOLID原则
3. Test-Driven Approach
3. 测试驱动方法
Write tests to validate functionality
- Unit tests for individual components
- Integration tests for system interactions
- End-to-end tests for critical workflows
编写测试以验证功能
- 针对单个组件的单元测试
- 针对系统交互的集成测试
- 针对关键工作流的端到端测试
Best Practices
最佳实践
Structure and Organization
结构与组织
- Organize code into logical modules and components
- Use clear and descriptive naming conventions
- Keep files focused on single responsibilities
- Limit file size to maintain readability (< 500 lines)
- 将代码组织为逻辑模块和组件
- 使用清晰且描述性的命名规范
- 保持文件聚焦于单一职责
- 限制文件大小以维持可读性(< 500行)
Error Handling
错误处理
- Implement comprehensive error handling
- Use specific exception types
- Provide actionable error messages
- Log errors with appropriate context
- 实现全面的错误处理
- 使用特定的异常类型
- 提供可操作的错误信息
- 记录带有适当上下文的错误
Performance Considerations
性能考量
- Optimize for readability first, performance second
- Profile before optimizing
- Use appropriate data structures and algorithms
- Consider memory usage for large datasets
- 首先优化可读性,其次是性能
- 先分析再优化
- 使用合适的数据结构和算法
- 考虑大型数据集的内存使用
Security
安全
- Validate all inputs
- Sanitize outputs to prevent injection
- Use secure defaults
- Keep dependencies updated
- 验证所有输入
- 清理输出以防止注入攻击
- 使用安全默认值
- 保持依赖项更新
Common Patterns
常见模式
Pattern 1: Configuration Management
模式1:配置管理
undefinedundefinedSeparate configuration from code
将配置与代码分离
Use environment variables for sensitive data
使用环境变量存储敏感数据
Provide sensible defaults
提供合理的默认值
undefinedundefinedPattern 2: Dependency Injection
模式2:依赖注入
undefinedundefinedInject dependencies rather than hardcoding
注入依赖而非硬编码
Makes code testable and flexible
使代码可测试且灵活
Reduces coupling between components
减少组件间的耦合
undefinedundefinedPattern 3: Error Recovery
模式3:错误恢复
undefinedundefinedImplement graceful degradation
实现优雅降级
Use retry logic with exponential backoff
使用带指数退避的重试逻辑
Provide fallback mechanisms where appropriate
适当时提供回退机制
undefinedundefinedAnti-Patterns
反模式
❌ Avoid: Hardcoded Values
❌ 避免:硬编码值
Don't hardcode configuration, credentials, or magic numbers
undefined不要硬编码配置、凭据或魔术数字
undefinedBAD: Hardcoded values
错误示例:硬编码值
API_TOKEN = "hardcoded-value-bad" # Never do this!
max_retries = 3
✅ **Instead: Use configuration management**
API_TOKEN = "hardcoded-value-bad" # 绝对不要这样做!
max_retries = 3
✅ **正确做法:使用配置管理**
GOOD: Configuration-driven
正确示例:由配置驱动
API_TOKEN = os.getenv("API_TOKEN") # Get from environment
max_retries = config.get("max_retries", 3)
undefinedAPI_TOKEN = os.getenv("API_TOKEN") # 从环境变量获取
max_retries = config.get("max_retries", 3)
undefined❌ Avoid: Silent Failures
❌ 避免:静默失败
Don't catch exceptions without logging or handling
undefined不要捕获异常却不记录或处理
undefinedBAD: Silent failure
错误示例:静默失败
try:
risky_operation()
except Exception:
pass
✅ **Instead: Explicit error handling**
try:
risky_operation()
except Exception:
pass
✅ **正确做法:显式错误处理**
GOOD: Explicit handling
正确示例:显式处理
try:
risky_operation()
except SpecificError as e:
logger.error(f"Operation failed: {e}")
raise
undefinedtry:
risky_operation()
except SpecificError as e:
logger.error(f"操作失败:{e}")
raise
undefined❌ Avoid: Premature Optimization
❌ 避免:过早优化
Don't optimize without measurements
✅ Instead: Profile first, then optimize
- Measure performance with realistic workloads
- Identify actual bottlenecks
- Optimize the critical paths only
- Validate improvements with benchmarks
不要在没有测量的情况下进行优化
✅ 正确做法:先分析,再优化
- 使用真实工作负载测量性能
- 识别实际瓶颈
- 仅优化关键路径
- 使用基准测试验证改进效果
Testing Strategy
测试策略
Unit Tests
单元测试
- Test individual functions and classes
- Mock external dependencies
- Cover edge cases and error conditions
- Aim for >80% code coverage
- 测试单个函数和类
- 模拟外部依赖
- 覆盖边缘情况和错误条件
- 目标是>80%的代码覆盖率
Integration Tests
集成测试
- Test component interactions
- Use test databases or services
- Validate data flow across boundaries
- Test error propagation
- 测试组件间的交互
- 使用测试数据库或服务
- 验证跨边界的数据流
- 测试错误传播
Best Practices for Tests
测试最佳实践
- Make tests independent and repeatable
- Use descriptive test names
- Follow AAA pattern: Arrange, Act, Assert
- Keep tests simple and focused
- 确保测试独立且可重复
- 使用描述性的测试名称
- 遵循AAA模式:准备(Arrange)、执行(Act)、断言(Assert)
- 保持测试简洁且聚焦
Debugging Techniques
调试技巧
Common Issues and Solutions
常见问题与解决方案
Issue: Unexpected behavior in production
Solution:
- Enable detailed logging
- Reproduce in staging environment
- Use debugger to inspect state
- Add assertions to catch assumptions
Issue: Performance degradation
Solution:
- Profile the application
- Identify bottlenecks with metrics
- Optimize critical paths
- Monitor improvements with benchmarks
问题:生产环境中出现意外行为
解决方案:
- 启用详细日志
- 在 staging 环境复现问题
- 使用调试器检查状态
- 添加断言以捕获假设错误
问题:性能下降
解决方案:
- 对应用程序进行性能分析
- 使用指标识别瓶颈
- 优化关键路径
- 使用基准测试监控改进效果
Related Skills
相关Skill
- test-driven-development: Write tests before implementation
- systematic-debugging: Debug issues methodically
- code-review: Review code for quality and correctness
- test-driven-development:在实现前编写测试
- systematic-debugging:有条理地调试问题
- code-review:审查代码的质量和正确性
References
参考资料
- Industry documentation and best practices
- Official framework/library documentation
- Community resources and guides
- Code examples and patterns
- 行业文档和最佳实践
- 官方框架/库文档
- 社区资源和指南
- 代码示例和模式
Version History
版本历史
- 1.0.0 (2026-01-01): Initial version
- 1.0.0(2026-01-01):初始版本