# ============================================================
# MySkills Skill Map — Single Source of Truth / 单一事实来源
# ============================================================
# THIS FILE is the authoritative registry for ALL skills. 
# All routing, dispatch, and orchestration logic reads from here.
# NO other dispatch.yaml files exist — everything is consolidated.
#
# Update this file when adding/modifying/removing skills.
# Auto reads it on every /auto invocation.
# Easy reads it for keyword-based routing.
# ============================================================

version: "2.0.1"
generated: "2026-06-18"
meta-skill-compatible: true

# ---- Quality Assurance / 质量保证 ----
quality:
  code-review:
    path: code-review
    skill_name: code-review
    description: "当用户请求代码审查、评估代码问题、检查Pull Request或需要实现质量反馈时使用。不要用于安全专项审计（用 security-check）或代码重构规划（用 code-quality）。Use when user requests code review, asks about code problems, evaluates pull requests, or wants feedback on implementation quality. Do NOT use for security-specific audits (use security-check) or refactoring plans (use code-quality)."
    capabilities:
      - 逻辑漏洞检测 (null pointer, boundary conditions, dead code, race conditions)
      - 性能问题检测 (N+1 queries, unnecessary loops, large objects)
      - 安全风险检测 (SQL injection, XSS, sensitive data exposure)
      - 代码规范检查 (naming, comments, exception handling, transactions)
    input: "Code files, diff, or directory path"
    output: "Categorized report: 🔴Critical | 🟡Warning | 🔵Suggestion"
    dependencies: []
    triggers: ["code review", "review", "代码审查", "code smell", "代码坏味道"]
    dispatch:
      method: task
      category: deep
      load_skills: ["code-review"]

  code-quality:
    path: code-quality
    skill_name: code-quality
    description: "当用户需要代码质量评估、重构建议、设计模式推荐、SOLID原则检查或代码异味分析时使用。不要用于安全审查（用 security-check）或基础代码审查（用 code-review）。Use when user asks about code quality, refactoring, design patterns, SOLID principles, or code smells. Do NOT use for security reviews (use security-check) or basic code review (use code-review)."
    capabilities:
      - 代码异味检测 (Long Method, Duplicated Code, Large Class, Feature Envy)
      - 重构指导 (Extract Method, Move Method, Extract Class)
      - 设计模式推荐 (Singleton, Factory, Strategy, Observer, Adapter, Decorator)
      - SOLID原则合规性检查 (单一职责、开闭原则、里氏替换、接口隔离、依赖倒置)
    input: "Code files or directory path"
    output: "Smell detection report with refactoring suggestions"
    dependencies: []
    triggers: ["code quality", "代码质量", "refactor", "重构", "design pattern", "设计模式", "code smell", "代码异味", "SOLID", "clean code"]
    dispatch:
      method: task
      category: deep
      load_skills: ["code-quality"]

  security-check:
    path: security-check
    skill_name: security-check
    description: "当用户需要安全检查、提到安全漏洞（SQL注入、XSS、CSRF、OWASP）、请求安全审计或报告安全问题时使用。不要用于依赖CVE扫描（用 deps-check）或代码审查（用 code-review）。Use when user asks about security, mentions vulnerabilities (SQL injection, XSS, CSRF, OWASP), requests security audit, or reports security concerns. Do NOT use for dependency CVE checking (use deps-check) or code review (use code-review)."
    capabilities:
      - 注入攻击防护 (SQL/Command/Path injection detection and prevention)
      - XSS防护 (Reflected, Stored, DOM-based XSS prevention)
      - 认证与授权审计 (access control, password policy, JWT security)
      - 数据保护 (encryption AES-256-GCM, BCrypt hashing, log desensitization)
      - 文件上传安全 (type/size/magic number validation, secure storage)
      - 硬编码密钥检测
    input: "Code files or directory path"
    output: "Security audit report with vulnerability severity classification"
    dependencies: []
    triggers: ["security", "安全", "漏洞", "OWASP", "SQL injection", "XSS", "CSRF", "安全审计", "漏洞扫描"]
    dispatch:
      method: task
      category: deep
      load_skills: ["security-check"]

  deps-check:
    path: deps-check
    skill_name: deps-check
    description: "当用户需要依赖检查、查看过期包、扫描CVE漏洞或审计依赖健康状况时使用。不要用于自定义代码的安全审计（用 security-check）或代码审查（用 code-review）。Use when user checks dependencies, asks about outdated packages, scans for CVEs, or audits dependency health. Do NOT use for custom code security (use security-check) or code review (use code-review)."
    capabilities:
      - Maven/npm/Gradle dependency version analysis
      - Known CVE vulnerability scanning
      - Circular dependency detection
      - Unused dependency identification and cleanup
      - Dependency tree analysis
    input: "Project root directory (with pom.xml/package.json/build.gradle)"
    output: "Dependency health report: outdated, vulnerable, unused, circular"
    dependencies: []
    triggers: ["deps", "dependencies", "依赖", "version", "outdated", "CVE"]
    dispatch:
      method: bash
      command: "use mvn/npm commands for dependency analysis"

  linter-expert:
    path: linter-expert
    skill_name: linter-expert
    description: "当用户需要Lint静态分析、代码格式化、Lint错误修复或提及ESLint/Checkstyle/ruff时使用。不要用于代码审查（用 code-review）或安全审计（用 security-check）。Use when user needs lint/static analysis, asks about code formatting, requests lint error fixes, or mentions ESLint/Checkstyle/ruff. Do NOT use for code review (use code-review) or security audit (use security-check)."
    capabilities:
      - Java静态分析 (Checkstyle, SpotBugs, PMD)
      - JavaScript/TypeScript linting (ESLint)
      - Python linting (ruff, pylint, flake8)
      - 诊断结果分类和根因分析
      - 最小化修复建议
    input: "Code files or directory, config auto-detection"
    output: "Lint report classified by type + fix suggestions"
    dependencies: []
    triggers: ["lint", "linter", "checkstyle", "eslint", "format", "规范", "静态检查", "代码规范"]
    dispatch:
      method: task
      category: deep
      load_skills: ["linter-expert"]

