@agile-team/wl-skills-kit 1.2.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/README.md +169 -366
  3. package/bin/wl-skills.js +149 -43
  4. package/files/.github/copilot-instructions.md +105 -42
  5. package/files/.github/guides/README.md +13 -0
  6. package/files/.github/guides/architecture.md +555 -0
  7. package/files/.github/guides/usage.md +166 -0
  8. package/files/.github/reports/README.md +65 -0
  9. package/files/.github/reports/SYS_DICT_INFO.md +19 -0
  10. package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -0
  11. package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -0
  12. package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -0
  13. package/files/.github/skills/_compat/README.md +108 -0
  14. package/files/.github/skills/_compat/editors.json +61 -0
  15. package/files/.github/skills/_compat/headers/agents.txt +8 -0
  16. package/files/.github/skills/_compat/headers/claude-code.txt +7 -0
  17. package/files/.github/skills/_compat/headers/cline.txt +7 -0
  18. package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -0
  19. package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -0
  20. package/files/.github/skills/_compat/headers/github-copilot.txt +1 -0
  21. package/files/.github/skills/_compat/headers/kiro.txt +10 -0
  22. package/files/.github/skills/_compat/headers/trae.txt +11 -0
  23. package/files/.github/skills/_compat/headers/windsurf.txt +7 -0
  24. package/files/.github/skills/_registry.md +81 -0
  25. package/files/.github/skills/{api-contract → core/api-contract}/SKILL.md +126 -29
  26. package/files/.github/skills/core/api-contract/USAGE.md +110 -0
  27. package/files/.github/skills/core/convention-audit/SKILL.md +189 -0
  28. package/files/.github/skills/core/convention-audit/USAGE.md +99 -0
  29. package/files/.github/skills/{page-codegen → core/page-codegen}/SKILL.md +67 -22
  30. package/files/.github/skills/core/page-codegen/USAGE.md +102 -0
  31. package/files/.github/skills/core/page-codegen/templates/_index.md +46 -0
  32. package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -0
  33. package/files/.github/skills/{page-codegen → core/page-codegen/templates/domains/produce}/TPL-OPERATION-STATION.md +442 -442
  34. package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -0
  35. package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DETAIL-TABS.md +94 -39
  36. package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DRIVEN.md +124 -124
  37. package/files/.github/skills/{prototype-scan → core/prototype-scan}/SKILL.md +87 -3
  38. package/files/.github/skills/core/prototype-scan/USAGE.md +95 -0
  39. package/files/.github/skills/core/template-extract/SKILL.md +139 -0
  40. package/files/.github/skills/core/template-extract/USAGE.md +93 -0
  41. package/files/.github/skills/domain/README.md +51 -0
  42. package/files/.github/skills/ops/code-fix/SKILL.draft.md +108 -0
  43. package/files/.github/skills/sync/dict-sync/SKILL.draft.md +100 -0
  44. package/files/.github/skills/{menu-sync → sync/menu-sync}/SKILL.md +258 -258
  45. package/files/.github/skills/sync/menu-sync/USAGE.md +104 -0
  46. package/files/.github/skills/{menu-sync → sync/menu-sync}/env/guide.md +83 -83
  47. package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -0
  48. package/files/.github/standards/01-toolchain.md +57 -0
  49. package/files/.github/standards/02-code-structure.md +111 -0
  50. package/files/.github/standards/03-comments.md +53 -0
  51. package/files/.github/standards/04-coding-basics.md +33 -0
  52. package/files/.github/standards/05-logging.md +38 -0
  53. package/files/.github/standards/06-security.md +44 -0
  54. package/files/.github/standards/07-config.md +52 -0
  55. package/files/.github/standards/08-git.md +60 -0
  56. package/files/.github/standards/09-typescript.md +71 -0
  57. package/files/.github/standards/10-pinia.md +57 -0
  58. package/files/.github/standards/11-form-validation.md +81 -0
  59. package/files/.github/standards/12-base-table.md +116 -0
  60. package/files/.github/standards/13-platform-components.md +123 -0
  61. package/files/.github/standards/index.md +89 -0
  62. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
  63. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
  64. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
  65. package/files/docs/jh-date-range.md +257 -257
  66. package/files/docs/jh-date.md +222 -222
  67. package/files/docs/jh-dept-picker.md +190 -190
  68. package/files/docs/jh-drag-row.md +590 -590
  69. package/files/docs/jh-file-upload.md +216 -216
  70. package/files/docs/jh-picker.md +218 -218
  71. package/files/docs/jh-select.md +148 -148
  72. package/files/docs/jh-text.md +248 -248
  73. package/files/docs/jh-user-picker.md +197 -197
  74. package/package.json +4 -1
  75. package/files/.github/docs/menu-sync-design.md +0 -264
  76. package/files/.github/docs/use-skill.md +0 -382
  77. package/files/.github/docs/wl-skills-kit.md +0 -266
  78. package/files/.github/skills/convention-extract/SKILL.md +0 -236
  79. /package/files/.github/{docs → reports}/SYS_MENU_INFO.md +0 -0
  80. /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-CHANGE-HISTORY.md +0 -0
  81. /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-FORM-ROUTE.md +0 -0
  82. /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-LIST.md +0 -0
  83. /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-MASTER-DETAIL.md +0 -0
  84. /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-RECORD-FORM.md +0 -0
  85. /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-TREE-LIST.md +0 -0
  86. /package/files/.github/skills/{menu-sync → sync/menu-sync}/env/env.local.json +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: prototype-scan
