@teamix-evo/skills 0.3.0 → 0.5.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.
- package/README.md +7 -3
- package/manifest.json +63 -46
- package/package.json +3 -3
- package/src/teamix-evo-code-opentrek/SKILL.md +94 -0
- package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/api-layering.md +8 -5
- package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/checklist.md +4 -2
- package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/error-and-loading.md +38 -25
- package/src/teamix-evo-code-opentrek/file-structure.md +282 -0
- package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/forms-and-validation.md +14 -12
- package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/reuse-first.md +27 -17
- package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/routing-and-codesplit.md +23 -21
- package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/testing.md +32 -28
- package/src/teamix-evo-code-uni-manager/SKILL.md +97 -0
- package/src/teamix-evo-code-uni-manager/api-layering.md +372 -0
- package/src/teamix-evo-code-uni-manager/checklist.md +195 -0
- package/src/teamix-evo-code-uni-manager/error-and-loading.md +391 -0
- package/src/teamix-evo-code-uni-manager/file-structure.md +341 -0
- package/src/teamix-evo-code-uni-manager/forms-and-validation.md +461 -0
- package/src/teamix-evo-code-uni-manager/reuse-first.md +190 -0
- package/src/teamix-evo-code-uni-manager/routing-and-codesplit.md +452 -0
- package/src/teamix-evo-code-uni-manager/testing.md +398 -0
- package/src/teamix-evo-design-opentrek/SKILL.md +64 -0
- package/src/teamix-evo-design-opentrek/boundaries.md +533 -0
- package/src/teamix-evo-design-opentrek/brand.md +154 -0
- package/src/teamix-evo-design-opentrek/checklist.md +85 -0
- package/src/teamix-evo-design-opentrek/components.md +294 -0
- package/src/teamix-evo-design-opentrek/flows.md +51 -0
- package/src/teamix-evo-design-opentrek/foundations.md +274 -0
- package/src/teamix-evo-design-opentrek/generation-flow.md +243 -0
- package/src/teamix-evo-design-opentrek/patterns/color-mapping.md +96 -0
- package/src/teamix-evo-design-opentrek/patterns/dashboard.md +33 -0
- package/src/teamix-evo-design-opentrek/patterns/detail-page.md +203 -0
- package/src/teamix-evo-design-opentrek/patterns/form-page.md +292 -0
- package/src/teamix-evo-design-opentrek/patterns/list-page.md +367 -0
- package/src/teamix-evo-design-opentrek/patterns/page-types.md +159 -0
- package/src/teamix-evo-design-opentrek/patterns/sidebar.md +122 -0
- package/src/teamix-evo-design-opentrek/philosophy.md +98 -0
- package/src/teamix-evo-design-opentrek/rules/README.md +39 -0
- package/src/teamix-evo-design-opentrek/rules/boundaries.rules.json +391 -0
- package/src/teamix-evo-design-uni-manager/SKILL.md +64 -0
- package/src/teamix-evo-design-uni-manager/boundaries.md +567 -0
- package/src/teamix-evo-design-uni-manager/brand.md +202 -0
- package/src/teamix-evo-design-uni-manager/checklist.md +115 -0
- package/src/teamix-evo-design-uni-manager/components.md +257 -0
- package/src/teamix-evo-design-uni-manager/flows.md +63 -0
- package/src/teamix-evo-design-uni-manager/foundations.md +261 -0
- package/src/teamix-evo-design-uni-manager/generation-flow.md +230 -0
- package/src/teamix-evo-design-uni-manager/patterns/dashboard.md +97 -0
- package/src/teamix-evo-design-uni-manager/patterns/detail-page.md +253 -0
- package/src/teamix-evo-design-uni-manager/patterns/form-page.md +366 -0
- package/src/teamix-evo-design-uni-manager/patterns/list-page.md +389 -0
- package/src/teamix-evo-design-uni-manager/patterns/page-types.md +167 -0
- package/src/teamix-evo-design-uni-manager/philosophy.md +108 -0
- package/src/teamix-evo-design-uni-manager/rules/README.md +49 -0
- package/src/teamix-evo-design-uni-manager/rules/boundaries.rules.json +418 -0
- package/src/teamix-evo-manage/SKILL.md +289 -0
- package/skills/teamix-evo-coding-conventions/SKILL.md +0 -92
- package/skills/teamix-evo-coding-conventions/file-structure.md +0 -273
- package/skills/teamix-evo-design-rules/SKILL.md +0 -86
- package/skills/teamix-evo-design-rules/boundaries.md +0 -89
- package/skills/teamix-evo-design-rules/checklist.md +0 -108
- package/skills/teamix-evo-design-rules/generation-flow.md +0 -142
- package/skills/teamix-evo-design-rules/prompts/page-design.md +0 -148
- package/skills/teamix-evo-design-rules-opentrek/SKILL.md +0 -48
- package/skills/teamix-evo-design-rules-opentrek/brand-rules.md +0 -74
- package/skills/teamix-evo-design-rules-uni-manager/SKILL.md +0 -51
- package/skills/teamix-evo-design-rules-uni-manager/ai-scenarios.md +0 -51
- package/skills/teamix-evo-design-rules-uni-manager/command-center.md +0 -108
- package/skills/teamix-evo-design-rules-uni-manager/danger-ops.md +0 -87
- package/skills/teamix-evo-manage/SKILL.md +0 -178
- package/skills/teamix-evo-ui-upgrade/SKILL.md +0 -75
package/README.md
CHANGED
|
@@ -42,15 +42,19 @@ pnpm --filter @teamix-evo/skills scaffold:skill
|
|
|
42
42
|
由 `teamix-evo skills` 子命令族管理(source-mirror 模型见 [ADR 0013](../../docs/adr/0013-skills-source-mirror.md)):
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
teamix-evo skills
|
|
46
|
-
teamix-evo skills add <name...> # 增量:仅装入指定 skill
|
|
45
|
+
teamix-evo skills init # 自举:按 variant + scope 全装符合条件的 skill(ADR 0034)
|
|
46
|
+
teamix-evo skills add <name...> # 增量:仅装入指定 skill(必填,至少一个)
|
|
47
47
|
teamix-evo skills list # 列出全部 skill(默认:已装✓ / 未装○)
|
|
48
|
-
teamix-evo skills update
|
|
48
|
+
teamix-evo skills update [name...] [--dry-run] # 升级已装 skill(ADR 0035 双闸 + version 短路)
|
|
49
49
|
teamix-evo skills sync [name...] # 源 → IDE 镜像(漂移恢复用)
|
|
50
50
|
teamix-evo skills doctor # 检测源 / 镜像漂移
|
|
51
51
|
teamix-evo skills uninstall # 卸载(源 + 镜像 + lock)
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
> **verb 分工(ADR 0034)**:`init` 自举(无 ids)/ `add` 增量(必填 ids)。`skills add` 不传 id → commander 报错并输出 help。
|
|
55
|
+
>
|
|
56
|
+
> **scope 过滤(ADR 0033)**:`skills init` 跳过 manifest 里 `scope` 与当前 install scope 不匹配的 entry。entry skill `teamix-evo-manage` 标 `scope: "global"`,因此项目级 init 不会重复装入 —— 它由「全局装机」段一次性装到全局。`skills add` 显式指名 global-only skill 时仍可装入,但会得到 warning。
|
|
57
|
+
|
|
54
58
|
### 全局装机(`--scope global`)
|
|
55
59
|
|
|
56
60
|
```bash
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://teamix-evo.dev/schema/skills-package/v1.json",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
4
|
"package": "skills",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.0",
|
|
6
6
|
"engines": {
|
|
7
7
|
"teamix-evo": ">=0.1.0"
|
|
8
8
|
},
|
|
@@ -10,69 +10,86 @@
|
|
|
10
10
|
{
|
|
11
11
|
"id": "teamix-evo-manage",
|
|
12
12
|
"name": "teamix-evo-manage",
|
|
13
|
-
"description": "
|
|
14
|
-
"version": "0.
|
|
15
|
-
"source": "
|
|
16
|
-
"ides": [
|
|
13
|
+
"description": "Single entry point for the teamix-evo lifecycle: scaffold a new project, install the AI coding system into an existing repo, run / update / inspect / remove any teamix-evo package, and drive the placeholder→real UI migration loop after `npm create teamix-evo`.\nTRIGGER when: (CLI) user runs or asks about `teamix-evo tokens ...` / `teamix-evo skills ...` / `teamix-evo ui ...` / `teamix-evo biz-ui ...` / `teamix-evo templates ...` / `teamix-evo lint ...` / `teamix-evo logs ...`, or `npm create teamix-evo` / `pnpm create teamix-evo`; (模糊初始化) \"初始化一个项目\"、\"初始化一个工程\"、\"初始化一个 teamix-evo 工程\"、\"初始化一个 Teamix Evo 项目\"、\"create a teamix-evo project\"、\"set up teamix-evo from scratch\"、\"new teamix-evo app\"; (具名变体初始化) \"初始化一个 opentrek 工程 / op 工程 / OpenTrek 项目 / 探索者项目\"、\"初始化一个云管 / 云管控制台 / 云管项目 / uni-manager 工程 / 云管工程\"、\"new opentrek/uni-manager project\"; (AI coding 接入) \"给现有仓库装 teamix-evo\"、\"现有项目装一下 skills + ui\"、\"接入 AI coding 体系\"、\"装 teamix-evo 进这个项目\"、\"add teamix-evo to existing repo\"、\"install AI coding system\"、\"接入 opentrek 研发体系\"、\"接入 op 研发体系\"、\"接入 OpenTrek 研发体系\"、\"接入 opentrek 研发系统\"、\"接入 op 研发系统\"、\"接入云管研发体系\"、\"接入云管研发系统\"、\"接入 uni-manager 研发体系\"、\"接入 uni-manager 研发系统\"、\"接入统一管理研发体系\"; (更新检测) \"升级 teamix-evo\"、\"看看哪些要升级\"、\"update teamix-evo\"、\"check what needs updating\"、\"refresh installed teamix-evo packages\"; (卸载 / 清单) \"卸载 teamix-evo\"、\"看看装了哪些 teamix-evo 资源\"、\"remove the design system\"、\"list installed\"; (placeholder→real 升级) \"升级 UI\"、\"接入真组件\"、\"替换 placeholder\"、\"upgrade UI\"、\"replace placeholders\"、\"swap in real components\"、\"make the UI real\", or user opens / edits `src/components/_placeholder/**`, project contains `.teamix-evo/create/pending-ui.json`, literal `@teamix-evo:placeholder` tag in code; (状态文件) user touches `.teamix-evo/config.json`、`.teamix-evo/manifest.json`、`.teamix-evo/create/pending-ui.json`.\nSKIP: any content task — generating components, pages, services, or reviewing screens; changes to `src/` files outside the migration loop, design tokens, or business logic. Those go to teamix-evo-code-opentrek or teamix-evo-design-opentrek. SKIP if the user is mid-flow inside an already-initialized project asking to \"新增页面 / 加按钮 / 调接口\" — that's coding work, not lifecycle. SKIP pure styling / token tweaks — those go to ESLint + `tokens.overrides.css`.\nCoordinates with: teamix-evo-design-opentrek (visual side after a screen is generated)、teamix-evo-code-opentrek (file placement / reuse rules) — manage is the entry point and precedes content skills, never co-triggers.",
|
|
14
|
+
"version": "0.2.0",
|
|
15
|
+
"source": "src/teamix-evo-manage",
|
|
16
|
+
"ides": [
|
|
17
|
+
"qoder",
|
|
18
|
+
"claude"
|
|
19
|
+
],
|
|
17
20
|
"updateStrategy": "managed",
|
|
18
|
-
"managedRegions": [
|
|
19
|
-
|
|
21
|
+
"managedRegions": [
|
|
22
|
+
"core"
|
|
23
|
+
],
|
|
24
|
+
"template": false,
|
|
25
|
+
"scope": "global"
|
|
20
26
|
},
|
|
21
27
|
{
|
|
22
|
-
"id": "teamix-evo-design-
|
|
23
|
-
"name": "teamix-evo-design-
|
|
24
|
-
"description": "Apply
|
|
25
|
-
"version": "0.
|
|
26
|
-
"source": "
|
|
27
|
-
"
|
|
28
|
+
"id": "teamix-evo-design-opentrek",
|
|
29
|
+
"name": "teamix-evo-design-opentrek",
|
|
30
|
+
"description": "Apply OpenTrek design system rules (philosophy, patterns, page-types, brand tone/voice, visual foundations) when AI generates or reviews a full UI screen / page in an OpenTrek-variant project.\nTRIGGER when: user asks to \"新建 / 优化 / 重构 一个页面\"、\"做一个列表页 / 详情页 / 表单页 / 仪表盘\"、\"create / review / refactor a page、screen、dashboard、template\"; intent involves layout structure, page-level information density, or multi-component composition; file write under `src/pages/**` or `src/templates/**`.\nSKIP: single-component edits like \"加个按钮\"、\"改 input 的 label\"; pure tokens/theme overrides; pure code refactor with no visual change; teamix-evo lifecycle commands (defer to teamix-evo-manage).\nCoordinates with: teamix-evo-code-opentrek (run alongside when the screen also creates new files).",
|
|
31
|
+
"version": "0.2.0",
|
|
32
|
+
"source": "src/teamix-evo-design-opentrek",
|
|
33
|
+
"variant": "opentrek",
|
|
34
|
+
"ides": [
|
|
35
|
+
"qoder",
|
|
36
|
+
"claude"
|
|
37
|
+
],
|
|
28
38
|
"updateStrategy": "managed",
|
|
29
|
-
"managedRegions": [
|
|
39
|
+
"managedRegions": [
|
|
40
|
+
"core"
|
|
41
|
+
],
|
|
30
42
|
"template": false
|
|
31
43
|
},
|
|
32
44
|
{
|
|
33
|
-
"id": "teamix-evo-
|
|
34
|
-
"name": "teamix-evo-
|
|
35
|
-
"description": "
|
|
36
|
-
"version": "0.
|
|
37
|
-
"source": "
|
|
45
|
+
"id": "teamix-evo-code-opentrek",
|
|
46
|
+
"name": "teamix-evo-code-opentrek",
|
|
47
|
+
"description": "Enforce teamix-evo coding conventions in OpenTrek-variant consumer apps — reuse-first against `@teamix-evo/ui` registry, API code under `src/services/`, `src/` layering and import boundaries.\nTRIGGER when: user asks to \"新增 / 重构 / 写一个\" 组件 / 页面 / 接口 / 钩子 / 工具 / hook; phrases like \"create a CRUD page\"、\"add an API call\"、\"extract a hook\"、\"refactor this fetch\"、\"调一下接口\"、\"加个组件\"、\"加个按钮\"; file write under `src/pages/**`、`src/components/**`、`src/services/**`、`src/hooks/**`; AI is about to write any new `.tsx` / `.ts` file in a teamix-evo-installed project.\nSKIP: pure visual / layout design questions about an already-existing screen with no code change (defer to teamix-evo-design-opentrek); teamix-evo lifecycle (init / update / uninstall) — those go to teamix-evo-manage; changes only to design tokens / styles / theme — those go to ESLint and `tokens.overrides.css`.\nCoordinates with: teamix-evo-design-opentrek (run alongside when the change also creates a UI screen — design handles the visual side, this skill handles file placement and reuse).",
|
|
48
|
+
"version": "0.2.0",
|
|
49
|
+
"source": "src/teamix-evo-code-opentrek",
|
|
38
50
|
"variant": "opentrek",
|
|
39
|
-
"ides": [
|
|
51
|
+
"ides": [
|
|
52
|
+
"qoder",
|
|
53
|
+
"claude"
|
|
54
|
+
],
|
|
40
55
|
"updateStrategy": "managed",
|
|
41
|
-
"managedRegions": [
|
|
56
|
+
"managedRegions": [
|
|
57
|
+
"core"
|
|
58
|
+
],
|
|
42
59
|
"template": false
|
|
43
60
|
},
|
|
44
61
|
{
|
|
45
|
-
"id": "teamix-evo-design-
|
|
46
|
-
"name": "teamix-evo-design-
|
|
47
|
-
"description": "Apply
|
|
48
|
-
"version": "0.
|
|
49
|
-
"source": "
|
|
62
|
+
"id": "teamix-evo-design-uni-manager",
|
|
63
|
+
"name": "teamix-evo-design-uni-manager",
|
|
64
|
+
"description": "Apply Uni-Manager design system rules (philosophy, patterns, page-types, brand tone/voice, visual foundations) when AI generates or reviews a full UI screen / page in a Uni-Manager-variant project (专有云 / 混合云 / 云管平台 / hybrid cloud console).\nTRIGGER when: user asks to \"新建 / 优化 / 重构 一个页面\"、\"做一个列表页 / 详情页 / 表单页 / 仪表盘 / 控制台首页\"、\"create / review / refactor a page、screen、dashboard、console、admin template\"; intent involves layout structure, page-level information density, or multi-component composition for hybrid-cloud / multi-tenant / multi-region scenarios; file write under `src/pages/**` or `src/templates/**`.\nSKIP: single-component edits like \"加个按钮\"、\"改 input 的 label\"; pure tokens/theme overrides; pure code refactor with no visual change; teamix-evo lifecycle commands (defer to teamix-evo-manage).\nCoordinates with: teamix-evo-code-uni-manager (run alongside when the screen also creates new files).",
|
|
65
|
+
"version": "0.2.0",
|
|
66
|
+
"source": "src/teamix-evo-design-uni-manager",
|
|
50
67
|
"variant": "uni-manager",
|
|
51
|
-
"ides": [
|
|
68
|
+
"ides": [
|
|
69
|
+
"qoder",
|
|
70
|
+
"claude"
|
|
71
|
+
],
|
|
52
72
|
"updateStrategy": "managed",
|
|
53
|
-
"managedRegions": [
|
|
73
|
+
"managedRegions": [
|
|
74
|
+
"core"
|
|
75
|
+
],
|
|
54
76
|
"template": false
|
|
55
77
|
},
|
|
56
78
|
{
|
|
57
|
-
"id": "teamix-evo-
|
|
58
|
-
"name": "teamix-evo-
|
|
59
|
-
"description": "
|
|
60
|
-
"version": "0.
|
|
61
|
-
"source": "
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
"id": "teamix-evo-coding-conventions",
|
|
69
|
-
"name": "teamix-evo-coding-conventions",
|
|
70
|
-
"description": "Enforce teamix-evo coding conventions in consumer business apps — reuse-first against `@teamix-evo/ui` registry, API code under `src/services/`, `src/` layering and import boundaries.\nTRIGGER when: user asks to \"新增 / 重构 / 写一个\" 组件 / 页面 / 接口 / 钩子 / 工具 / hook; phrases like \"create a CRUD page\"、\"add an API call\"、\"extract a hook\"、\"refactor this fetch\"、\"调一下接口\"、\"加个组件\"、\"加个按钮\"; file write under `src/pages/**`、`src/components/**`、`src/services/**`、`src/hooks/**`; AI is about to write any new `.tsx` / `.ts` file in a teamix-evo-installed project.\nSKIP: pure visual / layout design questions about an already-existing screen with no code change (defer to teamix-evo-design-rules); teamix-evo lifecycle (init / update / uninstall) — those go to teamix-evo-manage; changes only to design tokens / styles / theme — those go to ESLint and `tokens.overrides.css`.\nCoordinates with: teamix-evo-design-rules (run alongside when the change also creates a UI screen — design-rules handles the visual side, this skill handles file placement and reuse).",
|
|
71
|
-
"version": "0.1.0",
|
|
72
|
-
"source": "skills/teamix-evo-coding-conventions",
|
|
73
|
-
"ides": ["qoder", "claude"],
|
|
79
|
+
"id": "teamix-evo-code-uni-manager",
|
|
80
|
+
"name": "teamix-evo-code-uni-manager",
|
|
81
|
+
"description": "Enforce teamix-evo coding conventions in uni-manager (hybrid-cloud / multi-tenant console) consumer apps — reuse-first against `@teamix-evo/ui` registry + `biz-ui/uni-manager` (um-topbar / CloudBadge), API code under `src/services/` with tenant / region context propagation, `src/` layering and import boundaries.\nTRIGGER when: user asks to \"新增 / 重构 / 写一个\" 组件 / 页面 / 接口 / 钩子 / 工具 / hook in a hybrid-cloud / 专有云 / 多租户 / 多区域 console; phrases like \"create a CRUD page\"、\"add an API call\"、\"extract a hook\"、\"refactor this fetch\"、\"调一下接口\"、\"加个组件\"、\"加个按钮\"; file write under `src/pages/**`、`src/components/**`、`src/services/**`、`src/hooks/**`; AI is about to write any new `.tsx` / `.ts` file in a teamix-evo-installed uni-manager-variant project.\nSKIP: pure visual / layout design questions about an already-existing screen with no code change (defer to teamix-evo-design-uni-manager); teamix-evo lifecycle (init / update / uninstall) — those go to teamix-evo-manage; changes only to design tokens / styles / theme — those go to ESLint and `tokens.overrides.css`.\nCoordinates with: teamix-evo-design-uni-manager (run alongside when the change also creates a UI screen — design handles the visual side, this skill handles file placement and reuse).",
|
|
82
|
+
"version": "0.2.0",
|
|
83
|
+
"source": "src/teamix-evo-code-uni-manager",
|
|
84
|
+
"variant": "uni-manager",
|
|
85
|
+
"ides": [
|
|
86
|
+
"qoder",
|
|
87
|
+
"claude"
|
|
88
|
+
],
|
|
74
89
|
"updateStrategy": "managed",
|
|
75
|
-
"managedRegions": [
|
|
90
|
+
"managedRegions": [
|
|
91
|
+
"core"
|
|
92
|
+
],
|
|
76
93
|
"template": false
|
|
77
94
|
}
|
|
78
95
|
]
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamix-evo/skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Skills (AI IDE capabilities) for Teamix Evo",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"manifest.json",
|
|
8
8
|
"_data.json",
|
|
9
|
-
"
|
|
9
|
+
"src",
|
|
10
10
|
"_template"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@clack/prompts": "^0.8.0",
|
|
14
14
|
"tsx": "^4.0.0",
|
|
15
|
-
"@teamix-evo/registry": "0.
|
|
15
|
+
"@teamix-evo/registry": "0.6.0"
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public",
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: teamix-evo-code-opentrek
|
|
3
|
+
description: |
|
|
4
|
+
Enforce teamix-evo coding conventions in OpenTrek-variant consumer apps — reuse-first against `@teamix-evo/ui` registry, API code under `src/services/`, `src/` layering and import boundaries.
|
|
5
|
+
TRIGGER when: user asks to "新增 / 重构 / 写一个" 组件 / 页面 / 接口 / 钩子 / 工具 / hook; phrases like "create a CRUD page"、"add an API call"、"extract a hook"、"refactor this fetch"、"调一下接口"、"加个组件"、"加个按钮"; file write under `src/pages/**`、`src/components/**`、`src/services/**`、`src/hooks/**`; AI is about to write any new `.tsx` / `.ts` file in a teamix-evo-installed project.
|
|
6
|
+
SKIP: pure visual / layout design questions about an already-existing screen with no code change (defer to teamix-evo-design-opentrek); teamix-evo lifecycle (init / update / uninstall) — those go to teamix-evo-manage; changes only to design tokens / styles / theme — those go to ESLint and `tokens.overrides.css`.
|
|
7
|
+
Coordinates with: teamix-evo-design-opentrek (run alongside when the change also creates a UI screen — design handles the visual side, this skill handles file placement and reuse).
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# teamix-evo-code-opentrek
|
|
11
|
+
|
|
12
|
+
This skill bundles the **AI-readable engineering conventions** for OpenTrek-variant consumer business apps that consume `@teamix-evo/*` packages. It complements [`teamix-evo-design-opentrek`](../teamix-evo-design-opentrek/SKILL.md) — design tells AI _what a screen should look like_; this skill tells AI _where the code should live and what to reuse before writing new code_.
|
|
13
|
+
|
|
14
|
+
<!-- teamix-evo:managed:start id="core" -->
|
|
15
|
+
|
|
16
|
+
## When to use
|
|
17
|
+
|
|
18
|
+
Activate this skill whenever AI is about to **write or refactor code** inside a consumer app that has installed teamix-evo. Common signals:
|
|
19
|
+
|
|
20
|
+
- "新增一个 xxx 页面 / 列表页 / 详情页"
|
|
21
|
+
- "加一个 xxx 接口 / 调用 xxx API"
|
|
22
|
+
- "写一个 xxx 组件"
|
|
23
|
+
- "把这段重构一下"
|
|
24
|
+
- "create a CRUD page for orders"
|
|
25
|
+
- "add an API call to fetch users"
|
|
26
|
+
- Any time AI is about to create a new file under `src/pages/`、`src/components/`、`src/services/`、`src/hooks/`
|
|
27
|
+
|
|
28
|
+
If the task is purely about _visual design_ of a screen (layout / colors / spacing), use [`teamix-evo-design`](../teamix-evo-design/SKILL.md) instead — or run both in tandem.
|
|
29
|
+
|
|
30
|
+
## What this skill does
|
|
31
|
+
|
|
32
|
+
Before AI writes or commits code, it performs an **8-step gated flow**. Steps 1-4 are baseline (**必须执行,不得跳过**); steps 5-7 are topic gates (run when the task touches that topic); step 8 is the final self-review (**必须执行,不得跳过**).
|
|
33
|
+
|
|
34
|
+
1. **🚧 Reuse-first check** — **MUST READ** [`reuse-first.md`](reuse-first.md). Before creating any new component, query the `@teamix-evo/ui` registry (via MCP `list_components` / `find_components`) and grep the local project. Only write new code when no reuse path exists.
|
|
35
|
+
2. **🚧 Layering check** — **MUST READ** [`api-layering.md`](api-layering.md). Any code that talks to a backend goes under `src/services/<domain>.ts`. Components never call `fetch` / `axios` directly. Data hooks live in `src/hooks/` and consume services.
|
|
36
|
+
3. **🚧 Directory check** — **MUST READ** [`file-structure.md`](file-structure.md). Place the new file under the right top-level folder (pages / components / services / hooks / types / utils / lib / stores / contexts). Each folder has a single responsibility and an import boundary.
|
|
37
|
+
4. **🚧 Forms gate** — if the task involves a form, **MUST READ** [`forms-and-validation.md`](forms-and-validation.md). `react-hook-form` + `zod`; schema lives at `src/services/<domain>.schema.ts`. Never wire forms with raw `useState`.
|
|
38
|
+
5. **Error/loading gate** — if the task adds a page or data hook, **MUST READ** [`error-and-loading.md`](error-and-loading.md). Ensure global ErrorBoundary, page-level fallback, and three-state handling (`isPending` / `isError` / data) are in place; mutations report success/error via `toast`.
|
|
39
|
+
6. **Routing gate** — if the task adds a route or page-entry, **MUST READ** [`routing-and-codesplit.md`](routing-and-codesplit.md). Pages use `React.lazy`; auth/role guards live in `src/routes/guards.tsx`; 404 / 403 / 500 fallbacks exist.
|
|
40
|
+
7. **Testing gate** — **MUST READ** [`testing.md`](testing.md). Pure functions and zod schemas are **mandatory** to test; hooks and reusable components are recommended. Test files sit next to the source as `*.test.ts(x)`; `vitest` + `@testing-library/react` + `msw`.
|
|
41
|
+
8. **🚧 Self-review** — **MUST READ** [`checklist.md`](checklist.md). Every item must pass before declaring the change done. Anything failing must be fixed or surfaced to the user.
|
|
42
|
+
|
|
43
|
+
> ⚠️ **禁止行为**: 跳过 Step 1 (reuse-first) 直接写新组件、跳过 Step 8 (checklist) 不做自检、凭"已有知识"省略任何文件读取。
|
|
44
|
+
|
|
45
|
+
## Inputs the user provides
|
|
46
|
+
|
|
47
|
+
- Intent: "add a page", "add a service call", "refactor X", "extract a hook", etc.
|
|
48
|
+
- Optional: domain entity (`order`、`user`、`tenant`、`workflow`)
|
|
49
|
+
- Optional: existing file the change should land near
|
|
50
|
+
|
|
51
|
+
## Outputs
|
|
52
|
+
|
|
53
|
+
- Code placed under the conventional path (`src/pages/<id>/`、`src/services/<domain>.ts`、…)
|
|
54
|
+
- Reuse decisions explicitly logged ("reused `Button` from `@teamix-evo/ui`" / "no match found, wrote a new `OrderCard` under `src/components/`")
|
|
55
|
+
- Pass / fail status against [`checklist.md`](checklist.md)
|
|
56
|
+
|
|
57
|
+
## How to invoke (typical flow)
|
|
58
|
+
|
|
59
|
+
1. Parse user intent → identify which artifact is being created (page / component / service / hook / util / form / route)
|
|
60
|
+
2. Read [`reuse-first.md`](reuse-first.md) and run the reuse query (MCP first, then local grep)
|
|
61
|
+
3. Read [`file-structure.md`](file-structure.md) to pick the destination directory
|
|
62
|
+
4. If the change touches network / backend, read [`api-layering.md`](api-layering.md)
|
|
63
|
+
5. If the change involves a form, read [`forms-and-validation.md`](forms-and-validation.md)
|
|
64
|
+
6. If the change adds a page / data hook, read [`error-and-loading.md`](error-and-loading.md) for fallback / Skeleton / toast wiring
|
|
65
|
+
7. If the change adds a route or page entry, read [`routing-and-codesplit.md`](routing-and-codesplit.md)
|
|
66
|
+
8. Decide test coverage per [`testing.md`](testing.md); write `*.test.ts(x)` next to source
|
|
67
|
+
9. Write the code; cite each reuse / new-write decision in the response
|
|
68
|
+
10. Run through [`checklist.md`](checklist.md); list pass / fail explicitly
|
|
69
|
+
|
|
70
|
+
## Files in this skill
|
|
71
|
+
|
|
72
|
+
| File | Purpose |
|
|
73
|
+
| ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| [`reuse-first.md`](reuse-first.md) | Decision flow for reusing existing components / utilities before writing new ones |
|
|
75
|
+
| [`file-structure.md`](file-structure.md) | Top-level `src/` folder layout、ownership、import boundaries、naming、global-state tier (useState → Context → store) |
|
|
76
|
+
| [`api-layering.md`](api-layering.md) | Where API code lives (`src/services/`)、how data flows from service → hook → component |
|
|
77
|
+
| [`forms-and-validation.md`](forms-and-validation.md) | `react-hook-form` + `zod` patterns、schema location、submit/error wiring |
|
|
78
|
+
| [`error-and-loading.md`](error-and-loading.md) | Global / page ErrorBoundary、react-query three-state、Suspense、toast、reportError |
|
|
79
|
+
| [`routing-and-codesplit.md`](routing-and-codesplit.md) | `React.lazy` per page、guards、404/403/500 fallback、search-params state、Suspense placement |
|
|
80
|
+
| [`testing.md`](testing.md) | `vitest` + RTL + msw、co-located tests、what is mandatory vs recommended |
|
|
81
|
+
| [`checklist.md`](checklist.md) | Multi-section self-review before declaring done |
|
|
82
|
+
|
|
83
|
+
## Relationship to other skills
|
|
84
|
+
|
|
85
|
+
- [`teamix-evo-design-opentrek`](../teamix-evo-design-opentrek/SKILL.md) — visual / interaction rules for screen generation. Run **alongside** this skill when the task includes UI; this skill never overrides design on visual concerns.
|
|
86
|
+
- [`teamix-evo-manage`](../teamix-evo-manage/SKILL.md) — lifecycle (`init` / `update` / `uninstall` / `skills init` / `skills add`). Out of scope here.
|
|
87
|
+
|
|
88
|
+
## Why these conventions
|
|
89
|
+
|
|
90
|
+
- **Single source for UI** — `@teamix-evo/ui` is a source-injected component library (89 entries). Re-implementing `Button`、`Dialog`、`DataTable` etc. inside the consumer app fragments the design system and breaks token discipline.
|
|
91
|
+
- **Stable seams for change** — keeping API calls in `src/services/` means a backend rename only edits one file; keeping components free of fetch logic means they stay easy to test and reuse.
|
|
92
|
+
- **Predictable file location** — when AI (or a new teammate) opens an unfamiliar consumer app, the directory shape is the same across all teamix-evo-bootstrapped projects.
|
|
93
|
+
|
|
94
|
+
<!-- teamix-evo:managed:end -->
|
package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/api-layering.md
RENAMED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# API 数据层规范
|
|
2
2
|
|
|
3
|
+
> ⚠️ **Prerequisites**: 本文件是 [SKILL.md](./SKILL.md) Step 2 的强制读取项。任何涉及后端通信的代码必须先读本文件。
|
|
4
|
+
|
|
3
5
|
> **核心原则**:组件不直接 fetch。所有与后端通信的代码都落在 `src/services/`,通过 `src/hooks/` 暴露给组件。
|
|
4
6
|
|
|
5
7
|
---
|
|
@@ -80,6 +82,7 @@ export async function createOrder(input: CreateOrderInput): Promise<Order> {
|
|
|
80
82
|
```
|
|
81
83
|
|
|
82
84
|
要点:
|
|
85
|
+
|
|
83
86
|
- **纯函数**(不依赖 React 上下文,可以在 SSR / Node 测试中单独跑)
|
|
84
87
|
- **类型来自 `src/types/`**,不要在 service 文件里就地定义 domain 类型
|
|
85
88
|
- **错误不在 service 层处理** —— 抛出去给 hook / 全局 interceptor 处理(归一化在 `src/lib/http.ts`)
|
|
@@ -201,11 +204,11 @@ src/types/
|
|
|
201
204
|
|
|
202
205
|
某些场景**允许**绕过本规范,但需要在代码注释里说明原因:
|
|
203
206
|
|
|
204
|
-
| 场景
|
|
205
|
-
|
|
|
206
|
-
| 静态资源 fetch(读 `public/` 下的 json) | 组件直接 `fetch` 可,不用进 service
|
|
207
|
-
| 第三方 SDK(地图、支付)有自己的客户端
|
|
208
|
-
| 一次性的诊断 / 调试代码
|
|
207
|
+
| 场景 | 允许 |
|
|
208
|
+
| -------------------------------------- | --------------------------------------------- |
|
|
209
|
+
| 静态资源 fetch(读 `public/` 下的 json) | 组件直接 `fetch` 可,不用进 service |
|
|
210
|
+
| 第三方 SDK(地图、支付)有自己的客户端 | 包装层放 `src/lib/<sdk>.ts`,不强制走 services |
|
|
211
|
+
| 一次性的诊断 / 调试代码 | 临时 fetch 可,但 PR 合并前必须清理或归位 |
|
|
209
212
|
|
|
210
213
|
---
|
|
211
214
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# 编码自检清单
|
|
2
2
|
|
|
3
|
+
> ⚠️ **Prerequisites**: 本文件是 [SKILL.md](./SKILL.md) Step 8 的强制读取项。AI 写完/改完代码后必须读取并逐项核对。不得跳过。
|
|
4
|
+
|
|
3
5
|
> AI 写完 / 改完代码后,**必须**逐项核对。任何一项未通过都不应交付,需要先修复或显式告诉用户哪条不通过、为什么。
|
|
4
6
|
|
|
5
7
|
---
|
|
@@ -124,7 +126,7 @@
|
|
|
124
126
|
|
|
125
127
|
(若改动包含 UI)
|
|
126
128
|
|
|
127
|
-
- [ ] 视觉部分按 [`teamix-evo-design-
|
|
129
|
+
- [ ] 视觉部分按 [`teamix-evo-design-opentrek`](../teamix-evo-design-opentrek/SKILL.md) 自检过 token / 间距 / 圆角 / 动效
|
|
128
130
|
- [ ] 没有硬编码颜色 / 间距 / 字号(交给 ui 包 + design token)
|
|
129
131
|
|
|
130
132
|
---
|
|
@@ -159,7 +161,7 @@
|
|
|
159
161
|
- 数据层: ✅ services/order.ts 纯函数;✅ hooks/useOrderList.ts 包 react-query;✅ 组件未 fetch
|
|
160
162
|
- 目录: ✅ 页面在 pages/orders/;✅ 跨页面组件在 components/
|
|
161
163
|
- 命名: ✅ kebab 目录 / Pascal 组件 / camel hook
|
|
162
|
-
- 边界: ✅ 全部走
|
|
164
|
+
- 边界: ✅ 全部走 @/\*;✅ 无反向依赖
|
|
163
165
|
- 类型: ✅ types/order.ts 集中声明
|
|
164
166
|
- 表单(若涉及): ✅ useForm + zodResolver;✅ schema 在 services/order.schema.ts
|
|
165
167
|
- 错误/加载(若涉及): ✅ 三态全处理;✅ ErrorBoundary 已在 App 根;✅ mutation toast
|
package/{skills/teamix-evo-coding-conventions → src/teamix-evo-code-opentrek}/error-and-loading.md
RENAMED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# 错误与加载态规范
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> ⚠️ **Prerequisites**: 本文件是 [SKILL.md](./SKILL.md) Step 5 的条件读取项。任务涉及页面或数据 hook 时必须读取。
|
|
4
|
+
|
|
5
|
+
> **核心约定**:渲染错误用 `ErrorBoundary`,异步加载用 `react-query` 的 `isPending/isError`(必要时叠 `Suspense`),全局兗底必须存在。**不允许**白屏 / 红屏直出给用户。
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
@@ -62,13 +64,21 @@ createRoot(document.getElementById('root')!).render(
|
|
|
62
64
|
// src/components/GlobalErrorFallback.tsx
|
|
63
65
|
import { Button } from '@teamix-evo/ui';
|
|
64
66
|
|
|
65
|
-
export function GlobalErrorFallback({
|
|
67
|
+
export function GlobalErrorFallback({
|
|
68
|
+
resetErrorBoundary,
|
|
69
|
+
}: {
|
|
70
|
+
resetErrorBoundary: () => void;
|
|
71
|
+
}) {
|
|
66
72
|
return (
|
|
67
73
|
<div className="flex min-h-screen items-center justify-center">
|
|
68
74
|
<div className="text-center">
|
|
69
75
|
<h1 className="text-2xl font-semibold">页面出错了</h1>
|
|
70
|
-
<p className="text-muted-foreground mt-2"
|
|
71
|
-
|
|
76
|
+
<p className="text-muted-foreground mt-2">
|
|
77
|
+
已记录,可尝试刷新或返回首页
|
|
78
|
+
</p>
|
|
79
|
+
<Button className="mt-4" onClick={resetErrorBoundary}>
|
|
80
|
+
重新加载
|
|
81
|
+
</Button>
|
|
72
82
|
</div>
|
|
73
83
|
</div>
|
|
74
84
|
);
|
|
@@ -130,19 +140,19 @@ function OrderListPage() {
|
|
|
130
140
|
|
|
131
141
|
### 三种状态都要处理
|
|
132
142
|
|
|
133
|
-
| 状态
|
|
134
|
-
|
|
|
135
|
-
| `isPending`(首次加载)
|
|
136
|
-
| `isError`
|
|
137
|
-
| `isFetching`(后台刷新) | 表格右上角小转圈即可,不要遮罩
|
|
143
|
+
| 状态 | 必须输出 |
|
|
144
|
+
| ---------------------- | ------------------------------------------ |
|
|
145
|
+
| `isPending`(首次加载) | Skeleton / Spinner,**不允许**显示空 div |
|
|
146
|
+
| `isError` | 错误面板 + 重试按钮,**不允许**直接 `throw` |
|
|
147
|
+
| `isFetching`(后台刷新) | 表格右上角小转圈即可,不要遮罩 |
|
|
138
148
|
|
|
139
149
|
### Skeleton vs Spinner 怎么选
|
|
140
150
|
|
|
141
|
-
| 场景
|
|
142
|
-
|
|
|
143
|
-
| 列表 / 卡片 / 详情
|
|
144
|
-
| 短动作(按钮提交、< 500ms 加载) | Spinner
|
|
145
|
-
| 全屏切换
|
|
151
|
+
| 场景 | 用 |
|
|
152
|
+
| ------------------------------ | ---------------------------- |
|
|
153
|
+
| 列表 / 卡片 / 详情 | Skeleton(撑住布局,避免 CLS) |
|
|
154
|
+
| 短动作(按钮提交、< 500ms 加载) | Spinner |
|
|
155
|
+
| 全屏切换 | PageSkeleton 或 logo loading |
|
|
146
156
|
|
|
147
157
|
---
|
|
148
158
|
|
|
@@ -177,14 +187,17 @@ react-query v5 支持 `useSuspenseQuery`,可把 loading 转给 `<Suspense>`:
|
|
|
177
187
|
|
|
178
188
|
```tsx
|
|
179
189
|
function OrderListPage() {
|
|
180
|
-
const { data } = useSuspenseQuery({
|
|
190
|
+
const { data } = useSuspenseQuery({
|
|
191
|
+
queryKey: ['orders'],
|
|
192
|
+
queryFn: listOrders,
|
|
193
|
+
});
|
|
181
194
|
return <OrderTable data={data} />; // 不需要 isPending 分支
|
|
182
195
|
}
|
|
183
196
|
|
|
184
197
|
// 父级:
|
|
185
198
|
<Suspense fallback={<TableSkeleton rows={10} />}>
|
|
186
199
|
<OrderListPage />
|
|
187
|
-
</Suspense
|
|
200
|
+
</Suspense>;
|
|
188
201
|
```
|
|
189
202
|
|
|
190
203
|
**何时用**:
|
|
@@ -232,15 +245,15 @@ window.addEventListener('error', (e) => reportError(e.error));
|
|
|
232
245
|
|
|
233
246
|
## 反模式速查
|
|
234
247
|
|
|
235
|
-
| 反模式
|
|
236
|
-
|
|
|
237
|
-
| 没有全局 ErrorBoundary
|
|
238
|
-
| `useState(false)` + `useEffect` 管 loading
|
|
239
|
-
| 只判 `isLoading` 不判 `isError`
|
|
240
|
-
| `if (data) return <>...</> else return null` | 无 skeleton,布局抖动 + CLS | 加 Skeleton
|
|
241
|
-
| `alert('保存失败')`
|
|
242
|
-
| ErrorBoundary 不上报
|
|
243
|
-
| service 里 `try/catch` 吞错
|
|
248
|
+
| 反模式 | 为什么禁 | 应该 |
|
|
249
|
+
| -------------------------------------------- | -------------------------- | ------------------------------------ |
|
|
250
|
+
| 没有全局 ErrorBoundary | 异常直接白屏 | App 根挂一层 |
|
|
251
|
+
| `useState(false)` + `useEffect` 管 loading | 重复造轮,易漏 cancel | 走 react-query / useSuspenseQuery |
|
|
252
|
+
| 只判 `isLoading` 不判 `isError` | 错误态显示空白 | 三态都处理 |
|
|
253
|
+
| `if (data) return <>...</> else return null` | 无 skeleton,布局抖动 + CLS | 加 Skeleton |
|
|
254
|
+
| `alert('保存失败')` | 阻断用户、丑、不可样式化 | `toast.error()` |
|
|
255
|
+
| ErrorBoundary 不上报 | 错过线上 bug | `onError` 接 `reportError` |
|
|
256
|
+
| service 里 `try/catch` 吞错 | 上层失去判断依据 | 让 error 抛上来,hook / boundary 决定 |
|
|
244
257
|
|
|
245
258
|
---
|
|
246
259
|
|