# ---- Workflow & Analysis / 工作流与分析 ----
workflow:
  ba:
    path: ba
    skill_name: ba
    description: "当用户输入/analyze、/audit、/doc命令，或需要业务流程分析、需求建模、PRD评审、5W1H分析时使用。不要用于代码实现、测试编写、架构设计。Use when users input /analyze, /audit, /doc commands, or need business process analysis, requirement modeling, PRD review, or 5W1H analysis. Do NOT use for code implementation, testing, or architecture design."
    capabilities:
      - 5W1H requirement analysis (Why/What/Who/When/Where/How)
      - MECE principle (Mutually Exclusive, Collectively Exhaustive)
      - CRUD matrix generation (entity × operation)
      - Use case diagrams, flowcharts, state diagrams
      - Multi-perspective business design analysis
      - Iterative deepening (L1-L7 levels)
      - Permission matrix (role × state × operation)
    input: "PRD document, business requirement description, process docs"
    output: "Structured business analysis report (12-section format)"
    dependencies: []
    downstream_feeds: [api-design, db-query, java-spring]
    triggers: ["PRD", "需求分析", "5W1H", "用例", "CRUD", "业务分析"]
    dispatch:
      method: task
      category: deep
      load_skills: ["ba"]

  baseline:
    path: baseline
    skill_name: baseline
    description: "当用户需要扫描原始业务文件并提取结构化业务基线数据时使用。不要用于需求分析、PRD编写、功能设计。Use when user needs to scan raw business documents and extract structured business baseline data. Do NOT use for requirement analysis, PRD writing, or feature design."
    capabilities:
      - 12-category business element extraction
      - Organization & personnel extraction
      - Clause constraints & policy requirements extraction
      - Business process & key node extraction
      - Goals, problems, system constraints extraction
    input: "Raw business documents (docx, xlsx, pdf, md, images)"
    output: "Business Baseline Document (14-section format)"
    dependencies: []
    downstream_feeds: [ba]
    triggers: ["基线", "条款提取", "制度分析", "组织架构", "baseline"]
    dispatch:
      method: task
      category: deep
      load_skills: ["baseline"]

  bug-fixer:
    path: bug-fixer
    skill_name: bug-fixer
    description: "当用户报告Bug、错误、功能异常或需要调试时使用。不要用于功能开发或代码重构。Use when user reports bugs, errors, broken functionality, or needs debugging. Do NOT use for feature development or refactoring."
    capabilities:
      - Bug triage (3-element extraction: feature/expected/actual)
      - Root cause hypothesis with confidence scoring
      - Impact analysis (vertical, horizontal, depth, constraint)
      - Multi-solution comparison and selection
      - Change checklist with rollback plan
    input: "Bug description, error logs, stack traces, code files"
    output: "Fix implementation + change checklist + rollback plan"
    dependencies: []
    triggers: ["bug", "修复", "报错", "不对", "debug", "调试", "fix", "出了点问题", "不工作"]
    dispatch:
      method: task
      category: deep
      load_skills: ["bug-fixer"]

  bpm-workflow:
    path: bpm-workflow
    skill_name: bpm-workflow
    description: "当用户需要 BPM 审批流程设计、节点配置、会签/或签设置、穿透逻辑或 BizInfo 传递时使用。不要用于业务需求分析或代码实现。Use when user needs BPM approval workflow design, node configuration, countersign/or-sign settings, penetration logic, or BizInfo transfer. Do NOT use for business requirement analysis or code implementation."
    capabilities:
      - Approval flow design and node configuration
      - Countersign (会签) / or-sign (或签) configuration
      - Penetration logic (穿透) design
      - BizInfo transfer between workflow nodes
    input: "Business process requirements, approval rules"
    output: "BPM workflow configuration and design doc"
    dependencies: [ba]
    triggers: ["bpm", "审批", "workflow", "flow", "流程", "节点"]
    dispatch:
      method: task
      category: deep
      load_skills: ["bpm-workflow"]

