@captain_z/zsk-skills 0.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 (55) hide show
  1. package/README.md +263 -0
  2. package/bundles.yaml +104 -0
  3. package/design-handoff/.gitkeep +0 -0
  4. package/design-handoff/figma-to-code/SKILL.md +265 -0
  5. package/design-handoff/ue-mcp/SKILL.md +184 -0
  6. package/frontend/.gitkeep +0 -0
  7. package/frontend/a11y-web/SKILL.md +169 -0
  8. package/frontend/api-contract-ts/SKILL.md +275 -0
  9. package/frontend/css-bem/SKILL.md +268 -0
  10. package/frontend/design-frontend/SKILL.md +163 -0
  11. package/frontend/dor-dod-frontend/SKILL.md +114 -0
  12. package/frontend/feature-tasks-frontend/SKILL.md +246 -0
  13. package/frontend/i18n/SKILL.md +296 -0
  14. package/frontend/nfr-web/SKILL.md +258 -0
  15. package/frontend/performance-web/SKILL.md +299 -0
  16. package/frontend/react-components/SKILL.md +211 -0
  17. package/frontend/react-naming/SKILL.md +224 -0
  18. package/frontend/review-frontend/SKILL.md +126 -0
  19. package/frontend/security-web/SKILL.md +286 -0
  20. package/frontend/spec-frontend/SKILL.md +141 -0
  21. package/frontend/testing-web/SKILL.md +252 -0
  22. package/frontend/typescript/SKILL.md +219 -0
  23. package/meta/.gitkeep +0 -0
  24. package/meta/philosophy/SKILL.md +221 -0
  25. package/package.json +24 -0
  26. package/quality/.gitkeep +0 -0
  27. package/quality/a11y-principles/SKILL.md +155 -0
  28. package/quality/code-hygiene/SKILL.md +126 -0
  29. package/quality/release/SKILL.md +209 -0
  30. package/quality/security-owasp/SKILL.md +157 -0
  31. package/quality/testing-pyramid/SKILL.md +173 -0
  32. package/sdlc/.gitkeep +0 -0
  33. package/sdlc/archive/SKILL.md +267 -0
  34. package/sdlc/bugfix/SKILL.md +181 -0
  35. package/sdlc/bugfix-tasks/SKILL.md +232 -0
  36. package/sdlc/coding/SKILL.md +177 -0
  37. package/sdlc/design/SKILL.md +299 -0
  38. package/sdlc/dor-dod/SKILL.md +120 -0
  39. package/sdlc/feature/SKILL.md +162 -0
  40. package/sdlc/proposal/SKILL.md +271 -0
  41. package/sdlc/refactor/SKILL.md +220 -0
  42. package/sdlc/refactor-tasks/SKILL.md +265 -0
  43. package/sdlc/reviewing/SKILL.md +197 -0
  44. package/sdlc/spec/SKILL.md +235 -0
  45. package/sdlc/task/SKILL.md +116 -0
  46. package/sdlc/task-evidence/SKILL.md +178 -0
  47. package/sdlc/task-structure/SKILL.md +153 -0
  48. package/sdlc/task-tracking/SKILL.md +192 -0
  49. package/sdlc/verify/SKILL.md +181 -0
  50. package/system/.gitkeep +0 -0
  51. package/system/adr/SKILL.md +169 -0
  52. package/system/architecture/SKILL.md +182 -0
  53. package/system/glossary/SKILL.md +141 -0
  54. package/system/nfr-baseline/SKILL.md +156 -0
  55. package/system/project-constraints-template/SKILL.md +241 -0
