专业知识文件设计Skill expertise-file-design

该技能用于设计和维护YAML格式的专业知识文件,作为AI代理专家的心智模型,支持Act-Learn-Reuse工作流,加速代理执行并提供领域知识。关键词:AI代理,YAML,专业知识文件,心智模型,Act-Learn-Reuse,人工智能代理

AI智能体 0 次安装 0 次浏览 更新于 3/11/2026

name: expertise-file-design description: 设计YAML专业知识文件结构,用于代理专家心智模型。在创建领域特定代理的心智模型、定义专业知识模式结构或为Act-Learn-Reuse工作流结构化知识时使用。 allowed-tools: 读取, Grep, 全局搜索, 写入

专业知识文件设计

用于设计YAML专业知识文件的指南,这些文件作为代理专家的心智模型。

强制要求:Act-Learn-Reuse上下文

专业知识文件是心智模型,而非真相来源。它们:

  • 通过预加载领域知识加速代理执行
  • 由自我改进提示维护,而非人工
  • 针对实际代码库(真相来源)进行验证
  • 有强制执行的行限制以保护上下文窗口

何时使用

  • 创建新领域特定代理的心智模型
  • 定义专业知识模式结构(YAML)
  • 为Act-Learn-Reuse工作流结构化知识
  • 审查或审计现有专业知识文件设计
  • 设置行限制和部分优先级

专业知识文件结构

核心模板

# {domain}/expertise.yaml
# {domain}代理专家的心智模型
# 最后更新:{timestamp}
# 行数:{current}/{max}

overview:
  description: "此领域的简要描述"
  primary_technology: "主要技术/框架"
  architecture_pattern: "使用的关键模式"

core_implementation:
  main_module:
    file: "path/to/main/file.ext"
    lines: approximate_line_count
    purpose: "此模块的功能"
    key_exports:
      - name: "FunctionOrClass"
        type: "function|class|constant"
        purpose: "简要描述"

  supporting_modules:
    - file: "path/to/support.ext"
      purpose: "支持功能"

schema_structure:  # 用于数据库/API领域
  entities:
    entity_name:
      fields:
        - name: "field_name"
          type: "data_type"
          constraints: "nullable, unique, etc."
      relationships:
        - target: "other_entity"
          type: "one-to-many|many-to-many"

key_operations:
  operation_category:
    operation_name:
      function: "function_name"
      file: "path/to/file.ext"
      signature: "func(param: Type) -> ReturnType"
      logic: "功能的简要描述"
      edge_cases:
        - "重要边缘情况1"
        - "重要边缘情况2"

patterns_and_conventions:
  naming:
    - "命名约定描述"
  error_handling:
    - "错误处理方式"
  data_flow:
    - "系统中数据流的方式"

best_practices:
  - "实践1:解释"
  - "实践2:解释"

known_issues:
  - issue: "问题描述"
    workaround: "处理方法"
    status: "open|resolved|wontfix"

integration_points:
  - system: "外部系统名称"
    method: "集成方式"
    considerations: "重要注意事项"

testing_notes:
  - "如何测试此领域"
  - "关键测试场景"

行限制

领域复杂性 最大行数 指导原则
小型/集中 300 单一模块,简单操作
中型 500-600 多个模块,中等复杂性
大型/复杂 800-1000 完整子系统,许多操作
绝对最大值 1000 永不超出 - 拆分为子专家

部分优先级

当接近行限制时,按此顺序优先处理部分:

  1. core_implementation - 导航基础
  2. key_operations - 任务执行关键
  3. best_practices - 防止错误
  4. known_issues - 避免浪费努力
  5. patterns_and_conventions - 有益补充
  6. testing_notes - 可参考外部文档

领域特定模板

数据库领域

overview:
  database_system: "PostgreSQL|MySQL|MongoDB|等"
  orm_pattern: "原生SQL|ORM名称|查询构建器"
  connection_strategy: "连接池|单连接|每请求"

schema_structure:
  tables:
    table_name:
      purpose: "此表存储内容"
      primary_key: "id (UUID|INT)"
      fields: [...]
      indexes: [...]
      foreign_keys: [...]

key_operations:
  crud:
    create: {function: "", file: "", logic: ""}
    read: {function: "", file: "", logic: ""}
    update: {function: "", file: "", logic: ""}
    delete: {function: "", file: "", logic: ""}

  specialized:
    bulk_insert: {...}
    transaction_handling: {...}

API/服务领域

overview:
  api_style: "REST|GraphQL|gRPC"
  auth_method: "JWT|OAuth|API密钥"
  versioning: "URL|Header|无"

endpoints:
  resource_name:
    base_path: "/api/v1/resource"
    operations:
      list: {method: "GET", auth: "required", pagination: "cursor"}
      create: {method: "POST", auth: "required", validation: "..."}

request_response_patterns:
  success_format: {...}
  error_format: {...}

前端/UI领域

overview:
  framework: "React|Vue|Angular|等"
  state_management: "Redux|Zustand|Context|等"
  styling: "CSS Modules|Tailwind|Styled Components"

component_hierarchy:
  pages:
    - name: "PageName"
      route: "/path"
      children: [...]

  shared:
    - name: "ComponentName"
      purpose: "X的可重用组件"

state_structure:
  stores:
    store_name:
      shape: {...}
      actions: [...]

种子策略

创建新专业知识文件时:

  1. 开始最小化 - 仅以概述和core_implementation开始
  2. 让代理发现 - 运行自我改进以填充
  3. 迭代 - 运行自我改进直至稳定(无变化)
  4. 审查 - 人工验证准确性
  5. 维护 - 每次ACT后自我改进

反模式

模式 问题 解决方案
复制粘贴文档 重复真相来源 引用文件,勿复制
包含代码 文件臃肿,过期 通过函数名引用
无行限制 上下文窗口溢出 严格强制执行最大行数
手动更新 浪费人工时间 仅使用自我改进提示
扁平结构 难以导航 使用嵌套YAML部分

验证清单

在考虑专业知识文件完成前:

  • [ ] 有效的YAML语法(无解析错误)
  • [ ] 符合领域复杂性的行限制
  • [ ] 所有文件路径已验证存在
  • [ ] 所有函数名称已验证准确
  • [ ] 概述部分完整
  • [ ] 关键操作文档化
  • [ ] 最佳实践包含
  • [ ] 已知问题捕获

相关技能

  • agent-expert-creation: 完整代理专家工作流
  • self-improve-prompt-design: 维护专业知识准确性
  • meta-agentic-creation: 构建构建专家的专家

最后更新: 2025-12-15

版本历史

  • v1.0.0 (2025-12-26): 初始发布