# ---- Tools / 工具类 ----
tools:
  git-safe:
    path: git-safe
    skill_name: git-safe
    description: "当需要任何 git 操作时必须使用此技能：commit、branch、merge、rebase、stash。防止危险错误。Use when ANY git operation is needed - commit, branch, merge, rebase, stash. This skill MUST be used for ALL git operations to prevent dangerous mistakes."
    capabilities:
      - Safe commit with pre-commit validation
      - Branch management with protection rules
      - Merge/rebase with conflict detection
      - Sensitive data leak prevention
      - Conventional Commits enforcement
    input: "Git repository path"
    output: "Git operation result with safety report"
    dependencies: []
    triggers: ["git", "commit", "branch", "merge", "rebase", "stash", "提交", "分支", "合并", "冲突解决"]
    dispatch:
      method: task
      category: quick
      load_skills: ["git-safe"]

  git-workflow:
    path: git-workflow
    skill_name: git-workflow
    description: "当用户需要 git 工作流指导时使用：分支管理、cherry-pick、rebase、stash、冲突解决。使用 config/git.yaml 进行仓库设置。Use when user needs git workflow guidance: branch management, cherry-pick, rebase, stash, or conflict resolution. Uses config/git.yaml for repository settings."
    capabilities:
      - Branch strategy design (GitFlow, trunk-based)
      - Cherry-pick operations with conflict handling
      - Stash management and recovery
      - Merge conflict resolution guidance
      - Configuration-driven remote operations
    input: "Git context (branches, remotes, history)"
    output: "Workflow instructions or conflict resolution steps"
    dependencies: []
    triggers: ["git workflow", "cherry pick", "stash", "冲突", "PR", "推送", "pull"]
    dispatch:
      method: task
      category: quick
      load_skills: ["git-workflow"]

  file-ops:
    path: file-ops
    skill_name: file-ops
    description: "当用户需要批量文件操作时使用：查找替换、编码转换、文件重命名、目录分析。不要用于单文件操作或 git 操作。Use when user needs batch file operations: find/replace, encoding conversion, file rename, or directory analysis. Do NOT use for single file operations or git operations."
    capabilities:
      - Batch find and replace across files (regex/glob support)
      - Encoding detection and conversion (UTF-8/GBK/ISO-8859-1)
      - File batch rename with preview
      - Directory structure analysis
    input: "Directory path, operation parameters"
    output: "Operation results with change summary"
    dependencies: []
    triggers: ["file ops", "文件操作", "批量替换", "编码转换", "rename files"]
    dispatch:
      method: task
      category: quick
      load_skills: ["file-ops"]

  json-utils:
    path: json-utils
    skill_name: json-utils
    description: "当用户需要 JSON/YAML 处理时使用：解析、格式化、格式转换、Schema 验证。不要用于文件操作或数据迁移。Use when user needs JSON/YAML parsing, formatting, format conversion, or schema validation. Do NOT use for file operations or data migration."
    capabilities:
      - JSON parsing and validation
      - Format beautification (jq/python json.tool)
      - Format conversion (JSON ↔ YAML ↔ XML)
      - JSON Schema validation with error reporting
    input: "JSON or YAML content or file path"
    output: "Processed/formatted/converted data"
    dependencies: []
    triggers: ["json", "yaml", "parse json", "format json", "json to yaml", "yaml to json"]
    dispatch:
      method: task
      category: quick
      load_skills: ["json-utils"]

  regex-helper:
    path: regex-helper
    skill_name: regex-helper
    description: "当用户需要正则表达式帮助时使用：正则生成、模式匹配、正则调试、语言特定语法。不要用于无正则的简单文本搜索。Use when user needs regex generation, pattern matching help, regex debugging, or language-specific regex syntax. Do NOT use for simple text search without regex."
    capabilities:
      - Regex pattern generation from description
      - Regex testing against sample data
      - Debugging regex patterns with explanation
      - Language-specific syntax adaptation (JS/Java/Python)
    input: "Pattern description or existing regex + test data"
    output: "Working regex pattern with test results and language notes"
    dependencies: []
    triggers: ["regex", "正则", "regular expression", "pattern match", "正则表达式"]
    dispatch:
      method: task
      category: quick
      load_skills: ["regex-helper"]

  batch-rename:
    path: batch-rename
    skill_name: batch-rename
    description: "当用户需要批量重命名文件时使用：正则模式、序列号、大小写转换。不要用于单文件重命名。Use when user needs to batch rename files with regex patterns, sequence numbers, or case conversion. Do NOT use for single file renames."
    capabilities:
      - Regex-based rename with capture groups
      - Sequence number insertion with custom prefix
      - Case conversion (upper/lower/title)
      - Dry-run preview mode
    input: "Directory path, rename pattern or prefix configuration"
    output: "Rename preview + execution result"
    dependencies: []
    triggers: ["batch rename", "批量重命名", "rename files", "文件名修改"]
    dispatch:
      method: task
      category: quick
      load_skills: ["batch-rename"]

  env-validator:
    path: env-validator
    skill_name: env-validator
    description: "当用户需要环境验证时使用：工具版本检查、安装前诊断。不要用于安装或升级工具。Use when user needs environment validation, tool version checks, or pre-setup diagnostics. Do NOT use to install or upgrade tools."
    capabilities:
      - Node.js version check (≥14)
      - Java/JDK version check (≥8)
      - Maven/Gradle version check
      - Git version check
      - npm/pnpm/yarn version check
      - Disk space verification
    input: "None (auto-detects)"
    output: "Environment validation report with version details"
    dependencies: []
    triggers: ["env check", "environment", "环境检查", "version check"]
    dispatch:
      method: task
      category: quick
      load_skills: ["env-validator"]

  project-stats:
    path: project-stats
    skill_name: project-stats
    description: "当用户需要代码统计时使用：代码行数、文件分布分析、项目规模指标。Use when user needs code statistics, line counts, file distribution analysis, or project size metrics."
    capabilities:
      - Code line count by language
      - File type distribution analysis
      - Top 10 largest files identification
      - Git commit activity analysis
      - Exclusion support (node_modules, dist, .git)
    input: "Project directory path"
    output: "Project statistics report with metrics breakdown"
    dependencies: []
    triggers: ["project stats", "stats", "统计", "代码行数", "lines of code"]
    dispatch:
      method: task
      category: quick
      load_skills: ["project-stats"]

  evo-tracker:
    path: evo-tracker
    skill_name: evo-tracker
    description: "当用户需要追踪项目演进时使用：记录版本变更、生成 changelog、目录快照、维护演进历史。不要用于 git commit 追踪（git 已处理）。Use when user wants to track project evolution: record version changes, generate changelog entries, snapshot directory structure, or maintain an evolution history for their requirement/code project. Do NOT use for git-level commit tracking (git already handles that)."
    capabilities:
      - 项目版本自动记录 (semver 版本管理)
      - Changelog 生成 (feat/fix/refactor/docs 分类)
      - 目录结构快照 (markdown tree 格式)
      - 演进报告生成 (版本时间线 + 变更统计)
      - .evo/ 目录自动初始化与维护
    input: "User description of change, target version bump"
    output: "Updated .evo/VERSION + .evo/EVOLUTION.md + optional snapshot"
    dependencies: []
    triggers: ["记录变更", "版本记录", "changelog", "演进记录", "目录快照", "版本历史", "变更追踪", "evolution", "snapshot", "track changes", "milestone"]
    dispatch:
      method: task
      category: quick
      load_skills: ["evo-tracker"]

  cockpit-page-builder:
    path: cockpit-page-builder
    skill_name: cockpit-page-builder
    description: "当用户需要生成驾驶舱(数据看板)静态HTML页面时使用。基于V5布局设计文档和PRD指标规范。不要用于一般HTML页面生成或Vue组件开发。Use when user needs to generate cockpit (dashboard) static HTML pages. Based on V5 layout design document and PRD metric specifications. Do NOT use for general HTML page generation or Vue component development."
    capabilities:
      - 驾驶舱页面生成 (基于V5布局设计文档)
      - PRD指标规范解析和应用
      - 静态HTML页面构建
      - 数据看板布局设计
      - ECharts图表模板应用
      - detail-link导航设计
    input: "PRD specifications, dashboard requirements, metric definitions, role (R1/R2/etc)"
    output: "Static HTML dashboard page with ECharts and detail-link navigation"
    dependencies: []
    triggers: ["驾驶舱", "数据看板", "dashboard", "cockpit", "静态HTML", "HTML页面"]
    dispatch:
      method: task
      category: deep
      load_skills: ["cockpit-page-builder"]

  style-optimizer:
    path: style-optimizer
    skill_name: style-optimizer
    description: "专门优化前端HTML/CSS/JS显示效果。当需要调整页面样式、优化UI组件、统一设计语言时使用。Use when optimizing page styles, improving UI components, or standardizing design language. Do NOT use for backend logic or data changes."
    capabilities:
      - CSS变量管理与设计系统建立
      - 组件样式模式（折叠/明细/抽屉三模式分离）
      - 迷你卡片网格布局优化
      - 响应式断点优化（XL/LG/MD/SM四档）
      - 抽屉侧滑面板样式
      - 图表交互动画优化
      - KPI数字卡片样式系统
      - 时间范围选择器UI
    input: "HTML/CSS files with styling issues"
    output: "Optimized styles with no regressions"
    dependencies: []
    triggers: ["优化样式", "调整样式", "美化", "优化UI", "调整显示", "改样式", "样式不对", "界面优化", "卡片样式", "图表样式", "布局优化", "optimize style", "fix css", "polish ui", "visual polish"]
    dispatch:
      method: task
      category: visual-engineering
      load_skills: ["style-optimizer"]

