Skip to content
Catown Dev edited this page Apr 10, 2026 · 1 revision

Skills 体系

Skills 是 Catown 中 Agent 能力的高层封装。每个 Skill 定义一种专业行为模式,由指令片段(注入 system prompt)和依赖工具组成。

工作原理

agents.json 的 agent.skills → 查找 skills.json → 注入 prompt_fragment 到 system prompt

Agent 配置了哪些 skills,它的 system prompt 就包含对应的指令片段,指导 Agent 如何完成特定类型的任务。

预置 Skills(21 个)

Development

Skill 说明 依赖工具
code-generation 代码生成规范 read_file, write_file, list_files
unit-testing 单元测试规范 read_file, write_file, execute_code
refactoring 重构规范 read_file, write_file, search_files
debugging 调试规范 read_file, execute_code, search_files

Analysis

Skill 说明 依赖工具
document-analysis 文档分析规范 read_file, write_file, web_search
requirement-decomposition 需求拆解规范 read_file, write_file
user-story-writing 用户故事编写规范 read_file, write_file
knowledge-graph 知识图谱构建与查询 execute_code, read_file, write_file
research 调研规范 web_search, read_file, write_file

Architecture

Skill 说明 依赖工具
architecture-design 架构设计规范 read_file, write_file, web_search
technology-evaluation 技术选型评估规范 read_file, web_search
api-design API 设计规范 read_file, write_file

Testing

Skill 说明 依赖工具
test-generation 测试生成规范 read_file, write_file, execute_code
bug-reporting Bug 报告规范 read_file, execute_code
security-testing 安全测试规范 read_file, search_files, execute_code

Release

Skill 说明 依赖工具
changelog-generation Changelog 生成规范 read_file, write_file, execute_code
version-tagging 版本标签管理规范 execute_code, read_file
release-management 发布管理规范 read_file, write_file, execute_code

Design

Skill 说明 依赖工具
ui-ux-pro-max UI/UX 专业设计:生成→截图→验证→迭代闭环 read_file, write_file, list_files, screenshot, browser, execute_code

General

Skill 说明 依赖工具
documentation 文档编写规范 read_file, write_file, list_files
coordination 跨角色协调规范 send_message, query_agent, read_file

知识图谱 Skill (knowledge-graph)

基于 graphify 的代码知识图谱能力。

两阶段模型

阶段 操作 决策方 成本
建图 graphify . --no-viz BOSS 审批 高(LLM API 调用)
查询 graphify query "{问题}" Agent 自主 极低(本地计算)
增量更新 graphify . --update BOSS 审批 中(LLM API 调用)

Agent 行为规则

  1. 处理代码任务前,检查 graphify-out/graph.json 是否存在
  2. 不存在 → 向 BOSS 请求建图许可
  3. 已存在 → 读取 GRAPH_REPORT.md 获取全局概览,按需查询具体问题

产出物

graphify-out/
├── graph.html          # 交互式图谱(可选,--no-viz 跳过)
├── GRAPH_REPORT.md     # 结构概览:god nodes, communities, 惊喜连接
├── graph.json          # 可查询的图数据
└── cache/              # SHA256 缓存,增量更新用

适用 Agent

  • developer — 核心使用者,编码时需要理解代码结构
  • architect — 设计架构时需要了解现有依赖

详见 ADR-004

UI/UX Pro Max Skill

定位

让 Agent 能生成高质量前端界面,并通过截图验证形成迭代闭环。

前置条件

依赖 状态 说明
screenshot 工具 ✅ 已实现 Headless Chromium 截图
browser 工具 ✅ 已实现 Playwright 自动化(15 个交互动作)
execute_code 增强 ✅ 已实现 Python + Node.js 双语言沙箱
ui-designer Agent ✅ 已实现 专门 UI 设计师角色,SOUL + tools 配置
ui-ux-pro-max Skill ✅ 已实现 prompt_fragment + required_tools 定义

核心迭代闭环

Agent 生成 HTML/CSS 代码
    │
    ├── screenshot 工具截图 → 渲染效果
    │       │
    │       ├── 符合预期 → 进入下一组件
    │       └── 不符合 → LLM 分析截图 → 修改代码 → 再截图
    │
    └── browser 工具交互测试 → 响应式/交互验证

Skill 配置

{
  "ui-ux-pro-max": {
    "name": "UI/UX Pro Max",
    "description": "专业级 UI 设计:生成 → 截图 → 验证 → 迭代闭环",
    "required_tools": ["read_file", "write_file", "list_files", "screenshot", "browser", "execute_code"],
    "prompt_fragment": "## UI/UX Pro Max 设计规范\n- 生成前先检查项目现有设计风格\n- 产出物必须用 screenshot 截图验证\n- 不达标就迭代\n- 响应式:desktop 1440px + mobile 375px\n- 交互行为用 browser 实际测试\n- 截图保存为产出物",
    "category": "design"
  }
}

Phase 2 待做

  • 截图对比能力(baseline vs actual 差异检测)
  • 截图式审计(截图存入审计日志和记忆体系)

详见 ADR-007

配置

新增 Skill

configs/skills.json 添加条目:

{
  "my-skill": {
    "name": "我的技能",
    "description": "一句话说明",
    "required_tools": ["read_file", "write_file"],
    "prompt_fragment": "## 我的技能\n- 规则1\n- 规则2",
    "category": "development"
  }
}

分配给 Agent

configs/agents.json 的 agent 配置中添加:

{
  "developer": {
    "skills": ["code-generation", "unit-testing", "my-skill"]
  }
}

热加载

修改 skills.json 后调用 POST /api/config/reload 生效,无需重启。

Clone this wiki locally