context-engineering-kit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext Engineering Kit
上下文工程工具包
A collection of advanced context engineering techniques and patterns designed to improve AI agent results while minimizing token consumption.
这是一套高级上下文工程技术与模式集合,旨在提升AI Agent的输出效果,同时最大限度减少Token消耗。
When to Use This Skill
何时使用该技能
- Improving AI output quality systematically
- Reducing token usage in complex tasks
- Implementing structured reasoning patterns
- Multi-agent code review workflows
- Spec-driven development processes
- When standard prompting isn't enough
- 系统性提升AI输出质量
- 减少复杂任务中的Token使用量
- 实现结构化推理模式
- 多Agent代码审查工作流
- 规范驱动的开发流程
- 当标准提示词无法满足需求时
Core Techniques
核心技术
1. Reflexion Pattern
1. Reflexion模式
Feedback loops that improve output by 8-21% across tasks.
How it works:
1. Generate initial response
2. Self-evaluate against criteria
3. Identify improvement areas
4. Generate refined response
5. Repeat until quality threshold metUse when:
- Writing complex code
- Creating documentation
- Solving multi-step problems
通过反馈循环可将各类任务的输出效果提升8-21%。
工作原理:
1. 生成初始响应
2. 根据标准进行自我评估
3. 识别可改进区域
4. 生成优化后的响应
5. 重复直至达到质量阈值适用场景:
- 编写复杂代码
- 创建文档
- 解决多步骤问题
2. Spec-Driven Development
2. 规范驱动开发
Based on GitHub Spec Kit and OpenSpec frameworks.
Process:
markdown
undefined基于GitHub Spec Kit和OpenSpec框架。
流程:
markdown
undefinedSpecification Document
规范文档
Requirements
需求
[Clear, testable requirements]
[清晰、可测试的需求]
Acceptance Criteria
验收标准
[Specific success conditions]
[具体的成功条件]
Constraints
约束条件
[Limitations and boundaries]
[限制与边界]
Examples
示例
[Input/output pairs]
**Benefits:**
- Clearer requirements
- Testable outputs
- Reduced ambiguity[输入/输出配对]
**优势:**
- 需求更清晰
- 输出可测试
- 减少歧义3. Subagent-Driven Development
3. 子Agent驱动开发
Competitive generation with quality gates.
Architecture:
┌─────────────────────────┐
│ Orchestrator Agent │
├─────────────────────────┤
│ ┌─────┐ ┌─────┐ │
│ │Gen 1│ │Gen 2│ ... │
│ └─────┘ └─────┘ │
├─────────────────────────┤
│ Quality Gate Agent │
└─────────────────────────┘Flow:
- Multiple agents generate solutions
- Quality agent evaluates each
- Best solution selected/merged
- Iterative refinement
带质量关卡的竞争性生成机制。
架构:
┌─────────────────────────┐
│ Orchestrator Agent │
├─────────────────────────┤
│ ┌─────┐ ┌─────┐ │
│ │Gen 1│ │Gen 2│ ... │
│ └─────┘ └─────┘ │
├─────────────────────────┤
│ Quality Gate Agent │
└─────────────────────────┘流程:
- 多个Agent生成解决方案
- 质量Agent评估每个方案
- 选择/合并最佳解决方案
- 迭代优化
4. First Principles Framework (FPF)
4. 第一性原理框架(FPF)
Hypothesis-driven decision making.
Structure:
Observation → Hypothesis → Test → ConclusionApplication:
- Debugging complex issues
- Architecture decisions
- Technology selection
基于假设的决策制定。
结构:
观察 → 假设 → 测试 → 结论应用场景:
- 调试复杂问题
- 架构决策
- 技术选型
5. Kaizen (Continuous Improvement)
5. Kaizen(持续改进)
Systematic iterative enhancement.
Cycle:
Plan → Do → Check → Act → Repeat系统性的迭代增强机制。
循环:
计划 → 执行 → 检查 → 改进 → 重复Plugin Categories
插件分类
Reasoning Enhancement
推理增强
- Reflexion: Self-evaluation loops
- Chain of Thought: Step-by-step reasoning
- Tree of Thoughts: Branching exploration
- Reflexion: 自我评估循环
- Chain of Thought: 逐步推理
- Tree of Thoughts: 分支探索
Code Quality
代码质量
- Multi-Agent Review: Parallel code analysis
- Security Audit: Vulnerability detection
- Performance Analysis: Optimization suggestions
- Multi-Agent Review: 并行代码分析
- Security Audit: 漏洞检测
- Performance Analysis: 优化建议
Development Process
开发流程
- Spec-Driven: Requirements-first approach
- TDD Support: Test-first workflows
- Documentation: Auto-generated docs
- Spec-Driven: 需求优先方法
- TDD Support: 测试优先工作流
- Documentation: 自动生成文档
Meta-Skills
元技能
- Plugin Development: Create new plugins
- Workflow Composition: Combine techniques
- Performance Tuning: Optimize patterns
- Plugin Development: 创建新插件
- Workflow Composition: 组合技术
- Performance Tuning: 优化模式
How to Use
使用方法
Basic: Reflexion Loop
基础用法:Reflexion循环
Review my code with reflexion:
[paste code]
Requirements:
- Error handling
- Performance
- Readability使用Reflexion审查我的代码:
[粘贴代码]
需求:
- 错误处理
- 性能
- 可读性Spec-Driven Task
规范驱动任务
Create a spec for: User authentication system
Then implement following the spec.为用户认证系统创建一份规范文档。
然后按照规范实现。Multi-Agent Review
多Agent审查
Review this PR with multiple perspectives:
- Security focus
- Performance focus
- Maintainability focus
[paste code or PR link]从多个角度审查此PR:
- 安全聚焦
- 性能聚焦
- 可维护性聚焦
[粘贴代码或PR链接]Token Efficiency Tips
Token效率技巧
1. Structured Prompts
1. 结构化提示词
markdown
undefinedmarkdown
undefinedContext
上下文
[Brief, relevant context only]
[仅包含简短、相关的上下文]
Task
任务
[Clear, specific task]
[清晰、具体的任务]
Output Format
输出格式
[Expected structure]
undefined[预期的结构]
undefined2. Progressive Disclosure
2. 渐进式披露
- Start with essential info
- Add details only when needed
- Remove redundant context
- 从必要信息开始
- 仅在需要时添加细节
- 移除冗余上下文
3. Pattern Libraries
3. 模式库
- Reuse proven patterns
- Reference by name
- Avoid repeated explanations
- 复用已验证的模式
- 通过名称引用
- 避免重复解释
Example: Complex Code Review
示例:复杂代码审查
Traditional approach (~2000 tokens):
Review this code for bugs, security issues, performance problems...
Context-engineered approach (~800 tokens):
markdown
undefined传统方法(约2000 Token):
审查此代码中的Bug、安全问题、性能问题...
上下文工程优化方法(约800 Token):
markdown
undefinedReview: auth.py
审查:auth.py
Focus Areas
聚焦领域
- Security (OWASP Top 10)
- Error handling
- SQL injection
- 安全(OWASP Top 10)
- 错误处理
- SQL注入
Output
输出
- Issues: severity + line number
- Fixes: specific code suggestions
[code]
**Result:** Same quality, 60% fewer tokens.- 问题:严重程度 + 行号
- 修复:具体代码建议
[代码]
**结果:** 质量相同,Token用量减少60%。Best Practices
最佳实践
- Start Simple: Add complexity only when needed
- Measure Impact: Track quality improvements
- Iterate: Refine patterns based on results
- Document: Keep notes on what works
- Share: Contribute successful patterns
- 从简开始: 仅在需要时增加复杂度
- 衡量影响: 跟踪质量提升情况
- 迭代优化: 根据结果改进模式
- 文档记录: 记录有效的方法
- 分享交流: 贡献成功的模式
Integration
集成兼容性
Works with:
- Claude Code
- Cursor
- VS Code + Continue
- Any LLM-based tool
可与以下工具配合使用:
- Claude Code
- Cursor
- VS Code + Continue
- 任何基于LLM的工具
Creating Custom Patterns
创建自定义模式
markdown
undefinedmarkdown
undefinedPattern: [Name]
模式:[名称]
When to Use
何时使用
[Trigger conditions]
[触发条件]
Process
流程
[Step-by-step]
[分步说明]
Example
示例
[Concrete example]
[具体示例]
Metrics
指标
[How to measure success]
undefined[如何衡量成功]
undefined