# ---- Expert Domain Skills ----
expert:
  api-design:
    path: api-design
    skill_name: api-design
    description: "当用户需要 RESTful API 设计时使用：Spring Boot Controller 结构、Swagger/OpenAPI 文档、请求/响应 DTO 设计、统一分页格式。不要用于数据库设计（用 db-query）、后端实现（用 java-spring）或前端工作（用 vue-component）。Use when user needs RESTful API design, Spring Boot Controller structure, Swagger/OpenAPI documentation, request/response DTO design, or unified pagination format. Do NOT use for database design (use db-query), backend implementation (use java-spring), or frontend work (use vue-component)."
    capabilities:
      - RESTful Controller design (Spring Boot pattern)
      - Swagger/OpenAPI annotation (@ApiOperation)
      - Request/Response DTO design
      - Unified pagination (Page<T> with pageStart/pageSize)
      - Resource naming conventions (GET/POST/PUT/DELETE mapping)
    input: "Feature/domain description, entity definitions (from BA output)"
    output: "Controller + DTO code with Swagger annotations"
    dependencies: [ba]
    downstream_feeds: [java-spring]
    triggers: ["api", "rest", "controller", "swagger", "接口", "endpoint"]
    dispatch:
      method: task
      category: deep
      load_skills: ["api-design"]

  java-spring:
    path: java-spring
    skill_name: java-spring
    description: "当用户需要 Spring Boot 后端实现时使用：MyBatis 通用 Mapper、OpExample/OpSql、Flyway 迁移、定时任务、多租户数据源或构造器注入模式。不要用于 API 设计（用 api-design）、数据库查询（用 db-query）或 Vue 前端（用 vue-component）。Use when user needs Spring Boot backend implementation: MyBatis general mapper, OpExample/OpSql, Flyway migrations, scheduled tasks, multi-tenant datasource, or constructor injection patterns. Do NOT use for API design (use api-design), database queries (use db-query), or Vue frontend (use vue-component)."
    capabilities:
      - Constructor injection (no @Autowired fields)
      - MyBatis general mapper for single-table CRUD
      - OpExample/OpSql for complex queries
      - Flyway migration scripts
      - Scheduled tasks with super.logger
      - Multi-tenant datasource (org_id isolation)
      - SQL formatting (keywords uppercase, commas at line start)
    input: "API design specs, database schema, feature requirements"
    output: "Service/Controller/DAO implementation code"
    dependencies: [api-design, db-query]
    triggers: ["java", "spring", "spring boot", "mybatis", "flyway", "maven"]
    dispatch:
      method: task
      category: deep
      load_skills: ["java-spring"]

  db-query:
    path: db-query
    skill_name: db-query
    description: "当用户需要进行数据库设计时使用：MySQL优化、Flyway DDL、复杂JOIN、子查询、索引建议。不要用于Java后端（用java-spring）或API设计（用api-design）。Use when user needs database design: MySQL optimization, Flyway DDL, complex JOINs, subqueries, index recommendations. Do NOT use for Java backend (use java-spring) or API design (use api-design)."
    capabilities:
      - MySQL query optimization
      - Flyway migration script creation
      - Complex JOIN and subquery design
      - Index strategy recommendations
      - OpesPro SQL standards (comma-first, org_id first)
      - Large table optimization (filter before JOIN)
    input: "Table schemas, query requirements, performance issues"
    output: "Optimized SQL + index recommendations + Flyway scripts"
    dependencies: [ba]
    downstream_feeds: [java-spring]
    triggers: ["sql", "mysql", "flyway", "query", "join", "index", "数据库"]
    dispatch:
      method: task
      category: deep
      load_skills: ["db-query"]

  vue-component:
    path: vue-component
    skill_name: vue-component
    description: "当用户需要 Vue 2 组件开发时使用：Pug 模板、SCSS 样式、Element UI 组件、表格查询/表单弹窗模式或组件通信。不要用于 API 设计（使用 api-design）或后端工作（使用 java-spring）。Use when user needs Vue 2 component development: Pug templates, SCSS styles, Element UI components, table query/form dialog patterns, or component communication. Do NOT use for API design (use api-design) or backend work (use java-spring)."
    capabilities:
      - Vue 2 + Pug template syntax (indentation-based)
      - SCSS scoped styles with CSS variables (var(--xxx))
      - Element UI components (el-table, el-form, el-dialog)
      - op-query-table → common-query-table → GridTable pattern
      - op-biz-block-form-dialog standard block form
      - Component communication (props, $emit, provide/inject, Vuex)
      - File panel column configuration
    input: "UI design specs, API endpoint definitions"
    output: "Vue component code (.vue files with Pug + SCSS)"
    dependencies: [api-design]
    triggers: ["vue", "pug", "scss", "element ui", "component", "组件", "el-table"]
    dispatch:
      method: task
      category: visual-engineering
      load_skills: ["vue-component"]

  data-migration:
    path: data-migration
    skill_name: data-migration
    description: "当用户需要数据迁移时使用：表结构同步、批量数据迁移、迁移脚本或回滚方案。不要用于简单数据库查询（用 db-query）。Use when user needs data migration: table structure sync, batch data migration, migration scripts, or rollback plans. Do NOT use for simple database queries (use db-query)."
    capabilities:
      - Single table sync with @Transactional
      - Batch insert with deduplication
      - File migration (BizInfo copyTo pattern)
      - Idempotent migration (safe to re-run)
      - Rollback SQL generation
      - Logging (success/fail/skip counts)
    input: "Source/target table schemas, migration requirements"
    output: "Migration scripts + rollback SQL + execution log"
    dependencies: [db-query]
    triggers: ["migration", "迁移", "data migration", "sync", "batch insert"]
    dispatch:
      method: task
      category: deep
      load_skills: ["data-migration"]

  refactor-plan:
    path: refactor-plan
    skill_name: refactor-plan
    description: "当用户需要重构设计时使用：分析代码结构、提取公共逻辑、拆分过长方法（>50行）、消除重复代码（>3次出现）、规划安全重命名。不要用于单一 bug 修复（使用 bug-fixer）或基础代码质量检查（使用 code-quality）。Use when user needs refactoring design: analyze code structure, extract common logic, break large methods (>50 lines), eliminate duplicate code (>3 occurrences), or plan safe renames. Do NOT use for single bug fixes (use bug-fixer) or basic code quality checks (use code-quality)."
    capabilities:
      - Refactoring target identification and prioritization
      - Extract Method (methods > 50 lines)
      - Extract Interface (multiple implementations)
      - Duplicate code elimination (> 3 occurrences)
      - Safe rename with IDE refactoring tools
      - OpesPro conventions preservation (constructor injection, OpExample style)
    input: "Code directory or file list to refactor"
    output: "Step-by-step refactoring plan with verification checkpoints"
    dependencies: [code-review, code-quality]
    triggers: ["refactor", "重构", "extract method", "duplicate code", "重复代码"]
    dispatch:
      method: task
      category: deep
      load_skills: ["refactor-plan"]