3
- description: "Use when: analyzing Axure exported HTML prototype files to extract page inventory, classify interaction patterns, identify reusable components, and produce a structured page checklist for Vue development. Also supports detailed design documents (MD/Word) as input. Triggers on: prototype analysis, axure scan, page inventory, 原型解析, 页面清单, axure转vue, 详设文档, design doc, 详细设计."
3
+ description: "Use when: analyzing Axure exported HTML prototype files to extract page inventory, classify interaction patterns, identify reusable components, and produce a structured page checklist for Vue development. Also supports detailed design documents (MD/Word) or natural language descriptions as input. Triggers on: prototype analysis, axure scan, page inventory, 原型解析, 页面清单, axure转vue, 详设文档, design doc, 详细设计, 口述需求, 自然语言建页面, natural language page request, 建个页面, 写个页面, 口头描述页面."
4
4
  ---
5
5
 
6
6
  # Skill: 原型解析(prototype-scan)
@@ -11,8 +11,92 @@ description: "Use when: analyzing Axure exported HTML prototype files to extract
11
11
 
12
12
  ## 触发
13
13
 
14
- - **模式 A(Axure)**:提供 Axure HTML 文件包目录,AI 全量扫描 HTML
15
- - **模式 B(详设文档)**:提供 MD/Word/表格格式的详细设计文档,AI 解析结构化字段
14
+ | 模式 | 输入 | 典型场景 |
15
+ |------|------|----------|
16
+ | **模式 0(自然语言)** | 用户口述需求,无文件 | 日常对话:"帮我建一个客户管理页面,有XX字段" |
17
+ | **模式 A(Axure)** | Axure HTML 文件包目录 | 已有原型设计,AI 全量扫描 HTML |
18
+ | **模式 B(详设文档)** | MD/Word/表格格式的详细设计文档 | 已有详细设计文档,AI 解析结构化字段 |
19
+
20
+ ---
21
+
22
+ ## 模式 0 — 自然语言转 page-spec(内部步骤)
23
+
24
+ > **核心原则**:模式 0 是 AI 的**内部推导流程**,不输出中间 JSON 给用户。
25
+ > AI 从口述中提取信息 → 内部构建 page-spec JSON → 直接传递给 page-codegen 消费。
26
+ > **不向用户索要文件**,用注释标注不确定项即可。
27
+
28
+ ### 1. 提取关键信息
29
+
30
+ 从用户口述中识别以下实体(缺省则用默认值):
31
+
32
+ | 实体 | 识别关键词示例 | 默认值 |
33
+ |------|---------------|--------|
34
+ | 页面中文名 | "XX页面" / "XX管理" / "XX档案" | 必须由用户提供 |
35
+ | 交互模式 | 见下方映射表 | `LIST` |
36
+ | 服务缩写 | "生产"→pm, "精整"→mmwr, "销售"→sale, "人力"→hrms, "基础"→base | 从目标路径推断 |
37
+ | 资源名 | 从中文名推断 CamelCase | 自动推断 |
38
+ | 目录名 | 从中文名推断 kebab-case | 自动推断 |
39
+
40
+ ### 2. 关键词 → 交互模式映射
41
+
42
+ | 用户关键词 | 推断模式 |
43
+ |-----------|----------|
44
+ | "列表" / "查询" / "管理页" / 无特殊说明 | `LIST` |
45
+ | "主从" / "明细" / "上下表" | `MASTER_DETAIL` |
46
+ | "树形" / "左树右表" | `TREE_LIST` |
47
+ | "表单" / "详情" / "多Tab表单" | `DETAIL_TABS` |
48
+ | "独立表单" / "路由表单" / "复杂表单" | `FORM_ROUTE` |
49
+ | "变更历史" / "变更记录" | `CHANGE_HISTORY` |
50
+ | "记录表单" / "无分页" | `RECORD_FORM` |
51
+ | "工位" / "操作站" | `OPERATION_STATION` |
52
+
53
+ ### 3. 内部构建 page-spec 骨架
54
+
55
+ AI 根据提取的信息,内部构建 page-spec JSON(**不输出给用户**):
56
+
57
+ ```jsonc
58
+ {
59
+ "pageName": "[用户说的中文名]",
60
+ "kebabName": "[推断的kebab-case]",
61
+ "pattern": "[推断的交互模式,默认LIST]",
62
+ "path": "views/[域]/[模块]/[子模块]/[kebab-name]/",
63
+ "query": [
64
+ // 从用户描述中提取;未提及 → 基于资源名推断 1-2 个(如"名称"、"编码")
65
+ ],
66
+ "toolbar": [
67
+ // 默认: 新增(primary) + 删除(danger);用户提及"导出""导入"等则追加
68
+ ],
69
+ "columns": [
70
+ // 从用户描述中提取;未逐一列举 → 基于资源语义推断 5-8 个常见字段
71
+ ],
72
+ "operations": [
73
+ // 默认: 编辑 + 删除;用户提及"查看""审批"等则调整
74
+ ],
75
+ "features": {
76
+ "tabSwitch": false, "viewSwitch": false, "hiddenMenu": false
77
+ },
78
+ "notes": [
79
+ "[模式0] 字段英文名为AI推断值,请确认",
80
+ "[模式0] dictCode 为推断值,请后端确认"
81
+ ]
82
+ }
83
+ ```
84
+
85
+ ### 4. 降级与默认值原则
86
+
87
+ | 信息缺失项 | 默认策略 |
88
+ |-----------|----------|
89
+ | 交互模式 | `LIST`(最常见的列表查询页) |
90
+ | 查询字段 | 基于业务资源名推断 1-2 个("名称"、"编码") |
91
+ | 工具栏按钮 | `[新增(primary), 删除(danger)]` |
92
+ | 表格列 | 基于资源语义推断 5-8 个常见字段(编码、名称、类型、状态、创建时间等) |
93
+ | 操作列 | `[编辑, 删除]` |
94
+ | 字段英文名 | AI 推断 camelCase,notes 标注"字段名为推断值" |
95
+ | 字典 code | 状态类字段自动标注推断 dictCode,notes 标注"dictCode 为推断值" |
96
+ | 子表 | 不生成(用户未提及则不推断) |
97
+ | Tab/视角切换 | 关闭(`false`) |
98
+
99
+ > 构建完成后,直接进入输出流程(同模式 A/B),为 page-codegen 提供标准 page-spec JSON。
16
100
 
