context-bundling
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext Bundling Skill 📦
上下文打包Skill 📦
Overview
概述
This skill centralizes the knowledge and workflows for creating "Context Bundles." These bundles are essential for compiling large amounts of code and design context into a single, portable Markdown file for sharing with other AI agents or for human review.
该Skill整合了创建「上下文包」的相关知识和工作流。这些包可将大量代码和设计上下文编译为单个可移植的Markdown文件,非常适合分享给其他AI Agent或供人工评审使用。
🎯 Primary Directive
🎯 核心准则
Curate, Consolidate, and Convey. You do not just "list files"; you architect context. You ensure that any bundle you create is:
- Complete: Contains all required dependencies, documentation, and source code.
- Ordered: Flows logically (Identity/Prompt → Manifest → Design Docs → Source Code).
- Annotated: Every file must include a brief note explaining its purpose in the bundle.
筛选、整合、传递。 你不只是简单「罗列文件」,而是在架构上下文。你需要确保创建的所有包都满足以下要求:
- 完整: 包含所有必需的依赖项、文档和源代码。
- 有序: 逻辑流畅(身份/Prompt → 清单 → 设计文档 → 源代码)。
- 带注释: 每个文件都必须附带简短说明,解释其在包中的作用。
Core Workflow: Generating a Bundle
核心工作流:生成上下文包
The context bundler operates through a simple JSON manifest pattern.
上下文打包工具采用简单的JSON清单模式运行。
1. Analyze the Intent
1. 分析需求意图
Before bundling, determine what the user is trying to accomplish:
- Code Review: Include implementation files and overarching logic.
- Red Team / Security: Include architecture diagrams and security protocols.
- Bootstrapping: Include ,
README, and structural scaffolding..env.example
打包前,先明确用户的使用目标:
- 代码评审: 包含实现文件和整体逻辑说明。
- 红队/安全测试: 包含架构图和安全协议文档。
- 项目初始化: 包含、
README和结构脚手架文件。.env.example
2. Define the Manifest Schema
2. 定义清单结构
You must formulate a JSON manifest containing the exact files to be bundled.
json
{
"title": "Bundle Title",
"description": "Short explanation of the bundle's goal.",
"files": [
{
"path": "docs/architecture.md",
"note": "Primary design document"
},
{
"path": "src/main.py",
"note": "Core implementation logic"
}
]
}你必须制定一个JSON清单,列出要打包的所有具体文件:
json
{
"title": "Bundle Title",
"description": "Short explanation of the bundle's goal.",
"files": [
{
"path": "docs/architecture.md",
"note": "Primary design document"
},
{
"path": "src/main.py",
"note": "Core implementation logic"
}
]
}3. Generate the Markdown Bundle
3. 生成Markdown上下文包
Use your native tools (e.g., , , or custom scripts depending on the host agent environment) to read the contents of each file listed in the manifest and compile them into a target file.
catview_fileoutput.mdThe final bundle format must follow this structure:
markdown
undefined使用你自带的工具(例如、,或根据宿主Agent环境使用自定义脚本)读取清单中列出的每个文件的内容,将它们编译为目标文件。
catview_fileoutput.md最终的包格式必须遵循以下结构:
markdown
undefined[Bundle Title]
[Bundle Title]
Description: [Description]
Description: [Description]
Index
Index
- - Primary design document
docs/architecture.md - - Core implementation logic
src/main.py
- - Primary design document
docs/architecture.md - - Core implementation logic
src/main.py
File: docs/architecture.md
docs/architecture.mdFile: docs/architecture.md
docs/architecture.mdNote: Primary design document
```markdown
... file contents ...
```
Note: Primary design document
```markdown
... file contents ...
```
File: src/main.py
src/main.pyFile: src/main.py
src/main.pyNote: Core implementation logic
```python
... file contents ...
```
undefinedNote: Core implementation logic
```python
... file contents ...
```
undefinedConditional Step Inclusion & Error Handling
可选步骤说明与错误处理
If a file requested in the manifest does not exist or raises a permissions error:
- Do not abort the entire bundle.
- In the final , insert a placeholder explicitly declaring the failure:
output.mdmarkdown## File: `missing/file.py` > 🔴 **NOT INCLUDED**: The file was not found or could not be read. - Proceed bundling the remaining valid files.
如果清单中请求的文件不存在或触发权限错误:
- 不要 中止整个打包流程。
- 在最终的中插入占位符,明确声明失败情况:
output.mdmarkdown## File: `missing/file.py` > 🔴 **NOT INCLUDED**: The file was not found or could not be read. - 继续打包其余有效文件。
Best Practices & Anti-Patterns
最佳实践与反模式
- Self-Contained Functionality: The output file must contain 100% of the context required for a secondary agent to operate without needing to run terminal commands.
- Specialized Prompts: If bundling for an external review (e.g., a "Red Team" security check), suggest including a specialized prompt file as the very first file in the bundle to guide the receiving LLM.
- 功能自包含: 输出文件必须包含100%的所需上下文,确保第三方Agent无需运行终端命令即可正常工作。
- 专用Prompt: 如果打包是为了外部评审(例如「红队」安全检查),建议将专用Prompt文件放在包的最开头,用于引导接收内容的LLM。
Common Bundling Mistakes
常见打包错误
- Bloat: Including or massive
node_modules/dumps instead of targeted files..json - Silent Exclusion: Filtering out an unreadable file without explicitly declaring it missing (violates transparency).
- 内容冗余: 包含或大型.json导出文件,而非目标文件。
node_modules/ - 隐式排除: 过滤掉无法读取的文件却不明确声明其缺失(违反透明性要求)。