# ---- Meta Skills / 元技能 ----
meta:
  skill-maintainer:
    path: skill-maintainer
    skill_name: skill-maintainer
    description: "当需要技能维护时使用：深度扫描所有 SKILL.md，对比模板检测缺失项、过时模式、格式不一致。不要用于单个技能编辑或一次性修复。"
    capabilities:
      - Skill file structure validation
      - Trigger keyword coverage check
      - Skill dependency graph analysis
      - Missing documentation detection
    input: "Skills directory path"
    output: "Maintenance report with issues by severity"
    dependencies: []
    triggers: ["skill maintain", "技能维护", "skill audit"]
    dispatch:
      method: task
      category: deep
      load_skills: ["skill-maintainer"]

  skill-refresh:
    path: skill-refresh
    skill_name: skill-refresh
    description: "当修改 SKILL.md 后需要刷新技能缓存时使用。不要用于普通技能执行或不相关任务。"
    capabilities:
      - Cache refresh via refresh.js
      - Post-commit hook auto-trigger
      - Skill reload without restart
    input: "Git commit trigger or manual invocation"
    output: "Cache refresh confirmation"
    dependencies: []
    triggers: ["skill refresh", "reload skills", "refresh cache"]
    dispatch:
      method: bash
      command: "node skill-refresh/scripts/refresh.js"