17
101
  ---
18
102
 
@@ -0,0 +1,95 @@
1
+ # 使用指南:prototype-scan(原型扫描)
2
+
3
+ > **谁读这个文档**:团队成员(产品/前端/后端)
4
+ > **AI 触发文件**:同目录 `SKILL.md`(无需手动阅读)
5
+
6
+ ---
7
+
8
+ ## 这个 Skill 解决什么问题
9
+
10
+ 把零散的需求来源(HTML/PDF 原型、详设文档、口述需求、PRD),**结构化为一份《页面清单》**,作为后续 `api-contract` 和 `page-codegen` 的输入。
11
+
12
+ ---
13
+
14
+ ## 何时使用
15
+
16
+ - 产品经理给你一组 HTML 原型,要做成页面
17
+ - 拿到 Word/PDF 详设文档,需要拆解出多少个页面、各自有哪些字段
18
+ - 业务方口述需求:"给我加一个客户档案的页面,能查能改能审批……"
19
+ - 想梳理一个模块到底有哪些页面、各自什么类型
20
+
21
+ ---
22
+
23
+ ## 触发关键词
24
+
25
+ `扫描原型` / `解析原型` / `页面清单` / `详设文档` / `口述需求` / `建个页面` / `写个页面`
26
+
27
+ ---
28
+
29
+ ## 标准对话示例
30
+
31
+ ### 示例 1:HTML 原型扫描
32
+
33
+ ```
34
+ 你:扫描 docs/prototypes/客户管理/ 下的所有原型,生成页面清单。
35
+ AI:[读取 SKILL.md → 输出 Pre-flight 声明]
36
+ Pre-flight:
37
+ ├─ 来源:docs/prototypes/客户管理/ 共 7 个 HTML
38
+ ├─ 输出:reports/PROTOTYPE_SCAN_客户管理_20260426.md
39
+ └─ 不会生成代码
40
+ [扫描中... 3 分钟]
41
+ 完成,请确认页面清单:
42
+ 1. mmwr-customer-archive (LIST 类型) - 客户档案查询
43
+ 2. mmwr-customer-detail (DETAIL) - 客户详情
44
+ ... 共 7 项
45
+ ```
46
+
47
+ ### 示例 2:口述需求
48
+
49
+ ```
50
+ 你:给生产域加个炼钢批次管理,能查能改能批量审批。
51
+ AI:[输出 Pre-flight]
52
+ Pre-flight:
53
+ ├─ 来源:口述需求
54
+ ├─ 输出:reports/PROTOTYPE_SCAN_炼钢批次_20260426.md
55
+ └─ 类型推断:LIST + 弹窗编辑 + 行内审批
56
+ 需向你确认 4 项:
57
+ 1. 批次主键是 heatNo 还是 batchId?
58
+ 2. 状态字段有哪些值(已下达/进行中/已完成/作废)?
59
+ 3. 审批是单人审还是多级流转?
60
+ 4. 字典码用 ms_heat_status 还是 mmsm_heat_state?
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 输出物
66
+
67
+ `.github/reports/PROTOTYPE_SCAN_<模块>_<YYYYMMDD>.md` —— 包含:
68
+
69
+ - 页面清单表格(页面英文名 / 中文名 / 类型 / 路由 / 字段概要)
70
+ - 各页面查询条件、表格列、表单字段的初步定义
71
+ - 字典/弹窗/联动的猜测,标注 🟡 待确认
72
+
73
+ ---
74
+
75
+ ## 常见踩坑
76
+
77
+ | 现象 | 原因 | 解法 |
78
+ | --------------------------- | ---------------------- | ----------------------------------------- |
79
+ | AI 凭空臆造字段 | 原型缺失或描述模糊 | 让 AI 列"待确认"清单,逐项填空再继续 |
80
+ | 页面命名不符合 kebab-case | AI 直接用中文/驼峰命名 | 在指令里强调 "命名遵循 standards/page.md" |
81
+ | 同一字段在多页面命名不一致 | AI 没有跨页面对齐 | 要求生成清单后做一遍"字段一致性自检" |
82
+ | LIST/MASTER_DETAIL 类型错判 | 原型隐含主从结构未识别 | 显式告知"这是主从表"或贴出原型图 |
83
+
84
+ ---
85
+
86
+ ## FAQ
87
+
88
+ **Q:扫描出来的页面清单可以直接用 `page-codegen` 生成代码吗?**
89
+ A:建议先走 `api-contract` 生成 api.md,让后端确认接口字段,再 codegen。否则 data.ts 里的字段名可能和后端对不上。
90
+
91
+ **Q:能不能跳过这个 Skill 直接让 AI 写代码?**
92
+ A:可以但不推荐。Skill 的价值是**约束输出物落到统一文档**,便于团队对账。直接生成代码容易遗漏需求要点、字段命名不规范。
93
+
94
+ **Q:扫描结果不对怎么办?**
95
+ A:reports/ 下的 md 是 markdown,可以直接编辑。修改后再让 AI "基于 reports/PROTOTYPE_SCAN_xxx.md 进行 api-contract"。
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: template-extract
3
+ description: "Use when: extracting domain-specific page templates from existing project pages and contributing them to skills/core/page-codegen/templates/domains/. Triggers on: 提取模板, 抽取模板, 沉淀模板, 模板贡献, extract template, contribute template."
4
+ ---
5
+
6
+ # Skill: 模板提取(template-extract)
7
+
8
+ 从现有项目的成熟页面提取领域模板,沉淀到 `.github/skills/core/page-codegen/templates/domains/`,扩充团队 AI 模板库。
9
+
10
+ > **核心理念**:模板贡献门槛极低 — 开发者只需说出一个页面目录路径,AI 完成 90% 的分析和写作。
11
+
12
+ ---
13
+
14
+ ## 触发词
15
+
16
+ `提取模板` / `抽取模板` / `沉淀模板` / `模板贡献` / `extract template`
17
+
18
+ ---
19
+
20
+ ## Pre-flight 声明
21
+
22
+ ```
23
+ 🚀 已触发技能 template-extract/SKILL.md → 从现有页面提取领域模板
24
+ ✅ 已读取 template-extract/SKILL.md → 提取流程主规则
25
+ ✅ 已读取 templates/_index.md → 已有模板清单(避免重复)
26
+ ✅ 已读取 standards/02-code-structure.md → 模板必须遵循的代码结构
27
+ ✅ 已读取 standards/13-platform-components.md → 模板必须遵循的平台组件合规
28
+ ```
29
+
30
+ ---
31
+
32
+ ## 执行流程
33
+
34
+ ### 步骤 1:开发者指定目标
35
+
36
+ 开发者提供一个目录路径:
37
+
38
+ ```
39
+ "提取模板,目标页:src/views/produce/sjgl/mmwr-rolling-management/"
40
+ ```
41
+
42
+ ### 步骤 2:AI 读取目标页 4 文件
43
+
44
+ ```
45
+ ✅ 读取 {target}/index.vue
46
+ ✅ 读取 {target}/data.ts
47
+ ✅ 读取 {target}/index.scss
48
+ ✅ 读取 {target}/api.md(如存在)
49
+ ```
50
+
51
+ ### 步骤 3:AI 自动识别交互模式
52
+
53
+ 输出识别结论:
54
+
55
+ ```
56
+ 🔍 识别结果
57
+ - 页面包含:{2 个 BaseTable / 1 个内联 BaseForm / 4 个操作按钮}
58
+ - 交互模式:{双清单联动 + 内联表单 + 条件按钮}
59
+ - 与已有 TPL 对比:
60
+ ✅ 接近 TPL-OPERATION-STATION(domains/produce/)
61
+ ❌ 不符合 TPL-LIST / TPL-MASTER-DETAIL / TPL-RECORD-FORM
62
+ - 结论建议:本页面**已有相似模板**,可能是 TPL-OPERATION-STATION 的变体,
63
+ 建议考虑增强现有模板而非新建。
64
+ (或:本页面是**独立新模式**,建议提取为 TPL-XXX)
65
+ ```
66
+
67
+ ### 步骤 4:AI 问答确认(最多 4 个问题)
68
+
69
+ ```
70
+ ❓ 问题 1:领域归属?
71
+ 选项:A. produce(生产) B. sale(销售) C. 其他(请说明)
72
+
73
+ ❓ 问题 2:建议的模板命名?
74
+ AI 建议:TPL-{XXX-XXX}
75
+ 如不满意请提出替代
76
+
77
+ ❓ 问题 3:是否有需要脱敏/抽象的业务特定内容?
78
+ - 业务字段名(建议保留作为占位符 [字段名])
79
+ - 业务接口路径(建议改为 [服务缩写]/[资源名]/{action} 占位)
80
+ - 硬编码字典码(建议改为占位符或注释说明)
81
+
82
+ ❓ 问题 4:是否合并到已有模板?
83
+ 仅当步骤 3 识别为「相似模板」时才问。
84
+ 选项:A. 增强现有模板(追加章节) B. 提取为独立新模板
85
+ ```
86
+
87
+ ### 步骤 5:生成 TPL 文件
88
+
89
+ 按 `templates/domains/_CONTRIBUTING.md` 格式生成,必须包含:
90
+
91
+ - 适用场景说明
92
+ - 识别规则(5 条以内)
93
+ - 完整 index.vue / data.ts / index.scss 代码(脱敏后)
94
+ - 注意事项
95
+
96
+ ### 步骤 6:写入并注册
97
+
98
+ ```
99
+ ✅ 写入 templates/domains/{domain}/TPL-{NAME}.md
100
+ ✅ 更新 templates/_index.md(追加注册条目)
101
+ ```
102
+
103
+ ### 步骤 7:输出后续步骤
104
+
105
+ ```
106
+ 📦 模板提取完成
107
+ ────────────────────────────────────────────────
108
+ ✅ 已生成 templates/domains/{domain}/TPL-{NAME}.md
109
+ ✅ 已更新 templates/_index.md 注册表
110
+ ────────────────────────────────────────────────
111
+ 📌 后续步骤:
112
+ 1. 人工 review 模板内容(脱敏完整性 / 占位符正确性)
113
+ 2. 提交:git cz → feat(template): 新增领域模板 TPL-{NAME}
114
+ 3. PR 评审 → CHENY 合入
115
+ ────────────────────────────────────────────────
116
+ ```
117
+
118
+ ---
119
+
120
+ ## 提取质量校验(AI 自检)
121
+
122
+ 生成 TPL 文件后,AI 必须自检:
123
+
124
+ - [ ] 业务字段名已替换为 `[字段名]` / `[资源名]` 占位符
125
+ - [ ] API 路径已替换为 `/[服务缩写]/[资源名]/{action}` 格式
126
+ - [ ] 没有遗留具体的字典码 / 状态值(已注释说明用途)
127
+ - [ ] 代码符合 standards/02、13(结构 + 组件合规)
128
+ - [ ] 包含识别规则(让 AI 未来能匹配此模板)
129
+
130
+ ---
131
+
132
+ ## 边界情况
133
+
134
+ | 情况 | 处理 |
135
+ | -------------------------------- | ------------------------------------------------------------ |
136
+ | 目标页代码不符合 standards/ 规范 | 拒绝提取,输出审计建议("目标页本身不合规,建议先整改") |
137
+ | 目标页过于业务特化,无法抽象 | 反问开发者:"此页面业务耦合较深,提取后通用性差,是否继续?" |
138
+ | 已有 TPL 高度重合 | 优先建议增强现有模板,不建议新建 |
139
+ | 开发者指定的命名不符合规范 | 给出建议命名,请开发者确认 |
@@ -0,0 +1,93 @@
1
+ # 使用指南:template-extract(模板提取)
2
+
3
+ > **谁读这个文档**:团队成员(主要前端,模板贡献者)
4
+ > **AI 触发文件**:同目录 `SKILL.md`
5
+
6
+ ---
7
+
8
+ ## 这个 Skill 解决什么问题
9
+
10
+ 把项目里**已经写得很好的页面**抽取成可复用模板,沉淀到 `skills/core/page-codegen/templates/domains/` 下。下次 codegen 时同类页面优先复用。
11
+
12
+ ---
13
+
14
+ ## 何时使用
15
+
16
+ - 写完一个"代表性强、规范度高"的页面,想沉淀给团队复用
17
+ - 同模块内重复结构出现 ≥ 3 次,应抽模板
18
+ - 季度/版本末整理沉淀产出
19
+
20
+ ---
21
+
22
+ ## 触发关键词
23
+
24
+ `提取模板` / `抽取模板` / `沉淀模板` / `模板贡献`
25
+
26
+ ---
27
+
28
+ ## 标准对话示例
29
+
30
+ ```
31
+ 你:把 src/views/produce/aiflow/mmwr-customer-archive/ 这个页面抽取成模板
32
+ AI:[Pre-flight]
33
+ 源:mmwr-customer-archive (LIST 类型,含审批工作流)
34
+ 建议落位:templates/domains/produce/customer/list-with-approval/
35
+ 将抽取:
36
+ - data.ts.tpl (EColumn 字段保留 + 字段名占位化)
37
+ - index.vue.tpl
38
+ - index.scss.tpl
39
+ - meta.json (记录适用场景、字段规则、字典)
40
+ 占位约定:
41
+ - 资源名 → {{resourceName}}
42
+ - 服务缩写 → {{serviceShort}}
43
+ - 字典 logicValue → {{statusDict}}
44
+ 通过 convention-audit 后才落盘。
45
+ ```
46
+
47
+ ---
48
+
49
+ ## 输出物
50
+
51
+ ```
52
+ templates/domains/<域>/<场景>/
53
+ ├── data.ts.tpl
54
+ ├── index.vue.tpl
55
+ ├── index.scss.tpl
56
+ ├── meta.json 适用条件 / 占位字段说明 / 字典依赖
57
+ └── README.md 场景说明 + 何时复用 + 已知限制
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 模板分级
63
+
64
+ | 层级 | 路径 | 复用范围 |
65
+ | ------------ | -------------------------------- | ----------------------------------- |
66
+ | `universal/` | `templates/universal/<类型>/` | 跨业务通用(LIST/DETAIL/TREE_LIST) |
67
+ | `domains/` | `templates/domains/<域>/<场景>/` | 同域同场景 |
68
+
69
+ 抽取的模板**默认进 domains/**。如果发现真的全员通用,可由维护者升级到 universal/。
70
+
71
+ ---
72
+
73
+ ## 常见踩坑
74
+
75
+ | 现象 | 原因 | 解法 |
76
+ | ---------------------------------- | -------------------- | --------------------------------------------------------------- |
77
+ | 抽出来的模板里夹着业务字段 | 占位化不彻底 | meta.json 里**穷举所有占位**,AI 才会替换干净 |
78
+ | 模板下次 codegen 命中率低 | 命名/scope 太具体 | 起更通用的场景名(list-with-approval 比 mmwr-customer-list 好) |
79
+ | 字典硬编码进模板 | 没用 logicValue 占位 | 改用 `{{statusDict}}` 占位 + meta 里描述 |
80
+ | 不同业务字段长度不一时模板生成报错 | 列宽硬编码 | 模板里只给推荐值,meta 标"可调" |
81
+
82
+ ---
83
+
84
+ ## FAQ
85
+
86
+ **Q:贡献的模板要走 review 吗?**
87
+ A:建议至少同事 review 一下 meta.json + 是否真有复用价值。直接落盘容易污染模板库。
88
+
89
+ **Q:模板出问题谁负责?**
90
+ A:贡献者维护一段时间,稳定后由 kit 维护者接管。模板里要写 author + lastUpdate。
91
+
92
+ **Q:能否私有领域只抽到本仓库不发布?**
93
+ A:可以。`templates/domains/` 在 `.github/skills/` 下,跟着业务项目走。kit 包不强制收集。
@@ -0,0 +1,51 @@
1
+ # domain/ — 领域专属 Skill 占位目录
2
+
3
+ > **当前状态**:空目录,等待领域 Skill 沉淀。
4
+
5
+ ---
6
+
7
+ ## 用途
8
+
9
+ `domain/` 用于存放**强业务域相关的 Skill**——这类 Skill 在其他域几乎无复用价值,但在特定业务域内高频使用。
10
+
11
+ 与 `core/`(全业务通用)和 `sync/`(后端联动通用)不同,`domain/` 的 Skill 允许直接依赖领域特有的术语、流程和数据结构。
12
+
13
+ ---
14
+
15
+ ## 目录结构预期
16
+
17
+ ```
18
+ domain/
19
+ ├── README.md ← 本文件
20
+ ├── produce/ 生产域(如高炉计划、轧钢批次、工序流转等专属流程)
21
+ │ └── ...
22
+ ├── sale/ 销售域(如合同审批流、信用额度等专属流程)
23
+ │ └── ...
24
+ └── {其他域}/ 按需创建
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 何时在此创建新 Skill
30
+
31
+ 满足以下条件时,在对应域子目录下创建新 Skill:
32
+
33
+ 1. 该流程与业务域**强绑定**(换了域就完全不适用)
34
+ 2. 在本域内**高频触发**(≥3 个不同功能模块会用到)
35
+ 3. `core/` 里已有的 Skill **无法覆盖**(不是简单参数调整能解决的)
36
+
37
+ ---
38
+
39
+ ## 贡献流程
40
+
41
+ 1. 在对应域子目录下创建 `{skill-name}/SKILL.md`
42
+ 2. 更新 `skills/_registry.md` 启用路由表
43
+ 3. 同步在 `skills/_registry.md` 的目录分级图里添加条目
44
+ 4. 可选:创建 `USAGE.md` 供域内团队成员阅读
45
+ 5. 参考 `kit-internal/CONTRIBUTING.md` 第三节"添加新 Skill"
46
+
47
+ ---
48
+
49
+ ## 扩展策略
50
+
51
+ > 当 `domain/` 下某个域的 Skill 数量超过 **5 个**,或产生跨团队复用需求时,考虑将其拆为独立 npm 包(如 `@agile-team/wl-skills-produce`),本包仅保留 `core/sync/ops`。
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: code-fix
3
+ description: "[PLANNED — DRAFT, not yet active] 受控自动修复 Skill 设计草稿。基于 convention-audit 报告,对单条/分组偏差执行 AI 修复,全程必须人工 review 通过 + 单测护栏。"
4
+ status: planned
5
+ ---
6
+
7
+ # Skill: 受控自动修复(code-fix)— 草稿
8
+
9
+ > ⚠️ **本文件为设计草稿(SKILL.draft.md),未启用,不参与 AI 调度。**
10
+
11
+ ---
12
+
13
+ ## 1. 设计目标
14
+
15
+ `convention-audit` 已能产出偏差清单。`code-fix` 在此基础上提供**受控的自动修复**:
16
+
17
+ - **单条修复**:选定 1 条偏差 → AI 修改 → diff 确认 → 写入
18
+ - **分组修复**:选定一类偏差(如"全部缺少 :scoped")→ 批量修改 → 总体 diff → 分文件确认 → 写入
19
+ - **预置修复模板**:常见偏差直接走规则,不调 AI
20
+
21
+ ---
22
+
23
+ ## 2. 工作流
24
+
25
+ ```
26
+ convention-audit 报告 (reports/AUDIT_AI_*.md)
27
+
28
+
29
+ [1] 用户从报告挑选 issueId(或 issueGroup)
30
+
31
+
32
+ [2] 解析 issue → 定位文件 + 行号 + 偏差类型
33
+
34
+
35
+ [3] 选择修复策略:
36
+ ├─ rule-based(如缺 :scoped、缺 cid 等)→ 走预置模板
37
+ └─ ai-based(语义性偏差)→ 调 AI 生成 patch
38
+
39
+
40
+ [4] Pre-flight 输出 diff 预览(人读)
41
+
42
+
43
+ [5] 用户确认 yes/no
44
+
45
+ ├─ yes → 跑 lint + typecheck(如配置)
46
+ │ ├─ 通过 → 写入文件 + 输出 reports/CODE_FIX_<YYYYMMDD>.md
47
+ │ └─ 失败 → 回滚 + 标记 issue "待人工"
48
+
49
+ └─ no → 跳过该 issue,回到挑选界面
50
+ ```
51
+
52
+ ---
53
+
54
+ ## 3. 受控原则(关键)
55
+
56
+ | 原则 | 实现 |
57
+ | ------------------- | ------------------------------------------------------------- |
58
+ | **不破坏功能** | 修复前后跑 lint + typecheck,失败回滚 |
59
+ | **不批量盲改** | 每个文件改完都让用户看 diff,禁止全自动跳过确认 |
60
+ | **可回滚** | 修改前内存保留原始内容,输出报告含还原 patch |
61
+ | **范围明确** | 只改 issue 报告里点名的行,不顺手"重构"周边 |
62
+ | **AI 不生成新逻辑** | code-fix 只修偏差,**不**做功能补全(那是 page-codegen 的活) |
63
+
64
+ ---
65
+
66
+ ## 4. 偏差类型 → 修复策略对照
67
+
68
+ | 偏差类型 | 来源 standards | 策略 | 难度 |
69
+ | ----------------------------------- | ---------------------- | ---------- | ---- |
70
+ | EColumn 缺 cid | data-ts.md | rule-based | 易 |
71
+ | scss 文件缺 :scoped 包裹 | scss.md | rule-based | 易 |
72
+ | import 路径不规范 | imports.md | rule-based | 易 |
73
+ | Hook 类未继承 AbstractPageQueryHook | page.md | rule-based | 中 |
74
+ | API_CONFIG URL 不符合命名约定 | api-contract.md | ai-based | 中 |
75
+ | 表格列定义与 api.md 字段不一致 | api-contract + data-ts | ai-based | 难 |
76
+ | 业务语义偏差(流程不对) | 多 standards 综合 | **不修复** | - |
77
+
78
+ ---
79
+
80
+ ## 5. 命令形态(拟定)
81
+
82
+ ```
83
+ "修复 reports/AUDIT_AI_*.md 中的 issue#3" → 单条
84
+ "修复 reports/AUDIT_AI_*.md 中所有 scss 偏差" → 分组
85
+ "修复全部 rule-based 偏差,跳过 ai-based" → 受控批量
86
+ "列出可修复的 issue" → 不动手,仅列清单
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 6. 与其他 Skill 关系
92
+
93
+ | Skill | 关系 |
94
+ | ---------------- | --------------------------------------- |
95
+ | convention-audit | **前置**:必须先有审计报告才能 code-fix |
96
+ | page-codegen | 互斥:生成新页面用 codegen,不要用 fix |
97
+ | template-extract | 无直接关系 |
98
+
99
+ ---
100
+
101
+ ## 7. 转正前的开发任务
102
+
103
+ - [ ] 沉淀至少 10 个 rule-based 修复模板
104
+ - [ ] 设计 patch 内联格式(diff/unified)
105
+ - [ ] 决定 lint/typecheck 失败的处理(默认回滚 + 标记,无须用户决策)
106
+ - [ ] PR review 集成(修复完是否自动建 PR、是否分 commit)
107
+ - [ ] 防御对抗性 prompt:用户能否引导 AI 顺手改业务逻辑?应在 SKILL.md 强制约束
108
+ - [ ] 灰度策略:先支持单文件、再支持单 issue 组、最后批量