package/README.md ADDED
@@ -0,0 +1,263 @@
1
+ # @captain_z/zsk-skills
2
+
3
+ ZNorth Standard Kit 的内容包:**46 颗原子 skill**,按领域分簇组织,通过 `npx @captain_z/zsk add` 可安装到 Claude / Codex / Gemini 等多 harness。
4
+
5
+ ## 合规审查(ARCHITECTURE §4.4 硬指标)
6
+
7
+ | 检查项 | 结果 | 说明 |
8
+ | --- | --- | --- |
9
+ | frontmatter 完整(`name` / `description` / `category` / `domain` / `tier` / `triggers`) | ✓ 46/46 | 结构化 lint 通过 |
10
+ | `name` 以 `zsk:` 前缀,扁平 slug | ✓ 46/46 | 命名空间统一 |
11
+ | `description` 以 `Use when…` 开头(trigger-optimized) | ✓ 46/46 | 触发匹配句式 |
12
+ | `category` / `domain` / `tier` 枚举值合法 | ✓ 46/46 | stage/workflow/standard/resource/meta · core/optional |
13
+ | `triggers` 数组非空 | ✓ 46/46 | 每颗至少 4 个关键词 |
14
+ | 无硬编码项目名 / 技术栈(统一 `{{config.*}}` 占位符) | ✓ | harness-neutral |
15
+ | `related:` 相对路径合法(build 已重写) | ✓ | 无孤儿引用 |
16
+ | 单文件 ≤ 300 行 | ⚠ 41/46 | 5 个 frontend skill 超标(见技术债) |
17
+
18
+ **技术债**(不阻塞 CI,`tools/lint-frontmatter.ts` 当前降级 warn):
19
+
20
+ | 文件 | 行数 |
21
+ | --- | --- |
22
+ | `frontend/a11y-web/SKILL.md` | 370 |
23
+ | `frontend/testing-web/SKILL.md` | 351 |
24
+ | `frontend/nfr-web/SKILL.md` | 352 |
25
+ | `frontend/security-web/SKILL.md` | 311 |
26
+ | `frontend/performance-web/SKILL.md` | 305 |
27
+
28
+ 清理手法见 `memory/project_tech_debts_lint_frontmatter.md`;完成后把 `max-lines` 从 `warn` 升回 `error`。
29
+
30
+ ## 使用方法通则
31
+
32
+ zsk skill 是 LLM **按需自动触发**的资产:
33
+
34
+ 1. **安装**:`npx @captain_z/zsk add` → 选 bundle(或 custom 多选)+ 目标路径(`~/.claude/skills/` / `~/.codex/skills/` / 自定义)→ 落盘
35
+ 2. **自动发现**:LLM(Claude Code / Codex / Gemini CLI)会话启动时扫描 skill 目录,读取每份 `SKILL.md` 的 frontmatter
36
+ 3. **自动触发**:遇到匹配 `description` 或 `triggers` 的任务时,LLM 载入对应 SKILL.md 的完整内容
37
+ 4. **手动触发**(可选):会话中显式说 "用 `zsk:spec`"、"走 `zsk:feature` 工作流",LLM 直接载入指定 skill
38
+
39
+ **典型消费路径**(production,安装后):
40
+ - `~/.claude/skills/<domain>/<slug>/SKILL.md` — Claude Code
41
+ - `~/.codex/skills/<domain>/<slug>/SKILL.md` — Codex
42
+ - `@captain_z/zsk-skills/<domain>/<slug>/SKILL.md` — 通过 npm 读
43
+
44
+ ## 领域总览
45
+
46
+ | 领域 | skill 数 | 职责 |
47
+ | --- | --- | --- |
48
+ | `sdlc/` | 17 | 7 阶段 SDLC + 3 变更工作流 + task 执行框架 |
49
+ | `frontend/` | 16 | React + Web 层实现规范 |
50
+ | `quality/` | 5 | 跨栈质量原则 |
51
+ | `design-handoff/` | 2 | 设计交付方法论 |
52
+ | `system/` | 5 | 工程宪法级资源 |
53
+ | `meta/` | 1 | 元信息 |
54
+ | **总计** | **46** | |
55
+
56
+ ## 安装套件(bundles.yaml)
57
+
58
+ | name | skills | 场景 |
59
+ | --- | --- | --- |
60
+ | `sdlc-only` | 10 | 纯流程骨架(7 阶段 + 3 工作流),不涉及技术栈 |
61
+ | `frontend-project`(推荐) | 29 | SDLC 10 + Frontend 16 + Quality 3 |
62
+ | `frontend-with-design-handoff` | 31 | frontend-project + Figma 交付 2 |
63
+ | `custom` | 交互 | 通过 `zsk add` 任意多选 |
64
+
65
+ ## Skill 清单(按领域)
66
+
67
+ > 内容由 `tools/catalog.ts` 从各 SKILL.md frontmatter 生成。重生成:`pnpm catalog`。
68
+
69
+ ### `sdlc/` — SDLC · 7 阶段 + 3 变更工作流 + task 框架(17)
70
+
71
+ - **`zsk:proposal`** *[stage 1 · stage · core]*
72
+ Use when starting a new change (feature / bugfix / refactor) and you need to frame the why, success criteria, out-of-scope boundary, alternatives considered, and risks before any spec work. Always the first stage of the 7-stage SDLC.
73
+ 触发:`new feature proposal` · `bug report` · `refactor trigger` · `SMART goals`
74
+
75
+ - **`zsk:spec`** *[stage 2 · stage · core]*
76
+ Use when the proposal is approved and you need to write the behavioral contract — User Stories (INVEST), FR / NFR / AC numbering, BDD scenarios, edge cases, term glossary. Stage 2 of the 7-stage SDLC.
77
+ 触发:`writing spec` · `user stories` · `acceptance criteria` · `FR NFR numbering`
78
+
79
+ - **`zsk:design`** *[stage 3 · stage · core]*
80
+ Use when the spec is frozen and you need to translate FR/NFR into concrete implementation plans — ADR decisions, architecture diagrams (C4 + sequence), file responsibilities, FR→code mapping, error handling, rollback, observability. Stage 3 of the 7-stage SDLC.
81
+ 触发:`technical design` · `ADR architecture decision` · `C4 diagram` · `FR mapping`
82
+
83
+ - **`zsk:coding`** *[stage 4 · stage · core]*
84
+ Use when the design is frozen and you need to execute — write code and tests, follow branch/commit conventions, enforce TDD for bugfix/refactor, respect dependency hygiene, pass local quality gates before review. Stage 4 of the 7-stage SDLC.
85
+ 触发:`implementing design` · `TDD red green refactor` · `conventional commits` · `gitlab flow`
86
+
87
+ - **`zsk:reviewing`** *[stage 5 · stage · core]*
88
+ Use when submitting or receiving a PR for code review — self-checklist, reviewer checklist, Conventional Comments prefixes, technical-rigor-over-performative-agreement when receiving feedback, dispute escalation path. Stage 5 of the 7-stage SDLC. This is the code-view (does the diff look right); the contract-view is zsk:verify.
89
+ 触发:`code review` · `PR review` · `conventional comments` · `receiving feedback`
90
+
91
+ - **`zsk:verify`** *[stage 6 · stage · core]*
92
+ Use when about to merge to main — the hard "evidence before assertion" gate. Requires DoD fully green, FR coverage matrix complete, AC checklist ticked with links, validation records with reproducible evidence. Stage 6 of the 7-stage SDLC. This is the contract-view; the code-view is zsk:reviewing.
93
+ 触发:`acceptance verification` · `definition of done` · `FR coverage matrix` · `evidence before assertion`
94
+
95
+ - **`zsk:archive`** *[stage 7 · stage · core]*
96
+ Use when closing an iteration — move historical snapshots to docs/{module}/archive/, write postmortem (P0/P1 mandatory), update changelog (SemVer + Keep a Changelog), flush ADRs, update SYSTEM-SPEC if cross-module constraints emerged, feed back to standards/system docs. Stage 7 of the 7-stage SDLC.
97
+ 触发:`archive iteration` · `postmortem` · `changelog` · `ADR flush`
98
+
99
+ - **`zsk:bugfix-tasks`** *[core]*
100
+ Use when implementing a bugfix — the TDD-enforced task template. Step 1 Red (write failing reproduction test), Step 2 Green (minimal fix, no opportunistic refactor), Step 3 Regression (adjacent scenarios), Step 4 Evidence (before/after reproduction). Requires Superpowers' 3 confidence questions before starting.
101
+ 触发:`bugfix task template` · `TDD bug fix` · `red green regression` · `bug confidence questions`
102
+
103
+ - **`zsk:dor-dod`** *[core]*
104
+ Use when transitioning between SDLC stages to gate starting a task (DoR) and closing a task (DoD). Generic DoR/DoD for all change types; frontend-specific rows (UE matrix / ue-mcp / 三语 i18n / 视觉回归 / axe) are in frontend:dor-dod-frontend.
105
+ 触发:`definition of ready` · `definition of done` · `DoR DoD` · `task gate`
106
+
107
+ - **`zsk:refactor-tasks`** *[core]*
108
+ Use when implementing a refactor — the characterization + small-step atomic task template. Step 1 capture behavior baseline, Step 2 apply one Fowler technique per atomic commit (revert on red), Step 3 Parallel Change for large refactors (Expand → Migrate → Contract), Step 4 prepare behavior-unchanged evidence.
109
+ 触发:`refactor task template` · `characterization baseline` · `Fowler techniques` · `Parallel Change tasks`
110
+
111
+ - **`zsk:task`** *[core]*
112
+ Use when you need the cross-stage task execution mindset — what a task is, how it threads spec → verify, which template to pick by change type, cross-stage hard principles. Not for writing a specific task; use zsk:task-structure for that.
113
+ 触发:`task framework` · `task execution overview` · `cross-stage tasks` · `which task template`
114
+
115
+ - **`zsk:task-evidence`** *[core]*
116
+ Use when handing a task to verify — fill the FR coverage matrix (every FR/NFR from spec has coverage task + acceptance evidence), AC checklist with reproducible links, validation records per gate (lint/type-check/test/security/etc.). Enforces "evidence before assertion" — links must be clickable and reproducible.
117
+ 触发:`FR coverage matrix` · `AC verification` · `validation record` · `evidence links`
118
+
119
+ - **`zsk:task-structure`** *[core]*
120
+ Use when writing a tasks.md — set task granularity (0.5-2 person-days), two-level structure (parent/child, no deeper), estimation unit (T-shirt or Fibonacci), required fields per task (status/owner/covers-FR/deliverable/verification), FR coverage numbering rules.
121
+ 触发:`task granularity` · `task estimation` · `T-shirt sizing` · `story points`
122
+
123
+ - **`zsk:task-tracking`** *[core]*
124
+ Use when executing tasks and tracking dependencies (Mermaid graph), blockers (dated log with severity H/M/L and escalation rules), milestones (stage exits with committed dates), and task state transitions (TODO → DOING → DONE, with BLOCKED requiring log entry). Includes **§6 每任务交互契约**:LLM 执行单任务后必须 "更新状态 → 填证据 → 短汇报 → 等人类确认",不自动连跑。
125
+ 触发:`task dependency graph` · `blocker log` · `milestones` · `task state flow`
126
+
127
+ - **`zsk:bugfix`** *[workflow · core]*
128
+ Use when fixing an existing defect end-to-end — triage → reproduce → RCA (5 Whys with confidence questions) → TDD fix (red first) → regression coverage → postmortem (P0/P1 mandatory). Enforces Superpowers' bug confidence questioning discipline.
129
+ 触发:`bug fix workflow` · `fix defect` · `RCA` · `5 whys`
130
+
131
+ - **`zsk:feature`** *[workflow · core]*
132
+ Use when building a new feature end-to-end — orchestrates the 7 SDLC stages for the feature change type. Walks you through brainstorming → writing-plans → plan-eng-review → executing-plans+TDD → requesting/receiving-code-review → verification-before-completion → finishing-a-development-branch.
133
+ 触发:`new feature workflow` · `feature end to end` · `start feature` · `feature stages`
134
+
135
+ - **`zsk:refactor`** *[workflow · core]*
136
+ Use when refactoring code without changing observable behavior — Fowler catalog, characterization tests as baseline, small atomic commits, Parallel Change / Strangler Fig for large refactors. Enforces "behavior preserved" as a hard contract (any behavior change means it's not a refactor).
137
+ 触发:`refactor workflow` · `Fowler refactoring` · `characterization test` · `Parallel Change`
138
+
139
+ ### `frontend/` — Frontend · React + Web 层实现规范(16)
140
+
141
+ - **`zsk:spec-frontend`** *[stage 2 · stage · optional]*
142
+ Use when writing spec.md for a frontend component / page — adds Component Public Contract (Props / Events / TS types), UE state matrix with a11y attributes, UE/MCP reference, and the 6-category Frontend NFR (performance / a11y / security / i18n / compat / observability). Extends the generic zsk:spec framework.
143
+ 触发:`frontend spec` · `Component Public Contract` · `Props Event Contract` · `UE state matrix`
144
+
145
+ - **`zsk:design-frontend`** *[stage 3 · stage · optional]*
146
+ Use when writing design.md for a frontend module — adds Props/state/event implementation mapping, UE-state-to-structure mapping, Figma-to-implementation mapping, performance budget (Core Web Vitals), ErrorBoundary placement. Extends the generic zsk:design framework.
147
+ 触发:`frontend design` · `Props implementation mapping` · `UE state to structure` · `Figma to implementation`
148
+
149
+ - **`zsk:review-frontend`** *[stage 5 · stage · optional]*
150
+ Use when reviewing frontend code in a PR — frontend-specific self-checklist and reviewer checklist covering TypeScript red lines (no any / @ts-ignore), React hooks rules, dangerouslySetInnerHTML, large-list performance hazards, visual regression, i18n three-language sync, jsx-a11y. Extends zsk:reviewing generic checklist.
151
+ 触发:`frontend code review` · `React review checklist` · `TypeScript red lines` · `hooks review`
152
+
153
+ - **`zsk:dor-dod-frontend`** *[optional]*
154
+ Use when transitioning between SDLC stages for frontend modules — frontend-specific DoR/DoD rows on top of the generic checklist. Covers UE state matrix completeness, ue-mcp.md registration, visual regression, three-language i18n sync, a11y (keyboard/aria/focus), frontend NFR (CWV) evidence.
155
+ 触发:`frontend DoR DoD` · `frontend definition of ready done` · `UE matrix gate` · `visual regression gate`
156
+
157
+ - **`zsk:feature-tasks-frontend`** *[optional]*
158
+ Use when building a new frontend component/page feature — the 7-category mandatory task template (事实源对齐 / Props 契约 / UE-MCP 刷新 / UE 状态 / 测试 / 视觉回归 / 质量门禁). Enforces TDD-first, contract-driven, evidence-before-assertion.
159
+ 触发:`frontend feature tasks` · `component tasks template` · `7 category tasks` · `Props UE state visual regression`
160
+
161
+ - **`zsk:nfr-web`** *[optional]*
162
+ Use when establishing concrete Web-side thresholds for the 7-category NFR framework — Core Web Vitals (LCP/INP/CLS/TTFB/TTI targets), WCAG 2.1 AA itemized rules, Web security NFR items, i18n language list + baseline + entry + RTL, browser/OS/device compatibility matrix, responsive breakpoints, observability (web-vitals + error reporting), reliability (ErrorBoundary + timeout + retry). Inherits system/nfr-baseline; modules declare deviations only.
163
+ 触发:`Web NFR` · `CWV thresholds` · `WCAG AA rules` · `browser matrix`
164
+
165
+ - **`zsk:a11y-web`** *[standard · optional]*
166
+ Use when implementing accessibility in React/JSX — label association (htmlFor/wrap), aria props usage, Modal focus trap (inert + initialFocus + restoreFocus), dialog role, live regions for async, skip link, axe-core + jsx-a11y toolchain, keyboard event handlers, prefers-reduced-motion. Implementation layer; principles (WCAG, POUR, contrast) live in quality/a11y-principles.
167
+ 触发:`jsx a11y` · `focus trap` · `Modal accessibility` · `axe-core`
168
+
169
+ - **`zsk:api-contract-ts`** *[standard · optional]*
170
+ Use when integrating a TypeScript frontend with a backend API — never hand-write API types, always consume from the shared types package or generated codegen. Covers source-of-truth pattern (backend-owned types), codegen workflows (OpenAPI / GraphQL / tRPC / Protobuf), breaking-change handling, version discipline, runtime validation (Zod at boundary), and service-layer shape. Pairs with typescript.md red lines.
171
+ 触发:`API type sync` · `do not hand-write API types` · `OpenAPI codegen` · `GraphQL codegen`
172
+
173
+ - **`zsk:css-bem`** *[standard · optional]*
174
+ Use when writing CSS / Less / Sass / CSS Modules / Tailwind in a frontend module — CSS scheme detection (Less/Sass/CSS Modules/Tailwind/native), BEM naming (Block__Element--Modifier), nesting discipline (≤3 layers), token usage rules (no hardcoded color/spacing), scope isolation, responsive breakpoints, and !important prohibition.
175
+ 触发:`CSS scheme detection` · `BEM naming` · `Less nesting` · `design token`
176
+
177
+ - **`zsk:i18n`** *[standard · optional]*
178
+ Use when implementing i18n in a frontend module — unified entry (i18n.t with mandatory fallback), key namespace structure (namespace.module.leaf_key), three-language sync rule (commit-atomic), ICU MessageFormat for plural/select, Intl.* for date/number/currency, RTL declaration, React Trans component for JSX interpolation. Replaces standards/i18n for frontend scope.
179
+ 触发:`i18n implementation` · `key namespace` · `fallback baseline` · `ICU plural`
180
+
181
+ - **`zsk:performance-web`** *[standard · optional]*
182
+ Use when optimizing a React / Web frontend for Core Web Vitals — CWV thresholds (LCP/INP/CLS/TTFB/TTI), React memoization discipline (when to memo vs not), virtualization for lists ≥ 200, lazy loading via React.lazy + Suspense + IntersectionObserver, bundle splitting + tree-shaking, image srcset + loading="lazy", debounce/throttle, re-render diagnosis with React DevTools Profiler. Implementation layer; budget framework in system/nfr-baseline + frontend/nfr-web.
183
+ 触发:`Core Web Vitals` · `LCP INP CLS` · `React memo` · `virtual scrolling`
184
+
185
+ - **`zsk:react-components`** *[standard · optional]*
186
+ Use when designing React component APIs — layering (UI/logic separation via hooks), composition vs configuration (compound components over flat-prop explosion), granularity (5-question checklist), controlled vs uncontrolled boundary, Props API design. React-specific implementation of generic component discipline.
187
+ 触发:`React component design` · `compound components` · `component granularity` · `controlled uncontrolled`
188
+
189
+ - **`zsk:react-naming`** *[standard · optional]*
190
+ Use when naming React components, files, folders, variables, booleans, event handlers, event props, hooks, TS types/interfaces, constants, and i18n keys — the complete naming convention table for a React + TypeScript codebase. Principles transfer to Vue/Svelte with syntax adjustments.
191
+ 触发:`React naming` · `component file naming` · `event handler naming` · `boolean naming`
192
+
193
+ - **`zsk:security-web`** *[standard · optional]*
194
+ Use when addressing Web frontend security — XSS (React default escape + dangerouslySetInnerHTML red line + DOMPurify exception), URL protocol whitelist, Storage red lines (no sensitive data in Local/SessionStorage), CSRF token integration, console log scrubbing for production, CSP meta/header consumption, SRI for third-party scripts, clickjacking (frame-ancestors awareness), postMessage origin checks. Frontend UI is the convenience defense; backend is final.
195
+ 触发:`dangerouslySetInnerHTML` · `XSS React` · `DOMPurify` · `LocalStorage sensitive`
196
+
197
+ - **`zsk:testing-web`** *[standard · optional]*
198
+ Use when setting up or writing frontend tests for a React codebase — the full toolchain (Jest/Vitest + React Testing Library + renderHook + user-event + MSW + Playwright + Chromatic + jest-axe), test structure (AAA/GWT), mock strategy (MSW for HTTP, manual for modules), coverage thresholds (new code / global), and the component test template. Implementation layer; cross-stack principles live in quality/testing-pyramid.
199
+ 触发:`Jest Vitest` · `React Testing Library` · `MSW mock service worker` · `Playwright`
200
+
201
+ - **`zsk:typescript`** *[standard · optional]*
202
+ Use when writing TypeScript in a frontend codebase — red lines (no any / as any / @ts-ignore / empty interface / Object type), must-do (explicit types for public boundaries, union literals, strict + noUncheckedIndexedAccess), API types from backend (not hand-written), type vs interface, generics discipline, unknown over any. Complements quality/code-hygiene for cross-language hygiene.
203
+ 触发:`TypeScript red lines` · `no any` · `strict mode` · `noUncheckedIndexedAccess`
204
+
205
+ ### `quality/` — Quality · 跨栈质量原则(5)
206
+
207
+ - **`zsk:a11y-principles`** *[standard · optional]*
208
+ Use when thinking about accessibility at the concept level — WCAG 2.1 AA baseline, POUR principles, keyboard operation matrix, focus management, aria semantics, contrast ratios, don't-rely-on-color, reduced motion. For Web/JSX implementation (axe-core, jsx-a11y, focus traps in Modal, etc.) see frontend/a11y-web.md.
209
+ 触发:`accessibility principles` · `WCAG AA` · `POUR` · `keyboard matrix`
210
+
211
+ - **`zsk:code-hygiene`** *[standard · optional]*
212
+ Use when writing code in any language — comment policy (WHY not WHAT), import ordering principle, formatter discipline, generic forbidden patterns (TODO comments, commented-out code, signature-like comments). Stack-specific rules (TypeScript red lines, React naming) are in frontend/*.
213
+ 触发:`code hygiene` · `comment policy` · `import order` · `WHY not WHAT`
214
+
215
+ - **`zsk:release`** *[standard · optional]*
216
+ Use when shipping a version — SemVer numbering, Keep a Changelog, Conventional Changelog auto-generation, environment promotion (dev→test→pre→prod), feature flag lifecycle, rollback strategy, hotfix process, canary monitoring. Works across language stacks; tool names are stack-specific examples.
217
+ 触发:`SemVer` · `changelog` · `conventional changelog` · `hotfix`
218
+
219
+ - **`zsk:security-owasp`** *[standard · optional]*
220
+ Use when addressing cross-stack security concerns — OWASP Top 10 overview, CVE response SLAs, dependency license whitelist, supply chain hygiene, common lint red lines (eval/dynamic execution), and the "frontend UI is not the final defense" principle. Web-specific XSS/CSRF/Storage red lines are in frontend/security-web.md.
221
+ 触发:`OWASP Top 10` · `CVE response` · `license whitelist` · `supply chain security`
222
+
223
+ - **`zsk:testing-pyramid`** *[standard · optional]*
224
+ Use when designing test strategy or writing tests in any language — the test pyramid ratio (unit 70 / integration 20 / e2e 10), AAA/GWT structure, coverage targets, and the three hard principles (evidence before assertion, Red-Green-Refactor, bug confidence questioning). Stack-specific tooling (Jest/RTL/MSW/Playwright) is in frontend/testing-web.md.
225
+ 触发:`test pyramid` · `TDD discipline` · `test coverage target` · `AAA GWT structure`
226
+
227
+ ### `design-handoff/` — Design Handoff · 设计交付方法论(2)
228
+
229
+ - **`zsk:figma-to-code`** *[optional]*
230
+ Use when reading a Figma design node via MCP and producing production-grade code — the 7-step workflow (locate → extract structure → extract annotations → naming conversion → layout decoding → states → tokens), plus the 4-dimension "100% fidelity" verification (visual / interaction / semantic / responsive). CSS/BEM specifics live in zsk:css-bem.
231
+ 触发:`figma to code` · `100 percent fidelity` · `node naming conversion` · `design annotations`
232
+
233
+ - **`zsk:ue-mcp`** *[optional]*
234
+ Use when the module has Figma/design input and you need to capture Design Source (URL/node-id), MCP readout status, module-specific UE deviations from system baselines, and implementation mapping. Produces docs/{module}/ue-mcp.md + structured description.md snapshot in design-assets. Only records deviations, not duplicated baseline rules.
235
+ 触发:`UE MCP context` · `figma snapshot` · `design source reference` · `module UE deviation`
236
+
237
+ ### `system/` — System · 工程宪法级资源(5)
238
+
239
+ - **`zsk:adr`** *[optional]*
240
+ Use when recording a cross-module, long-lived architectural decision that has alternatives worth weighing — with context, decision, rationale, alternatives considered, and consequences. Produces docs/system/adrs/ADR-NNNN-{slug}.md. Not for single-module implementation choices.
241
+ 触发:`architecture decision record` · `ADR template` · `MADR` · `cross-module decision`
242
+
243
+ - **`zsk:architecture`** *[optional]*
244
+ Use when documenting the project's overall system architecture — C4 context diagram, tech stack baseline, module boundaries, routing, auth flow, data flow (request/state/contract), deployment topology, related ADRs. Frontend micro-frontend topology is an optional add-on section.
245
+ 触发:`system architecture` · `C4 model` · `tech stack baseline` · `module boundaries`
246
+
247
+ - **`zsk:glossary`** *[optional]*
248
+ Use when bootstrapping or maintaining the project's Ubiquitous Language — the single source for business terms, domain entities, state names, technical terms, and acronyms. Eliminates same-concept-different-names confusion across modules and backend contracts.
249
+ 触发:`glossary` · `ubiquitous language` · `DDD terms` · `business term`
250
+
251
+ - **`zsk:nfr-baseline`** *[optional]*
252
+ Use when establishing or inheriting the project's non-functional requirements baseline — the 7-category framework (performance / a11y / security / i18n / compatibility / observability / reliability) and the deviation-declaration discipline. Web-specific values (CWV thresholds, WCAG AA, browser matrix, 三语) live in frontend/nfr-web.md.
253
+ 触发:`NFR baseline` · `non functional requirements` · `quality attributes` · `ISO 25010`
254
+
255
+ - **`zsk:project-constraints-template`** *[optional]*
256
+ Use when bootstrapping a new project to capture import origins, forbidden libraries/patterns, required wrappers, naming conventions, quality gates, branch/release conventions in one SYSTEM-SPEC chapter. The project-side constitutional constraint table, complementary to project-config.yaml (mechanical values).
257
+ 触发:`project constraints` · `SYSTEM-SPEC` · `import origins` · `forbidden packages`
258
+
259
+ ### `meta/` — Meta · 元信息(1)
260
+
261
+ - **`zsk:philosophy`** *[meta · optional]*
262
+ Use when you need to understand the design rationale of the zsk skill set (LLM Wiki × Superpowers × GSD × project-adaptation synthesis), or when explaining why zsk is organized the way it is to a new contributor.
263
+ 触发:`zsk philosophy` · `why is zsk organized this way` · `design rationale` · `LLM wiki vs superpowers`
package/bundles.yaml ADDED
@@ -0,0 +1,104 @@
1
+ # @captain_z/zsk-skills · installation bundles
2
+ #
3
+ # Flat-list model: every bundle explicitly lists the skills it installs.
4
+ # No extends/inheritance — see ARCHITECTURE.md §5 for rationale.
5
+
6
+ bundles:
7
+ sdlc-only:
8
+ label: 纯 SDLC 流程骨架
9
+ hint: 7 阶段 + 3 变更工作流,不涉及技术栈
10
+ skills:
11
+ # stages (7)
12
+ - zsk:proposal
13
+ - zsk:spec
14
+ - zsk:design
15
+ - zsk:coding
16
+ - zsk:reviewing
17
+ - zsk:verify
18
+ - zsk:archive
19
+ # workflows (3)
20
+ - zsk:feature
21
+ - zsk:bugfix
22
+ - zsk:refactor
23
+
24
+ frontend-project:
25
+ label: 前端项目(推荐)
26
+ hint: SDLC + 前端领域 + 质量规范
27
+ skills:
28
+ # SDLC 10
29
+ - zsk:proposal
30
+ - zsk:spec
31
+ - zsk:design
32
+ - zsk:coding
33
+ - zsk:reviewing
34
+ - zsk:verify
35
+ - zsk:archive
36
+ - zsk:feature
37
+ - zsk:bugfix
38
+ - zsk:refactor
39
+ # Frontend 16 (5 SDLC overlays + 11 standards)
40
+ - zsk:spec-frontend
41
+ - zsk:design-frontend
42
+ - zsk:review-frontend
43
+ - zsk:dor-dod-frontend
44
+ - zsk:feature-tasks-frontend
45
+ - zsk:react-components
46
+ - zsk:react-naming
47
+ - zsk:typescript
48
+ - zsk:css-bem
49
+ - zsk:i18n
50
+ - zsk:a11y-web
51
+ - zsk:performance-web
52
+ - zsk:security-web
53
+ - zsk:testing-web
54
+ - zsk:api-contract-ts
55
+ - zsk:nfr-web
56
+ # Quality 3
57
+ - zsk:testing-pyramid
58
+ - zsk:security-owasp
59
+ - zsk:a11y-principles
60
+
61
+ frontend-with-design-handoff:
62
+ label: 前端 + 设计交付(Figma)
63
+ hint: frontend-project 之上再加 Figma 交付方法论
64
+ skills:
65
+ # SDLC 10
66
+ - zsk:proposal
67
+ - zsk:spec
68
+ - zsk:design
69
+ - zsk:coding
70
+ - zsk:reviewing
71
+ - zsk:verify
72
+ - zsk:archive
73
+ - zsk:feature
74
+ - zsk:bugfix
75
+ - zsk:refactor
76
+ # Frontend 16
77
+ - zsk:spec-frontend
78
+ - zsk:design-frontend
79
+ - zsk:review-frontend
80
+ - zsk:dor-dod-frontend
81
+ - zsk:feature-tasks-frontend
82
+ - zsk:react-components
83
+ - zsk:react-naming
84
+ - zsk:typescript
85
+ - zsk:css-bem
86
+ - zsk:i18n
87
+ - zsk:a11y-web
88
+ - zsk:performance-web
89
+ - zsk:security-web
90
+ - zsk:testing-web
91
+ - zsk:api-contract-ts
92
+ - zsk:nfr-web
93
+ # Quality 3
94
+ - zsk:testing-pyramid
95
+ - zsk:security-owasp
96
+ - zsk:a11y-principles
97
+ # Design-handoff 2
98
+ - zsk:figma-to-code
99
+ - zsk:ue-mcp
100
+
101
+ custom:
102
+ label: 自选
103
+ hint: 通过 zsk add 交互多选每颗 skill
104
+ skills: []
File without changes
@@ -0,0 +1,265 @@
1
+ ---
2
+ name: zsk:figma-to-code
3
+ description: Figma design node → production code via MCP — 7-step workflow
4
+ (locate → extract structure → extract annotations → naming conversion → layout
5
+ decoding → states → tokens), plus the 4-dimension "100% fidelity" verification
6
+ (visual / interaction / semantic / responsive). CSS/BEM specifics live in
7
+ zsk:css-bem.
8
+ category: resource
9
+ domain: design-handoff
10
+ tier: optional
11
+ related:
12
+ - ../ue-mcp/SKILL.md
13
+ - ../../frontend/css-bem/SKILL.md
14
+ - ../../frontend/a11y-web/SKILL.md
15
+ - ../../frontend/react-components/SKILL.md
16
+ triggers:
17
+ - figma to code
18
+ - 100 percent fidelity
19
+ - node naming conversion
20
+ - design annotations
21
+ - auto layout to flex
22
+ - MCP design tokens
23
+ ---
24
+
25
+ # Figma → Code 工作流规范
26
+
27
+ > **目标**:以最少的主观猜测、最高的还原度,从 Figma 设计稿产出生产级代码
28
+ > **适用**:有视觉 / 交互设计输入的模块
29
+ > **CSS 实现细节**:BEM / Less 嵌套 / token 引用见 [`frontend/css-bem`](../../frontend/css-bem/SKILL.md)(本文件只讲方法论)
30
+
31
+ ## 核心挑战
32
+
33
+ 1. **Figma 节点名不规范**(`Frame 123` / `Rectangle 45` / `矩形 28`)
34
+ 2. **布局属性散落**(auto-layout / constraints / 绝对定位混合)
35
+ 3. **状态和变体分散**(Variants / frames / 命名暗示多源混杂)
36
+ 4. **设计 token 未统一**(硬编码色值与变量并存)
37
+ 5. **设计批注容易被忽略**(画面上看不到的关键交互 / UX / a11y / 边界信息)
38
+ 6. **"100% 还原"没有客观标准**,必须先定义可验收维度
39
+
40
+ ## 工作流(7 步)
41
+
42
+ ```text
43
+ 1. 定位目标 → 2. 提取结构 → 3. 提取批注 → 4. 命名转换 → 5. 布局解码
44
+
45
+ 7. Token 提取 ← 6. 状态与变体识别
46
+ ```
47
+
48
+ ### Step 1:定位 + 对齐目标
49
+
50
+ **Tools**:`mcp__figma-mcp-go__get_pages` / `navigate_to_page` / `get_selection` / `get_node`
51
+
52
+ - 获取 Figma URL 与 `node-id`(见 `FIGMA-INDEX.md`)
53
+ - 明确"我要还原的节点"
54
+ - 多变体 / 多页面 → 在 `description.md` 列出并标注范围
55
+
56
+ ### Step 2:提取结构(节点层级)
57
+
58
+ **Tools**:`get_metadata` / `get_nodes_info`
59
+
60
+ - 获取节点树 + 每节点类型 / 尺寸 / 内容
61
+ - 记录到 `description.md` 的"节点层级"章节
62
+ - 同步做节点命名转换(Step 4)
63
+
64
+ ### Step 3:提取设计批注(Annotations)
65
+
66
+ **Tool**:`mcp__figma-mcp-go__get_annotations`
67
+
68
+ > 🔑 **批注是 Figma 画面之外的关键信息源**。不提取会出现"视觉对了但行为错了"。
69
+
70
+ 常见批注类别:
71
+
72
+ | 类别 | 示例 |
73
+ | --- | --- |
74
+ | 交互 | "输入 500ms 防抖" / "hover 延迟 0.2s" |
75
+ | 视觉 | "hover 颜色必须为 brand/soft" / "0.2s ease-out 过渡" |
76
+ | UX 边界 | "文字 > 20 字 ellipsis + title" / "列表 > 100 项虚拟滚动" |
77
+ | a11y | "必须支持 Enter/Space 触发" / "选中需 aria-selected" |
78
+ | 空 / 错误态 | "空态文案:暂无数据" / "加载失败显示重试按钮" |
79
+ | 性能 | "首屏只渲染前 50 项" |
80
+ | 待确认 | "TODO: 这里和 XX 对齐后补" |
81
+
82
+ #### 执行要点
83
+
84
+ 1. 调用 `get_annotations`
85
+ 2. MCP 未返回时**回退手工扫描**:画布文字框 / 标签 / 箭头 / Sticky Notes / Inspector Panel 的 Annotations
86
+ 3. 所有批注记录到 `description.md`,**每条必须有落实追踪**
87
+
88
+ #### 批注表(必入 description.md)
89
+
90
+ | 批注位置 | 类别 | 内容 | 责任 | 已落实 |
91
+ | --- | --- | --- | --- | --- |
92
+ | search-input | 交互 | 输入 500ms 防抖 | 前端 | [ ] |
93
+ | node-item | a11y | 必须支持 Enter/Space | 实现 + 测试 | [ ] |
94
+ | long-name | 边界 | > 20 字符 ellipsis + title | 前端 | [ ] |
95
+
96
+ **原则**:每条批注必有**责任归属** + **已落实标记**(未落实的进入 `tasks.md`)
97
+
98
+ ### Step 4:节点命名转换(关键!)
99
+
100
+ Figma 原名往往不规范,必须转换为 **语义化 + 可搜索 + 与代码对齐** 的命名。
101
+
102
+ #### 命名维度(必填映射表)
103
+
104
+ | 维度 | 目的 | 示例 |
105
+ | --- | --- | --- |
106
+ | Figma 原名 | 溯源 | `Frame 123` |
107
+ | 语义角色 | CSS 命名基础 | `search-input` |
108
+ | 组件名 | JSX 定位 | `FeatureTreeSearch` |
109
+ | CSS class | 样式落地 | `.feature-tree__search` |
110
+ | 状态修饰符 | 变体 | `.feature-tree__node--selected` |
111
+
112
+ #### 命名转换原则
113
+
114
+ 1. **语义化,不视觉化**(✅ `.feature-tree__node` / ❌ `.blue-box`)
115
+ 2. **BEM 约定**(Block / Element / Modifier — 默认推荐,详见 [`frontend/css-bem`](../../frontend/css-bem/SKILL.md))
116
+ 3. **与组件命名对齐**(组件 `FeatureTree` → Block class `.feature-tree`)
117
+ 4. **稳定且可搜索**(Figma 改名不影响代码;跨文件 grep 能定位)
118
+ 5. **识别语义的依据**:位置 / 结构、Variants / States、内容、命名暗示
119
+
120
+ ### Step 5:布局解码(Auto-layout → CSS)
121
+
122
+ Figma Auto-layout 到 CSS Flexbox / Grid 的映射:
123
+
124
+ | Figma | CSS |
125
+ | --- | --- |
126
+ | Auto-layout Horizontal | `display: flex; flex-direction: row` |
127
+ | Auto-layout Vertical | `display: flex; flex-direction: column` |
128
+ | Auto-layout gap | `gap` |
129
+ | Auto-layout padding | `padding` |
130
+ | Hug contents | `width: fit-content` |
131
+ | Fill container | `flex: 1` |
132
+ | Absolute positioning | `position: absolute`(最后手段,优先 flex) |
133
+
134
+ **原则**:固定间距 / 尺寸 → 必须转成 design token(Step 7);绝对定位是**最后手段**。
135
+
136
+ ### Step 6:状态与变体识别
137
+
138
+ **Tools**:`get_nodes_info` + `save_screenshots`
139
+
140
+ Figma Variants → 组件状态:
141
+
142
+ - 每个 variant 对应一个状态(default / hover / focus / focus-visible / selected / disabled / error / empty / loading)
143
+ - 记录每 variant 与 default 的**差异**(不重复描述全部)
144
+ - 每个 variant 单独截图保存到 `screenshot-{state}.png`
145
+
146
+ #### 状态矩阵模板
147
+
148
+ | 状态 | 触发条件 | 与 default 差异 | 截图 | a11y 属性 |
149
+ | --- | --- | --- | --- | --- |
150
+ | default | — | — | screenshot-default.png | — |
151
+ | hover | 鼠标悬浮 | bg 变浅 | screenshot-hover.png | — |
152
+ | focus-visible | 键盘 Tab 聚焦 | outline 2px brand | screenshot-focus.png | — |
153
+ | selected | 点击选中 | bg / text 变色 | screenshot-selected.png | `aria-selected="true"` |
154
+ | disabled | 禁用 | opacity 0.4 | screenshot-disabled.png | `aria-disabled="true"` |
155
+
156
+ ### Step 7:Token 提取
157
+
158
+ **Tools**:`get_variable_defs` / `export_tokens`
159
+
160
+ 从 Figma 变量定义导出:
161
+ - **颜色**(背景 / 文字 / 边框 / 品牌色)
162
+ - **字体**(family / size / weight / line-height)
163
+ - **圆角 / 阴影 / 边框**
164
+ - **间距**(padding / gap / margin)
165
+
166
+ 映射到代码:
167
+ 1. **优先使用项目 UI 库 token**(`{{config.stack.ui_lib}}` 已覆盖的)
168
+ 2. UI 库未覆盖时,写入模块内样式变量或 CSS custom property
169
+ 3. **禁止硬编码色值 / 间距散落**
170
+
171
+ ## 100% 还原判定(四维度)
172
+
173
+ "100% 还原" 不是模糊概念,而是**四维度**客观验收:
174
+
175
+ ### 视觉维度
176
+
177
+ - [ ] 布局尺寸一致(±1px 容差)
178
+ - [ ] 色值精确(按 token 对照)
179
+ - [ ] 字体 / 行高 / 字重一致
180
+ - [ ] 圆角 / 阴影 / 边框一致
181
+ - [ ] 所有状态视觉一致
182
+
183
+ **验证**:截图对照 + 像素差异工具
184
+
185
+ ### 交互维度
186
+
187
+ - [ ] Figma Prototype 所有交互可复现
188
+ - [ ] 动效时长 / 缓动曲线一致
189
+ - [ ] 反馈态(loading / empty / error)存在且正确
190
+ - [ ] `prefers-reduced-motion` 下有降级
191
+
192
+ **验证**:录屏对照 + 自动化交互测试
193
+
194
+ ### 语义维度
195
+
196
+ - [ ] WCAG 2.1 AA 达标(见 [`quality/a11y-principles`](../../quality/a11y-principles/SKILL.md) + [`frontend/a11y-web`](../../frontend/a11y-web/SKILL.md))
197
+ - [ ] 键盘操作矩阵完整
198
+ - [ ] 读屏抽检通过
199
+ - [ ] 对比度达标
200
+
201
+ **验证**:axe-core + 手工键盘 / 读屏测试
202
+
203
+ ### 响应式维度
204
+
205
+ - [ ] 断点切换行为一致
206
+ - [ ] 极端尺寸不破坏布局
207
+ - [ ] 浏览器缩放 200% 不断字不截断
208
+
209
+ **验证**:断点截图对照 + 手工测试
210
+
211
+ **任一维度不达标 → 不视为"100% 还原"**
212
+
213
+ ## MCP 工具调用推荐顺序
214
+
215
+ ```text
216
+ 1. get_pages → 定位页面
217
+ 2. navigate_to_page → 切到目标
218
+ 3. get_selection / get_node → 锚定 node-id
219
+ 4. get_metadata → 结构元数据
220
+ 5. get_nodes_info → 详细尺寸 / 变量
221
+ 6. get_annotations → 批注(**关键**)
222
+ 7. get_variable_defs → token
223
+ 8. scan_text_nodes → i18n 抽取
224
+ 9. save_screenshots → 状态截图归档
225
+ 10. [人工] 生成 description.md
226
+ 11. [人工] 命名转换映射表
227
+ ```
228
+
229
+ **批注兜底**:`get_annotations` 返回空 → 手工扫描画布。
230
+
231
+ ## 产物清单(必交付)
232
+
233
+ - [ ] `{{config.paths.design_assets}}/{module}/{snapshot}/description.md`
234
+ - [ ] `screenshot-*.png`(每状态一张)
235
+ - [ ] `docs/{module}/ue-mcp.md`(引用 description.md)
236
+ - [ ] 组件代码 + 样式(遵循 [`frontend/css-bem`](../../frontend/css-bem/SKILL.md))
237
+ - [ ] i18n 三语文案(若适用,含批注中文案)
238
+ - [ ] 单元测试(覆盖状态矩阵每一项)
239
+ - [ ] **批注落实追踪**
240
+ - [ ] 视觉对照证据(pixel diff / 并排截图)
241
+
242
+ ## 常见陷阱
243
+
244
+ | 陷阱 | 应对 |
245
+ | --- | --- |
246
+ | 用 Figma 原名直接作为 class | 转换为语义 BEM |
247
+ | 硬编码色值 | 用 token |
248
+ | 把每个 variant 当独立组件 | 用组件 state 表达变体 |
249
+ | 忽略 auto-layout 语义 | 映射到 flex |
250
+ | **忽略设计批注** | **必调 `get_annotations`;MCP 空必手工扫描** |
251
+ | **批注只看不落实** | **批注表含"已落实"列 + 未落实进 tasks.md** |
252
+ | 跳过 a11y | a11y 是 Figma 之外的硬要求,必补 |
253
+ | 状态 variants 过多 | 只保留**独立状态**,内容差异不单独 variant |
254
+
255
+ ## 质量门禁
256
+
257
+ - [ ] 节点命名映射表完整
258
+ - [ ] Token 映射表完整(无硬编码)
259
+ - [ ] 状态矩阵含 diff + 截图 + a11y 属性
260
+ - [ ] **设计批注表完整**(含类别 / 责任 / 已落实列)
261
+ - [ ] **批注已全部落实或关联 tasks.md**
262
+ - [ ] BEM 命名一致(见 `frontend/css-bem`)
263
+ - [ ] 布局用 flex / grid,绝对定位有理由
264
+ - [ ] 四维度 100% 还原清单全绿
265
+ - [ ] description.md 与代码交叉一致