# ---- Entry Points (L0) ----
entry_points:
  easy:
    path: easy
    skill_name: easy
    description: "当用户用自然语言描述需求时使用，自动分析意图并路由到最佳子技能。不要用于已知技能名时（用 expert）。Use when user describes a need in natural language — auto-analyze intent and route to best sub-skill. Do NOT use when skill name is explicitly given (use expert) or for complex multi-skill orchestration (use auto)."
    capabilities:
      - Natural language intent analysis
      - Automatic skill routing via trigger keyword matching
      - AI fallback for ambiguous queries
    input: "Natural language task description"
    output: "Routed skill execution result"
    triggers: ["easy", "简单", "快速", "帮我", "怎么", "如何"]
    agent_profile: router
    dispatch:
      method: skill
      skill_name: easy

  expert:
    path: expert
    skill_name: expert
    description: "当用户明确指定技能名直接调用时使用，支持中英文名称和完整参数控制。不要用于意图不明确时（用 easy）或复杂多技能协作时（用 auto）。Use when user explicitly specifies a skill name (Chinese or English) with full parameter control. Do NOT use when the skill name is unknown (use easy) or for complex multi-skill orchestration (use auto)."
    capabilities:
      - Direct skill access by name
      - Full parameter passing
      - Skill catalog browsing
    input: "Skill name + parameters"
    output: "Target skill execution result"
    triggers: ["expert", "专家", "完整", "深度", "自定义"]
    agent_profile: specialist

  auto:
    path: auto
    skill_name: auto
    description: "当需要编排复杂目标时使用：拆解为可执行子任务、并行调度、汇总结果。不要用于单一技能任务（用 easy）或已知技能名时（用 expert）。Use when you need orchestration of complex goals: decompose into executable sub-tasks, dispatch in parallel, and aggregate results. Do NOT use for single-skill tasks (use easy) or when skill name is already known (use expert)."
    capabilities:
      - Goal analysis and decomposition
      - Multi-skill orchestration via task()
      - Parallel sub-task execution
      - Result aggregation into Auto Execution Report
    input: "Complex goal description"
    output: "Aggregated execution report"
    triggers: ["auto", "编排", "复合", "全面", "完整实现"]
    agent_profile: orchestrator

