[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M777DFKVJKJ4HR99Q1EN6SRJ":3,"skill-same:01M777DFKVJKJ4HR99Q1EN6SRJ":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":37,"ownerHtmlUrl":38,"ownerBlogUrl":6,"ownerDescription":39,"updatedAt":40,"install":41,"resources":54},"01M777DFKVJKJ4HR99Q1EN6SRJ","claude-code-architecture",null,"基于 Claude Code 源码分析提炼的 AI Agent 架构设计模式。当你需要设计\u002F重构 Agent 工具系统、安全门控、上下文压缩、任务编排时使用。","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fc\u002Fclaude-code-architecture\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: claude-code-architecture\ndescription: 基于 Claude Code 源码分析提炼的 AI Agent 架构设计模式。当你需要设计\u002F重构 Agent 工具系统、安全门控、上下文压缩、任务编排时使用。\nversion: 2.0.3\nauthor: di\ntags: [agent, architecture, harness, safety, tool-system]\n---\n\n# AI Agent 架构设计模式\n\n> 从公开的 Agent 架构讨论和主流框架设计中提炼的实战设计模式\n> 触发：设计Agent工具系统 \u002F 实现安全门控 \u002F 优化上下文管理 \u002F 搭建多Agent编排\n\n---\n\n## ⚡ 快速使用\n\n当 agent 需要进行架构设计时，按场景选择模板：\n\n| 场景 | 对应模板 | 触发词 |\n|------|----------|--------|\n| 需要工具权限控制 | 模板 A：权限门控 | \"生成权限门控代码\" |\n| Token 消耗太大 | 模板 B：工具按需加载 | \"实现工具按需加载\" |\n| 上下文快满了 | 模板 C：上下文压缩 | \"生成上下文压缩方案\" |\n| 多工具并发 | 模板 D：读写分离 | \"实现读写分离调度\" |\n\nAgent 应按当前任务选择模板并生成定制代码。\n\n⚠️ **安全规则**：\n- 生成代码前须告知用户目标路径，**等待确认再写入**\n- 不可直接覆盖已有文件（先备份或询问）\n- 建议用户在新分支或沙箱环境中测试生成代码\n- 模板代码为设计参考，需要根据实际项目调整\n\n---\n\n## 🏛️ 核心原则\n\n**护城河不是模型，是 harness（框架）** — 任务编排、工具系统、上下文管理、安全机制\n\n### 七大设计模式\n\n| # | 模式 | 一句话 |\n|---|------|--------|\n| 1 | Initiative\u002FExecution 分离 | 规划层与执行层解耦 |\n| 2 | 读写分离并发 | 只读并行，写入排队 |\n| 3 | 工具按需加载 | 先给轻量索引，选中后再加载完整参数 |\n| 4 | 记忆不记代码 | 代码事实实时从源码读取 |\n| 5 | 五级上下文压缩 | 剪裁→精简→折叠→AI总结→强制保留 |\n| 6 | 插件式工具架构 | 每个工具独立权限+验证+格式化 |\n| 7 | Fail-closed 安全 | 默认拒绝，显式授权 |\n\n---\n\n## 模板 A：权限门控\n\n```python\nclass ToolPermissionGate:\n    \"\"\"Fail-closed 权限门控。默认拒绝，显式授权。\"\"\"\n    def __init__(self):\n        self.permissions = {}\n        self.default = \"none\"\n    \n    def can_execute(self, tool_name: str, user: str) -> bool:\n        if not self._is_declared_readonly(tool_name):\n            return self.permissions.get(user, self.default) >= self._required_level(tool_name)\n        return True\n    \n    def request(self, tool_name: str) -> str:\n        return f\"⚠️ 需要授权执行 {tool_name}。确认吗？\"\n```\n\n参考具体实现：`references\u002Fpermission_gate_full.py`\n\n---\n\n## 模板 B：工具按需加载\n\n```python\nclass ToolRegistry:\n    \"\"\"轻量索引 → 选中 → 加载完整参数\"\"\"\n    def __init__(self):\n        self.index = {}      # 轻量：名称+用途\n        self.loaders = {}    # 完整参数加载器\n    \n    def list_tools(self) -> list:\n        return [{\"name\": k, \"purpose\": v} for k, v in self.index.items()]\n    \n    def get_full(self, name: str) -> dict:\n        return self.loaders[name]() if name in self.loaders else None\n```\n\n参考具体实现：`references\u002Ftool_lazy_loading_full.py`\n\n---\n\n## 模板 C：五级上下文压缩\n\n| 级别 | 方法 | 适用 |\n|------|------|------|\n| 1 Prune | 删除低价值消息 | 日常清理 |\n| 2 Micro | 精简长消息 | 接近限制 |\n| 3 Fold | 折叠摘要 | 上下文紧张 |\n| 4 Auto | AI 自动总结 | 严重溢出 |\n| 5 Hard | 强制保留关键信息 | 最后手段 |\n\n```python\nclass ContextCompressor:\n    LEVELS = {1: \"prune\", 2: \"micro\", 3: \"fold\", 4: \"auto\", 5: \"hard\"}\n    \n    def compress(self, messages: list, level: int, max_tokens: int) -> list:\n        # 按级别执行对应压缩策略\n        ...\n```\n\n参考具体实现：`references\u002Fcontext_compressor_full.py`\n\n---\n\n## 模板 D：读写分离调度\n\n```python\nclass ReadWriteScheduler:\n    \"\"\"只读操作并发，写操作排队\"\"\"\n    async def execute(self, ops: list) -> list:\n        reads = [op for op in ops if op.is_readonly]\n        writes = [op for op in ops if not op.is_readonly]\n        \n        results = await asyncio.gather(*[self._read(op) for op in reads])\n        for op in writes:\n            results.append(await self._write(op))\n        return results\n```\n\n参考具体实现：`references\u002Frw_scheduler_full.py`\n\n---\n\n## 📦 结构\n\n```\nclaude-code-architecture\u002F\n├── SKILL.md                              # 主文件（含 4 个内联模板）\n└── references\u002F\n    ├── permission_gate_full.py           # 模板 A 完整实现\n    ├── tool_lazy_loading_full.py         # 模板 B 完整实现\n    ├── context_compressor_full.py        # 模板 C 完整实现\n    ├── rw_scheduler_full.py             # 模板 D 完整实现\n    └── framework_comparison.md           # 主流框架对比\n```\n\n## 📖 参考资料\n\n- 完整代码实现 → `references\u002F` 目录各模板完整版\n- 与其他框架对比 → `references\u002Fframework_comparison.md`\n- 设计思想来源 → 公开的主流 Agent 框架架构讨论\n\n---\n\n_版本 2.0.3 | 修复权限门控默认拒绝、审批检查、摘要角色_\n","# AI Agent 架构设计模式\n\n> 从公开的 Agent 架构讨论和主流框架设计中提炼的实战设计模式\n> 触发：设计Agent工具系统 \u002F 实现安全门控 \u002F 优化上下文管理 \u002F 搭建多Agent编排\n\n---\n\n## ⚡ 快速使用\n\n当 agent 需要进行架构设计时，按场景选择模板：\n\n| 场景 | 对应模板 | 触发词 |\n|------|----------|--------|\n| 需要工具权限控制 | 模板 A：权限门控 | \"生成权限门控代码\" |\n| Token 消耗太大 | 模板 B：工具按需加载 | \"实现工具按需加载\" |\n| 上下文快满了 | 模板 C：上下文压缩 | \"生成上下文压缩方案\" |\n| 多工具并发 | 模板 D：读写分离 | \"实现读写分离调度\" |\n\nAgent 应按当前任务选择模板并生成定制代码。\n\n⚠️ **安全规则**：\n- 生成代码前须告知用户目标路径，**等待确认再写入**\n- 不可直接覆盖已有文件（先备份或询问）\n- 建议用户在新分支或沙箱环境中测试生成代码\n- 模板代码为设计参考，需要根据实际项目调整\n\n---\n\n## 🏛️ 核心原则\n\n**护城河不是模型，是 harness（框架）** — 任务编排、工具系统、上下文管理、安全机制\n\n### 七大设计模式\n\n| # | 模式 | 一句话 |\n|---|------|--------|\n| 1 | Initiative\u002FExecution 分离 | 规划层与执行层解耦 |\n| 2 | 读写分离并发 | 只读并行，写入排队 |\n| 3 | 工具按需加载 | 先给轻量索引，选中后再加载完整参数 |\n| 4 | 记忆不记代码 | 代码事实实时从源码读取 |\n| 5 | 五级上下文压缩 | 剪裁→精简→折叠→AI总结→强制保留 |\n| 6 | 插件式工具架构 | 每个工具独立权限+验证+格式化 |\n| 7 | Fail-closed 安全 | 默认拒绝，显式授权 |\n\n---\n\n## 模板 A：权限门控\n\n```python\nclass ToolPermissionGate:\n    \"\"\"Fail-closed 权限门控。默认拒绝，显式授权。\"\"\"\n    def __init__(self):\n        self.permissions = {}\n        self.default = \"none\"\n    \n    def can_execute(self, tool_name: str, user: str) -> bool:\n        if not self._is_declared_readonly(tool_name):\n            return self.permissions.get(user, self.default) >= self._required_level(tool_name)\n        return True\n    \n    def request(self, tool_name: str) -> str:\n        return f\"⚠️ 需要授权执行 {tool_name}。确认吗？\"\n```\n\n参考具体实现：`references\u002Fpermission_gate_full.py`\n\n---\n\n## 模板 B：工具按需加载\n\n```python\nclass ToolRegistry:\n    \"\"\"轻量索引 → 选中 → 加载完整参数\"\"\"\n    def __init__(self):\n        self.index = {}      # 轻量：名称+用途\n        self.loaders = {}    # 完整参数加载器\n    \n    def list_tools(self) -> list:\n        return [{\"name\": k, \"purpose\": v} for k, v in self.index.items()]\n    \n    def get_full(self, name: str) -> dict:\n        return self.loaders[name]() if name in self.loaders else None\n```\n\n参考具体实现：`references\u002Ftool_lazy_loading_full.py`\n\n---\n\n## 模板 C：五级上下文压缩\n\n| 级别 | 方法 | 适用 |\n|------|------|------|\n| 1 Prune | 删除低价值消息 | 日常清理 |\n| 2 Micro | 精简长消息 | 接近限制 |\n| 3 Fold | 折叠摘要 | 上下文紧张 |\n| 4 Auto | AI 自动总结 | 严重溢出 |\n| 5 Hard | 强制保留关键信息 | 最后手段 |\n\n```python\nclass ContextCompressor:\n    LEVELS = {1: \"prune\", 2: \"micro\", 3: \"fold\", 4: \"auto\", 5: \"hard\"}\n    \n    def compress(self, messages: list, level: int, max_tokens: int) -> list:\n        # 按级别执行对应压缩策略\n        ...\n```\n\n参考具体实现：`references\u002Fcontext_compressor_full.py`\n\n---\n\n## 模板 D：读写分离调度\n\n```python\nclass ReadWriteScheduler:\n    \"\"\"只读操作并发，写操作排队\"\"\"\n    async def execute(self, ops: list) -> list:\n        reads = [op for op in ops if op.is_readonly]\n        writes = [op for op in ops if not op.is_readonly]\n        \n        results = await asyncio.gather(*[self._read(op) for op in reads])\n        for op in writes:\n            results.append(await self._write(op))\n        return results\n```\n\n参考具体实现：`references\u002Frw_scheduler_full.py`\n\n---\n\n## 📦 结构\n\n```\nclaude-code-architecture\u002F\n├── SKILL.md                              # 主文件（含 4 个内联模板）\n└── references\u002F\n    ├── permission_gate_full.py           # 模板 A 完整实现\n    ├── tool_lazy_loading_full.py         # 模板 B 完整实现\n    ├── context_compressor_full.py        # 模板 C 完整实现\n    ├── rw_scheduler_full.py             # 模板 D 完整实现\n    └── framework_comparison.md           # 主流框架对比\n```\n\n## 📖 参考资料\n\n- 完整代码实现 → `references\u002F` 目录各模板完整版\n- 与其他框架对比 → `references\u002Fframework_comparison.md`\n- 设计思想来源 → 公开的主流 Agent 框架架构讨论\n\n---\n\n_版本 2.0.3 | 修复权限门控默认拒绝、审批检查、摘要角色_\n",{"name":5,"tags":24,"author":30,"version":31,"description":7},[25,26,27,28,29],"agent","architecture","harness","safety","tool-system","di","2.0.3","master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fclawhub\u002Fc\u002Fclaude-code-architecture",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill claude-code-architecture",{"tool":47,"command":48},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill claude-code-architecture",{"tool":50,"command":51},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill claude-code-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fc\u002Fclaude-code-architecture\u002FSKILL.md",true,[],[56,63,70,77,84,91],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]