# ---- Agent-Based Entry Points (L0+) ----
agent_entry_points:
  orchestrator:
    model: livedata/deepseek-v4-pro
    role: "Task orchestration and complex goal decomposition"
    capabilities:
      - Complex goal analysis and decomposition
      - Multi-agent coordination
      - Parallel task scheduling
      - Result aggregation and synthesis
    dispatch:
      method: task
      category: deep
      load_skills: ["auto"]
      
  router:
    model: livedata/glm-4.7
    role: "Intent recognition and skill routing"
    capabilities:
      - Natural language understanding
      - Intent classification
      - Skill matching and routing
      - Fallback handling for ambiguous queries
    dispatch:
      method: task
      category: quick
      load_skills: ["easy"]
      
  specialist:
    model: livedata/qwen3-coder-plus
    role: "Domain-specific expertise and implementation"
    capabilities:
      - Deep domain knowledge application
      - Technical implementation
      - Quality assurance and validation
      - Best practices enforcement
    dispatch:
      method: task
      category: deep
      load_skills: ["expert"]

# ---- Common Task Patterns / 常见任务编排模式 ----
patterns:
  full_module_implementation:
    name: "Complete Module Implementation"
    description: "实现完整的业务模块（前端+后端+数据库+安全审计）"
    sequence:
      - step: 1
        skill: ba
        goal: "分析业务需求，输出功能规格和CRUD矩阵"
        parallel: false
      - step: 2
        skills: [db-query, api-design]
        goal: "并行设计数据库表结构和RESTful API"
        parallel: true
        depends_on: [1]
      - step: 3
        skills: [java-spring, vue-component]
        goal: "并行实现后端Service/Controller和前端Vue组件"
        parallel: true
        depends_on: [2]
      - step: 4
        skills: [security-check, code-review]
        goal: "并行进行安全审计和代码审查"
        parallel: true
        depends_on: [3]

  quality_audit:
    name: "Full Quality Audit"
    description: "全面的代码质量审计（安全+质量+依赖+Lint）- 全部并行执行"
    sequence:
      - step: 1
        skills: [security-check, code-review, code-quality, deps-check, linter-expert]
        goal: "并行运行所有质量检查"
        parallel: true

  security_and_review:
    name: "Security + Code Review"
    description: "安全审计和代码审查组合 - 并行执行"
    sequence:
      - step: 1
        skills: [security-check, code-review]
        goal: "并行进行安全审计和代码审查"
        parallel: true

  dependency_health:
    name: "Dependency Health Check"
    description: "依赖健康状况检查（版本/CVE/循环/冗余）"
    sequence:
      - step: 1
        skill: deps-check
        goal: "检查项目依赖版本、漏洞和冗余"
        parallel: false

  code_quality_deep:
    name: "Code Quality Deep Dive"
    description: "深入的代码质量分析 — 代码审查+质量分析+静态检查并行"
    sequence:
      - step: 1
        skills: [code-review, code-quality, linter-expert]
        goal: "并行进行代码审查、质量分析和静态检查"
        parallel: true

  bug_to_fix_cycle:
    name: "Bug → Fix → Review Cycle"
    description: "从Bug发现到修复到验证的完整流程"
    sequence:
      - step: 1
        skill: bug-fixer
        goal: "定位Bug根因并实施修复"
        parallel: false
      - step: 2
        skills: [code-review, security-check]
        goal: "审查修复代码的质量和安全性"
        parallel: true
        depends_on: [1]

  refactor_cycle:
    name: "Refactor Cycle"
    description: "重构分析→方案设计→实施→验证"
    sequence:
      - step: 1
        skills: [code-review, code-quality]
        goal: "并行分析代码问题"
        parallel: true
      - step: 2
        skill: refactor-plan
        goal: "基于分析结果设计重构方案"
        parallel: false
        depends_on: [1]

  requirement_analysis:
    name: "Requirement Analysis Pipeline"
    description: "从业务基线到业务分析的完整流程"
    sequence:
      - step: 1
        skill: baseline
        goal: "从原始业务文档中提取结构化业务基线"
        parallel: false
      - step: 2
        skill: ba
        goal: "基于业务基线进行完整的业务需求分析"
        parallel: false
        depends_on: [1]

  bpm_design_flow:
    name: "BPM Approval Workflow Design"
    description: "从业务分析到BPM审批流程设计的完整流程"
    sequence:
      - step: 1
        skill: ba
        goal: "分析业务需求，输出功能规格和CRUD矩阵"
        parallel: false
      - step: 2
        skill: bpm-workflow
        goal: "基于业务分析结果设计BPM审批流程"
        parallel: false
        depends_on: [1]

  git_operations:
    name: "Git Operations Bundle"
    description: "组合 git-safe 和 git-workflow 进行完整的 Git 操作"
    sequence:
      - step: 1
        skills: [git-safe, git-workflow]
        goal: "并行使用安全Git操作和工作流管理"
        parallel: true

  file_batch_ops:
    name: "File Batch Operations Bundle"
    description: "组合 file-ops 和 batch-rename 进行批量文件处理"
    sequence:
      - step: 1
        skills: [file-ops, batch-rename]
        goal: "并行进行内容替换和文件重命名"
        parallel: true

  env_health_check:
    name: "Environment Health Check Bundle"
    description: "组合 env-validator 和 project-stats 进行环境和项目健康检查"
    sequence:
      - step: 1
        skills: [env-validator, project-stats]
        goal: "并行进行环境验证和项目统计"
        parallel: true

  skills_maintenance:
    name: "Skills Maintenance Cycle"
    description: "技能工程自身的维护流程：审计 → 刷新 → 验证"
    sequence:
      - step: 1
        skill: skill-maintainer
        goal: "审计所有技能的一致性和完整性"
        parallel: false
      - step: 2
        skill: skill-refresh
        goal: "刷新技能缓存使变更生效"
        parallel: false
        depends_on: [1]

  cockpit_page_generation:
    name: "Cockpit Page Generation"
    description: "从V5 PRD文档到驾驶舱HTML页面的完整生成流程"
    sequence:
      - step: 1
        skill: cockpit-page-builder
        goal: "加载V5 PRD文档（布局设计文档和指标规范）"
        parallel: false
      - step: 2
        skill: cockpit-page-builder
        goal: "确认角色身份（R1董事长 / R2总经理 / etc）和访问权限"
        parallel: false
        depends_on: [1]
      - step: 3
        skill: cockpit-page-builder
        goal: "生成静态HTML页面，集成ECharts图表模板和detail-link导航"
        parallel: false
        depends_on: [2]

# ---- Agent-Based Workflow Patterns / 基于代理的工作流模式 ----
agent_patterns:
  orchestrator_driven_complex_task:
    name: "Orchestrator-Driven Complex Task"
    description: "由orchestrator代理驱动的复杂任务编排，适用于需要多步骤分解和协调的场景"
    agent_profile: orchestrator
    sequence:
      - step: 1
        agent: orchestrator
        goal: "分析复杂目标并分解为可执行子任务"
        parallel: false
      - step: 2
        agents: [router, specialist]
        goal: "并行路由子任务到合适的specialist代理"
        parallel: true
        depends_on: [1]
      - step: 3
        agent: orchestrator
        goal: "聚合结果并生成最终报告"
        parallel: false
        depends_on: [2]

  router_specialist_simple_task:
    name: "Router-Specialist Simple Task"
    description: "由router代理识别意图并路由到specialist代理执行的简单任务"
    agent_profile: router
    sequence:
      - step: 1
        agent: router
        goal: "分析用户意图并确定最佳specialist代理"
        parallel: false
      - step: 2
        agent: specialist
        goal: "执行具体的领域专业任务"
        parallel: false
        depends_on: [1]

  multi_agent_quality_assurance:
    name: "Multi-Agent Quality Assurance"
    description: "多代理协同的质量保证流程，orchestrator协调多个specialist代理进行并行检查"
    agent_profile: orchestrator
    sequence:
      - step: 1
        agent: orchestrator
        goal: "启动质量保证流程并分配检查任务"
        parallel: false
      - step: 2
        agents: [specialist, specialist, specialist, specialist, specialist]
        skills: [security-check, code-review, code-quality, deps-check, linter-expert]
        goal: "并行执行安全、代码审查、质量、依赖和静态检查"
        parallel: true
        depends_on: [1]
      - step: 3
        agent: orchestrator
        goal: "汇总所有检查结果并生成综合质量报告"
        parallel: false
        depends_on: [2]

  agent_based_refactoring_workflow:
    name: "Agent-Based Refactoring Workflow"
    description: "基于代理的重构工作流，从问题识别到方案实施的完整流程"
    agent_profile: orchestrator
    sequence:
      - step: 1
        agents: [specialist, specialist]
        skills: [code-review, code-quality]
        goal: "并行分析代码质量和问题"
        parallel: true
      - step: 2
        agent: specialist
        skill: refactor-plan
        goal: "基于分析结果设计重构方案"
        parallel: false
        depends_on: [1]
      - step: 3
        agent: specialist
        skill: java-spring
        goal: "实施重构方案"
        parallel: false
        depends_on: [2]
      - step: 4
        agent: orchestrator
        goal: "验证重构结果并确保向后兼容性"
        parallel: false
        depends_on: [3]
