prizmkit 1.1.78 → 1.1.79

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 (37) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/skills/_metadata.json +1 -1
  3. package/bundled/skills-windows/prizm-kit/SKILL.md +81 -0
  4. package/bundled/skills-windows/prizmkit-code-review/SKILL.md +225 -0
  5. package/bundled/skills-windows/prizmkit-committer/SKILL.md +81 -0
  6. package/bundled/skills-windows/prizmkit-deploy/SKILL.md +468 -0
  7. package/bundled/skills-windows/prizmkit-deploy/references/ci-cd-workflows.md +115 -0
  8. package/bundled/skills-windows/prizmkit-deploy/references/cloud-platform-deploy.md +93 -0
  9. package/bundled/skills-windows/prizmkit-deploy/references/database-setup.md +46 -0
  10. package/bundled/skills-windows/prizmkit-deploy/references/deploy-config-schema.md +148 -0
  11. package/bundled/skills-windows/prizmkit-deploy/references/deploy-history-schema.md +62 -0
  12. package/bundled/skills-windows/prizmkit-deploy/references/deployment-modes.md +50 -0
  13. package/bundled/skills-windows/prizmkit-deploy/references/direct-upload.md +26 -0
  14. package/bundled/skills-windows/prizmkit-deploy/references/dns-setup.md +42 -0
  15. package/bundled/skills-windows/prizmkit-deploy/references/docker-deploy.md +31 -0
  16. package/bundled/skills-windows/prizmkit-deploy/references/firewall-setup.md +37 -0
  17. package/bundled/skills-windows/prizmkit-deploy/references/live-validation-notes.md +21 -0
  18. package/bundled/skills-windows/prizmkit-deploy/references/nginx-blue-green.md +59 -0
  19. package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +56 -0
  20. package/bundled/skills-windows/prizmkit-implement/SKILL.md +65 -0
  21. package/bundled/skills-windows/prizmkit-plan/SKILL.md +184 -0
  22. package/bundled/skills-windows/prizmkit-plan/assets/plan-template.md +115 -0
  23. package/bundled/skills-windows/prizmkit-plan/assets/spec-template.md +73 -0
  24. package/bundled/skills-windows/prizmkit-plan/references/clarify-guide.md +67 -0
  25. package/bundled/skills-windows/prizmkit-plan/references/verification-checklist.md +60 -0
  26. package/bundled/skills-windows/prizmkit-prizm-docs/SKILL.md +115 -0
  27. package/bundled/skills-windows/prizmkit-prizm-docs/assets/prizm-docs-format.md +613 -0
  28. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-init.md +45 -0
  29. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-rebuild.md +15 -0
  30. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-status.md +14 -0
  31. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-update.md +19 -0
  32. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-validate.md +17 -0
  33. package/bundled/skills-windows/prizmkit-retrospective/SKILL.md +87 -0
  34. package/bundled/skills-windows/prizmkit-retrospective/references/knowledge-injection-steps.md +50 -0
  35. package/bundled/skills-windows/prizmkit-retrospective/references/structural-sync-steps.md +43 -0
  36. package/bundled/skills-windows/prizmkit-test/SKILL.md +281 -0
  37. package/package.json +1 -1
@@ -0,0 +1,14 @@
1
+ # Operation: Status — Detailed Steps
2
+
3
+ Check freshness of all .prizm docs.
4
+
5
+ PRECONDITION: .prizmkit/prizm-docs/ exists with root.prizm.
6
+
7
+ STEPS:
8
+ 1. Get last git modification time of root.prizm via `git log -1 --format="%ai" -- .prizmkit/prizm-docs/root.prizm`.
9
+ 2. Count commits since that time via `git log --since="<timestamp>" --oneline | wc -l`.
10
+ 3. For each L1/L2 doc, compare git modification time of the .prizm file (`git log -1 --format="%ai" -- <prizm-file>`) against latest git modification of source files in that module (`git log -1 --format="%ai" -- <module-path>/`).
11
+ 4. Classify each doc as: FRESH (prizm file updated after latest source change), STALE (source changed more recently than prizm file), MISSING (module exists but no .prizm doc).
12
+ 5. Flag any docs exceeding size limits.
13
+
14
+ OUTPUT: Freshness report table with columns: DOC_PATH | LEVEL | STATUS | PRIZM_LAST_MOD | SOURCE_LAST_MOD.
@@ -0,0 +1,19 @@
1
+ # Operation: Update — Detailed Steps
2
+
3
+ Update .prizmkit/prizm-docs/ to reflect recent code changes.
4
+
5
+ PRECONDITION: .prizmkit/prizm-docs/ exists with root.prizm.
6
+
7
+ STEPS:
8
+ 1. Get changed files via `git diff --cached --name-status`. If nothing staged, use `git diff --name-status`. If no git changes at all, do full rescan comparing code against existing docs — this includes checking for modules that have source files but no L2 doc.
9
+ 2. Map changed files to modules by matching against MODULE_INDEX or MODULE_GROUPS in root.prizm. Group changes by module.
10
+ 3. Classify each change: A (added) -> new KEY_FILES entries. D (deleted) -> remove entries, update counts. M (modified) -> check dependency changes. R (renamed) -> update all path references.
11
+ 4. Update affected docs: L2 first (KEY_FILES, INTERFACES, DATA_FLOW, DEPENDENCIES, TRAPS, DECISIONS), then L1 (FILES count, KEY_FILES, DEPENDENCIES — L1 does NOT contain INTERFACES/DATA_FLOW/TRAPS/DECISIONS), then L0 (MODULE_INDEX or MODULE_GROUPS counts, CROSS_CUTTING) only if structural change. Do not write CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths — git tracks history. **Preserve** any `PROJECT_BRIEF:` line in root.prizm — it is managed by prizmkit-init, not by this skill.
12
+ 5. Skip updates if: only internal implementation changed (no interface/dependency change), only comments/whitespace/formatting, only .prizm files changed. DO NOT skip test file changes or bug fixes — they may reveal TRAPS worth capturing in L2.
13
+ 6. If new directory qualifies as a module (per MODULE_DISCOVERY_CRITERIA) and matches no existing module: create L1 immediately, add to MODULE_INDEX. If the current diff includes Added or Modified source files in this module → also create L2 immediately with sections: MODULE, FILES, RESPONSIBILITY, INTERFACES, DATA_FLOW, KEY_FILES, DEPENDENCIES, RULES, TRAPS, DECISIONS. Otherwise defer L2.
14
+ 6a. **L2 gap check** (runs during full rescan mode only — when no git changes detected): For each existing module in MODULE_INDEX, check if L2 doc exists. If L2 is missing and the module has source files with meaningful logic (not trivial config/wrapper) → create L2 with sections: MODULE, FILES, RESPONSIBILITY, INTERFACES, DATA_FLOW, KEY_FILES, DEPENDENCIES, RULES, TRAPS, DECISIONS. This ensures Update fills documentation gaps left by previous sessions.
15
+ 7. Enforce size limits: L0 > 4KB -> consolidate. L1 > 4KB -> trim KEY_FILES descriptions, ensure RULES <= 3 entries. L2 > 5KB -> trim non-essential derived detail or split oversized cross-cutting detail.
16
+ 7a. Validate memory hygiene: no CHANGELOG/UPDATED fields, no workflow metadata, no L1 behavioral sections.
17
+ 8. Stage updated .prizm files via `git add .prizmkit/prizm-docs/`
18
+
19
+ OUTPUT: List of updated/created/skipped docs with reasons.
@@ -0,0 +1,17 @@
1
+ # Operation: Validate — Detailed Steps
2
+
3
+ Check format compliance and consistency of all .prizm docs.
4
+
5
+ PRECONDITION: .prizmkit/prizm-docs/ exists.
6
+
7
+ STEPS:
8
+ 1. FORMAT CHECK: Verify all .prizm files use KEY: value format. Flag any prose paragraphs, code blocks (```), markdown headers (##), emoji, ASCII art, or horizontal rules. Flag TRAPS entries missing severity prefix ([CRITICAL], [HIGH], or [LOW]). Flag CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, and `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths as auxiliary noise. Note: [REVIEW] preceding severity (e.g., `[REVIEW][HIGH]`) is a valid temporary staleness marker, not a format violation.
9
+ 2. SIZE CHECK: Verify size limits: L0 <= 4KB, L1 <= 4KB, L2 <= 5KB. Report files exceeding limits with current size.
10
+ 3. POINTER CHECK: Verify all arrow (->) references resolve to existing .prizm files. Report broken pointers.
11
+ 4. STALENESS CHECK: Compare git modification time of each .prizm file against source directory. Flag docs where source was modified more recently.
12
+ 5. COMPLETENESS CHECK: Verify root.prizm has all required fields (PRIZM_VERSION, PROJECT, LANG, MODULE_INDEX or MODULE_GROUPS). Verify L1 docs have MODULE, FILES, RESPONSIBILITY, DEPENDENCIES (no INTERFACES/TRAPS/DECISIONS). Verify L2 docs have MODULE, FILES, KEY_FILES, DEPENDENCIES, INTERFACES, TRAPS.
13
+ 6. ANTI-PATTERN CHECK: Flag duplicate information across levels, implementation details in L0/L1, TODO items, session-specific context, changelog/history sections, and workflow metadata.
14
+ 7. RULES HIERARCHY CHECK: Verify L1/L2 RULES do not contradict root.prizm RULES. L1/L2 may only supplement with module-specific exceptions.
15
+ 8. TRAPS STALENESS CHECK: For each L2 doc where TRAPS section has more than 8 entries, verify that TRAPS include staleness metadata (`STALE_IF:` or `REF:` fields). Flag TRAPS without any staleness metadata as `NEEDS_METADATA` — these are not auto-removed, but flagged for the next `/prizmkit-retrospective` to enrich with `STALE_IF:` globs or `REF:` hashes.
16
+
17
+ OUTPUT: Validation report with PASS/FAIL per check, list of issues with file paths and suggested fixes.
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: "prizmkit-retrospective"
3
+ description: "Incremental .prizmkit/prizm-docs/ maintainer. Performs two jobs: (1) structural sync — update .prizmkit/prizm-docs/ KEY_FILES/INTERFACES/DEPENDENCIES, (2) architecture knowledge — inject TRAPS/RULES/DECISIONS into .prizmkit/prizm-docs/. All project knowledge lives in .prizmkit/prizm-docs/ . Run after code review passes and before committing. Trigger on: 'retrospective', 'retro', 'update docs', 'sync docs', 'wrap up', 'done with feature', 'feature complete'. (project)"
4
+ ---
5
+
6
+ # PrizmKit Retrospective
7
+
8
+ | Store | Location | Content | Purpose |
9
+ |-------|----------|---------|---------|
10
+ | **Architecture Index** | `.prizmkit/prizm-docs/` | MODULE, FILES, INTERFACES, DEPENDENCIES, TRAPS, RULES, DECISIONS | AI quickly locates code structure, interfaces, known pitfalls, and key design decisions |
11
+
12
+ **This skill handles both structural sync and knowledge injection in one pass:**
13
+
14
+ 1. **Structural Sync** — reflect what changed in code → `.prizmkit/prizm-docs/` (KEY_FILES, INTERFACES, DEPENDENCIES, file counts)
15
+ 2. **Architecture Knowledge** — inject TRAPS, RULES, and DECISIONS → `.prizmkit/prizm-docs/`
16
+
17
+ For initial doc setup, validation, or migration, use `/prizmkit-prizm-docs` instead.
18
+
19
+ ## When to Use
20
+
21
+ - **Before every commit** (mandatory in pipeline) — ensures docs and code are in sync
22
+ - After completing a feature, refactoring, or bug fix
23
+ - After code review passes
24
+ - User says "retrospective", "retro", "update docs", "sync docs", "wrap up"
25
+
26
+ ## Input
27
+
28
+ | Parameter | Required | Description |
29
+ |-----------|----------|-------------|
30
+ | `artifact_dir` | No | Directory containing spec.md, plan.md, review-report.md. If omitted, scan `.prizmkit/` subdirectories for the most recently modified directory with a `plan.md`. If no artifact directory found, run in standalone mode (structural sync only from `git diff`). |
31
+
32
+ ## When NOT to Use
33
+
34
+ - Only comments, whitespace, or formatting changed — no structural/knowledge change
35
+ - Only test files changed — no module-level impact
36
+ - Only .prizm files changed — avoid circular updates
37
+
38
+ ---
39
+
40
+ ### Job 1: Structural Sync (always runs)
41
+ Synchronize `.prizmkit/prizm-docs/` structure with actual codebase changes from this session.
42
+ → Read `${SKILL_DIR}/references/structural-sync-steps.md` for the detailed procedure.
43
+
44
+ **Key outputs**: Synced L1 file counts, L2 INTERFACES/DATA_FLOW, DEPENDENCIES, and stale TRAPS cleanup.
45
+
46
+ **Memory hygiene**: `.prizmkit/prizm-docs/` must not contain CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths. Convert artifact-scoped wording into durable product/domain language before writing.
47
+
48
+ ---
49
+
50
+ ### Job 2: Knowledge Injection (conditional)
51
+ Inject newly discovered project knowledge (TRAPS, RULES, DECISIONS) into architecture docs.
52
+ → Read `${SKILL_DIR}/references/knowledge-injection-steps.md` for the detailed procedure.
53
+
54
+ **Review gate**: Before running Job 2, check `review-report.md` in the artifact directory for the `## Verdict:` line:
55
+ - Verdict is `PASS` → proceed
56
+ - Verdict is `NEEDS_FIXES` → **skip Job 2** — do not inject knowledge for code that hasn't passed review. Output warning: "Review report has unresolved findings. Skipping knowledge injection."
57
+ - No `review-report.md` found → proceed with warning
58
+ - No artifact directory (standalone mode) → skip Job 2, only Job 1 runs
59
+
60
+ **Skip for**: pure refactors (no behavioral change).
61
+
62
+ **Bug Fix Documentation Policy**:
63
+ - DEFAULT for bug fixes: Run Job 1 (structural sync) only. Skip Job 2 (knowledge injection).
64
+ - RUN Job 2 when the bug fix causes any of:
65
+ • Interface signature changes
66
+ • Dependency additions/removals
67
+ • Observable behavior changes to existing features
68
+ • Newly discovered TRAPs (gotchas/pitfalls)
69
+ - When any of the above apply, run full retrospective (Job 1 + Job 2).
70
+
71
+ **Key outputs**: New TRAPS entries, RULES updates, DECISIONS records in relevant L1/L2 docs and root.prizm.
72
+
73
+ ---
74
+
75
+ ## Final: Stage
76
+
77
+ **3a.** Stage all doc changes:
78
+ ```powershell
79
+ git add .prizmkit/prizm-docs/
80
+ ```
81
+
82
+ **HANDOFF:** `/prizmkit-committer`
83
+
84
+ ## Output
85
+
86
+ - `.prizmkit/prizm-docs/*.prizm` — Structurally synced + TRAPS/RULES/DECISIONS enriched
87
+ - All `.prizmkit/prizm-docs/` changes staged via `git add`
@@ -0,0 +1,50 @@
1
+ # Knowledge Injection — Detailed Steps (2a–2c)
2
+
3
+ **2a.** Gather context — read the **actual code that was changed** plus any available artifacts:
4
+
5
+ - `git diff HEAD` — the real source of truth for what happened
6
+ - `review-report.md` in the artifact directory — read the findings and fix instructions. If this file exists, use it as a source for pre-categorized decisions and findings.
7
+ - `plan.md` in the artifact directory — read planned vs actual
8
+ - Any companion documents in the artifact directory (e.g., `refactor-analysis.md`, `fix-report.md`) — read what was discovered
9
+ - The relevant `.prizmkit/prizm-docs/` L1/L2 docs for affected modules
10
+
11
+ **2b.** Extract knowledge from what was **observed in code**, not invented:
12
+
13
+ **TRAPS** (highest priority) — things that look safe but break:
14
+ - Minimal format: `- [SEVERITY] <description> | FIX: <approach>`
15
+ - Full format: `- [SEVERITY] <description> | FIX: <approach> | REF: <hash> | STALE_IF: <glob>`
16
+ - Source: actual bugs hit, surprising behavior discovered in code, non-obvious coupling
17
+
18
+ **TRAPS severity classification**:
19
+ - `[CRITICAL]`: data loss, security, financial error, system crash
20
+ - `[HIGH]`: functional failure, silent error, interface incompatibility
21
+ - `[LOW]`: misleading naming, non-intuitive API, minor performance issue
22
+
23
+ When writing TRAPS:
24
+ - Severity prefix is MANDATORY (e.g., `[CRITICAL]`, `[HIGH]`, `[LOW]`)
25
+ - OPTIONAL: append `| REF: <7-char-hash>` when you know the relevant commit (for traceability)
26
+ - OPTIONAL: append `| STALE_IF: <glob>` when the TRAP is tightly coupled to specific files (for auto-expiry detection)
27
+
28
+ **Consuming [REVIEW] markers** (from staleness check 1g):
29
+ - If you encounter a TRAP prefixed with `[REVIEW]` (e.g., `[REVIEW][HIGH] ...`), verify whether the trap is still valid by checking the current code. If still valid: remove the `[REVIEW]` prefix, keeping the severity. If no longer relevant: delete the TRAP entry.
30
+
31
+ **RULES** — conventions established or constraints discovered:
32
+ - Format: `- MUST/NEVER/PREFER: <rule>`
33
+ - Source: patterns that proved necessary during implementation
34
+
35
+ **DECISIONS** — key design choices that affect future development:
36
+ - Format: `- <what was decided> — <rationale>`
37
+ - Source: non-obvious design choices, interface conventions, cross-module contracts
38
+ - Only record decisions that a future AI session would benefit from knowing
39
+ - Do NOT record obvious implementation details that can be derived by reading the code
40
+
41
+ **QUALITY GATE**: Every item must answer: "If a new AI session reads only `.prizmkit/prizm-docs/` and this entry, does it gain actionable understanding?" If not, discard. Do not record trivially observable code patterns — the AI can read the code directly.
42
+
43
+ **MEMORY HYGIENE GATE**: Before writing any `.prizmkit/prizm-docs/` entry, remove or translate workflow metadata. Never write CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths. If source artifacts say "fixed in B-001" or "implemented in F-003", write only the durable product/domain fact.
44
+
45
+ **2c.** Inject into the correct `.prizmkit/prizm-docs/` file:
46
+ - Module-level TRAPS/RULES/DECISIONS → the affected **L2** `.prizm` file. If the target L2 does not exist, create it first using the L2 GENERATION TEMPLATE before injecting knowledge. (TRAPS/DECISIONS/RULES belong in L2, not L1.)
47
+ - Project-level RULES/PATTERNS → `root.prizm` (respect the current format — MODULE_INDEX or MODULE_GROUPS — do not convert between them during injection)
48
+ - Cross-module concerns spanning 2+ modules → `root.prizm` CROSS_CUTTING section
49
+
50
+ **RULE**: Only add genuinely new information. Never duplicate existing entries. Never rewrite entire files.
@@ -0,0 +1,43 @@
1
+ # Structural Sync — Detailed Steps
2
+
3
+ **1a.** Get changed files (staged + unstaged vs HEAD):
4
+ ```powershell
5
+ git diff HEAD --name-status
6
+ ```
7
+
8
+ **1b.** Read `.prizmkit/prizm-docs/root.prizm` to get MODULE_INDEX (or MODULE_GROUPS). Map each changed file to its module.
9
+
10
+ **1c.** Classify changes:
11
+ - `A` (added) → add to KEY_FILES, check for new INTERFACES
12
+ - `D` (deleted) → remove from KEY_FILES, update FILE count
13
+ - `M` (modified) → check if public interfaces or dependencies changed
14
+ - `R` (renamed) → update all path references
15
+
16
+ **1d.** Update affected docs (bottom-up: L2 → L1 → L0):
17
+
18
+ - **L2**: If L2 exists → update **only the sections affected by the diff files in this module**. For example, if only `api.js` changed: update its KEY_FILES entry, its INTERFACES (if exports changed), its DEPENDENCIES (if imports changed). Do NOT re-scan unchanged files in the module. If L2 does NOT exist AND the module has Added or Modified source files in the current diff with meaningful logic (not trivial config) → create L2 with these sections: MODULE, FILES, RESPONSIBILITY, INTERFACES, DATA_FLOW, KEY_FILES, DEPENDENCIES, RULES, TRAPS, DECISIONS. Populate **only from the diff files** (the Added/Modified files in this module from step 1a), not from the entire module directory.
19
+ - **L1**: Update FILES count, KEY_FILES (if major files added/removed), DEPENDENCIES (if module-level deps changed). **L1 does NOT contain INTERFACES, DATA_FLOW, TRAPS, or DECISIONS** — those belong in L2 only.
20
+ - **L0 root.prizm**: Update MODULE_INDEX file counts only if counts changed. Update CROSS_CUTTING if cross-module concerns changed. Update only if structural change (module added/removed). **Preserve** any `PROJECT_BRIEF:` line — it is managed by prizmkit-init.
21
+
22
+ **Memory hygiene**: During L0/L1/L2 updates, do not write CHANGELOG sections/files, UPDATED/date metadata, feature/bug/refactor/task/session/run/pipeline/workflow IDs, branch names, absolute worktree paths, or `.prizmkit/specs` / `.prizmkit/dev-pipeline` artifact paths. Update durable sections in place; git history is the change log.
23
+
24
+ **1e.** If new directory qualifies as a module and matches no existing module:
25
+ - A directory qualifies as a module if any of: contains source files forming a logical unit, contains entry/config/interface files, contains qualifying sub-modules, or is referenced by multiple modules as dependency.
26
+ - Create L1 doc immediately, add to MODULE_INDEX.
27
+ - If the current diff includes Added or Modified source files with meaningful logic → create L2 immediately. Otherwise defer L2.
28
+
29
+ **1f.** Enforce size limits:
30
+ - L0 > 4KB → if using MODULE_INDEX with > 15 entries, convert to MODULE_GROUPS format (group by functional domain). Otherwise, consolidate MODULE_INDEX descriptions.
31
+ - L1 > 4KB → trim KEY_FILES descriptions, ensure RULES <= 3 entries
32
+ - L2 > 5KB → trim non-essential detail, split oversized cross-cutting detail, or move derived context back to source references
33
+
34
+ **SKIP structural sync if**: only internal implementation changed (no interface/dependency impact), only comments/whitespace, only .prizm files. **DO NOT skip** test file changes or bug fixes — they may reveal TRAPS worth capturing in L2.
35
+
36
+ **1g. TRAPS staleness check** (only when an L2 doc's TRAPS section has > 10 entries):
37
+
38
+ Perform a quick staleness scan on existing TRAPS to prevent unbounded accumulation:
39
+ 1. If a TRAP has `STALE_IF:` and the glob-matched files no longer exist (verified via `Get-ChildItem`) → delete the TRAP entry
40
+ 2. If a TRAP has `REF:` → check if the referenced file still exists and the REF commit is less than 180 days old (via `git log --since="180 days ago" <hash> 2>$null`). If the file is deleted OR the REF commit is older than 180 days → prepend `[REVIEW]` to the severity, signaling it needs verification during the next retrospective Job 2
41
+ 3. Process at most 5 of the oldest TRAPS per L2 doc per session (to bound context cost)
42
+
43
+ This step is lightweight — it only triggers when TRAPS exceed 10 entries, and processes at most 5 per run.
@@ -0,0 +1,281 @@
1
+ ---
2
+ name: "prizmkit-test"
3
+ description: "Full-stack test generation and orchestration. Detects architecture, discovers/runs existing tests, analyzes coverage gaps, generates missing tests (unit/integration/E2E), outputs unified report. Use after completing development to verify quality before deploy. Trigger on: 'test', 'run tests', 'check quality', 'verify code', 'generate tests', 'test coverage', 'fill test gaps', 'quality check', '测试', '验证', '跑测试', '补测试'. (project)"
4
+ ---
5
+
6
+ # PrizmKit Test
7
+
8
+ A comprehensive test generation and orchestration skill. Discovers existing tests, runs them, compares coverage against spec acceptance criteria and module interfaces, generates missing tests at three levels (unit → integration → E2E), and produces a unified report.
9
+
10
+ ### When to Use
11
+ - After completing one or more features/refactors/bugfixes
12
+ - As a quality gate before deploy
13
+ - Project has a test framework installed but zero tests written (first-time test generation)
14
+ - User says "test", "run tests", "verify", "check quality", "补测试"
15
+
16
+ ### When NOT to Use
17
+ - Project has no test framework AND no code to test
18
+ - Trivial single-line config changes
19
+
20
+ ## Precondition
21
+
22
+ | Required State | Check | If Missing |
23
+ |---|---|---|
24
+ | `.prizmkit/prizm-docs/root.prizm` exists | File exists | Run `/prizmkit-init` first |
25
+ | Test framework installed | Dependency in package.json or equivalent | Offer to skip or let user install one manually |
26
+
27
+ If `.prizmkit/prizm-docs/` exists but may be stale (no retrospective run after recent changes), warn user: "Prizm docs may be out of date. Gap analysis accuracy depends on current docs. Continue anyway?"
28
+
29
+ ## Context Loading
30
+
31
+ Before execution, load context once:
32
+
33
+ 1. **Architecture context**: Read `.prizmkit/prizm-docs/root.prizm` (L0 — project overview, module index, tech stack, conventions) and relevant L1 docs for modules in scope. If scope includes specific modules, also load relevant L2 docs for INTERFACES, DATA_FLOW, TRAPS, and DECISIONS.
34
+ 2. **Project config**: Read `.prizmkit/config.json` (tech stack, AI CLI config).
35
+ 3. **Dependencies**: Read `package.json` or equivalent to detect test framework and project type.
36
+
37
+ ## Input
38
+
39
+ | Parameter | Required | Description |
40
+ |-----------|----------|-------------|
41
+ | `scope` | No | User selects interactively in Phase 1. In headless mode, defaults to full project. |
42
+
43
+ ## Execution
44
+
45
+ ### Phase 0: Architecture Detection
46
+
47
+ 1. From context already loaded, classify project type:
48
+
49
+ | Signal | Classification |
50
+ |--------|---------------|
51
+ | react/vue/angular/next in deps, no backend framework | Frontend |
52
+ | express/fastify/django/flask in deps, no frontend framework | Backend |
53
+ | Both present | Fullstack |
54
+ | Neither clear | Ask user (headless: mark as "unknown", skip E2E) |
55
+
56
+ 2. Detect test framework by scanning dependencies:
57
+ - Jest → `npx jest` or `npm test`
58
+ - Vitest → `npx vitest run`
59
+ - pytest → `python -m pytest`
60
+ - Go testing → `go test ./...`
61
+ - Multiple frameworks found → use the one with the most test files; list all in report
62
+ - Custom `npm test` script → use `npm test`
63
+
64
+ 3. **Interactive mode**: Show "Detected: {type}, test framework: {name}. Correct?"
65
+ **Headless mode**: Auto-proceed with detected values, note assumptions in report.
66
+
67
+ ### Phase 1: Scope Selection
68
+
69
+ **Interactive mode** — present three options:
70
+
71
+ 1. **Full project** — all modules, all specs in `.prizmkit/specs/`
72
+ 2. **Single module** — pick from L1 doc module names (e.g., "auth", "payment")
73
+ 3. **Single feature** — pick from `.prizmkit/specs/###-*/` directories
74
+
75
+ **Headless mode** — default to full project. If `artifact_dir` or `scope` was passed by the caller, use that.
76
+
77
+ ### Phase 2: Run Existing Tests
78
+
79
+ 1. Find test directories matching common patterns: `tests/`, `__tests__/`, `*.test.*`, `*.spec.*`. If no test files exist at all, note this and skip to Phase 3 (all coverage is "missing").
80
+
81
+ 2. Run the detected test command in scope. Capture:
82
+ - Pass/fail counts and failed test details
83
+ - Which test files exist (for gap analysis)
84
+ - Raw output (saved to report directory)
85
+
86
+ 3. If existing tests fail: record failures but continue — this is coverage data. Do not attempt to fix pre-existing test failures (they predate this session).
87
+
88
+ ### Phase 3: Coverage Gap Analysis
89
+
90
+ Staleness of `.prizmkit/prizm-docs/` was already checked during Context Loading (see Precondition). Gap analysis proceeds with the available data.
91
+
92
+ Compare what exists against what should exist, across three levels:
93
+
94
+ **Unit test gaps** — for each module in scope:
95
+ - Read the corresponding L2 `.prizm` doc INTERFACES section to get exported functions/classes. If no L2 doc exists for a module, analyze source files directly to identify exported functions/classes.
96
+ - Check if each has a corresponding test file (match project's test naming: `foo.test.ts`, `foo.spec.ts`, `test_foo.py`)
97
+ - Flag uncovered interfaces
98
+
99
+ **Integration test gaps** (skip if project has no API/DB layer — pure library/CLI tool):
100
+ - Read L1 doc DEPENDENCIES section for cross-module interactions
101
+ - Check if tests exist covering module boundaries, API endpoints, DB operations
102
+ - Flag missing integration coverage
103
+
104
+ **E2E test gaps** (skip if project has no UI):
105
+ - Collect acceptance criteria from all spec.md files in scope
106
+ - Check existing E2E test files against these criteria
107
+ - Flag uncovered criteria
108
+
109
+ ### Phase 4: Generate Missing Tests
110
+
111
+ Generate tests in priority order: unit → integration → E2E. After each batch, run immediately.
112
+
113
+ When generated tests fail, distinguish two cases:
114
+ - **Test bug** (syntax error, wrong import, wrong mock, wrong framework API usage) → fix the test and re-run
115
+ - **Assertion failure** (test is valid but code returns unexpected result) → mark as "needs review" in report; do NOT modify production code. This is a potential bug discovered by the generated test.
116
+
117
+ If a test fails repeatedly after 2 fix attempts, skip it and mark as "unresolved" in the report.
118
+
119
+ **4a. Unit Tests (always applicable)**
120
+
121
+ For each uncovered interface:
122
+ - Read the source file to understand function signature and logic
123
+ - Generate test file matching project conventions (framework, naming, directory, import style, mock/fixture patterns)
124
+ - Common naming patterns to match:
125
+ - `src/foo.ts` → `src/__tests__/foo.test.ts` or `src/foo.spec.ts` or `tests/foo_test.py`
126
+ - Mirror the existing pattern; if no tests exist, use the framework's default convention
127
+ - Cover: happy path, edge cases (null/undefined/empty), error conditions, boundary values
128
+ - Do NOT test framework internals or third-party library behavior
129
+ - Run tests immediately after generating
130
+
131
+ **4b. Integration Tests**
132
+
133
+ For each module with dependencies:
134
+ - Generate tests for the module's primary interface exercising its real dependencies
135
+ - If API endpoints exist: request/response tests (valid input, invalid input, missing params, auth)
136
+ - If database operations exist: CRUD tests using the project's existing test database config
137
+ - Run tests immediately after generating
138
+
139
+ **4c. E2E Tests (conditional)**
140
+
141
+ Preconditions (ALL must be met):
142
+ - Playwright is available (`@playwright/test` or `playwright` in package.json dependencies, or `npx playwright --version` succeeds as fallback)
143
+ - Playwright browsers are installed (check `npx playwright install --dry-run 2>/dev/null` exits cleanly, or `node_modules/.cache/ms-playwright/` directory exists; if missing, warn in report and skip E2E)
144
+ - Project has a UI layer
145
+ - Project can be started (start/dev script in package.json)
146
+ - Acceptance criteria exist in spec.md files
147
+
148
+ If ALL met:
149
+ - **Before starting dev server**: detect whether it's already running: (1) check `package.json` scripts for port flags (`--port`, `-p`, `PORT=`), (2) fall back to framework defaults (3000 for React/Next/Express, 5173 for Vite, 8000 for Django, 5000 for Flask), (3) if still unknown, ask the user. Use the detected port in `lsof -i :<port>` to check. If running, tell user: "Dev server appears to be already running on port {N}. Use this running instance for E2E tests?" If user confirms, use existing instance. If user declines, skip E2E.
150
+ - Start the project dev server (only if not already running). Wait for it to be ready.
151
+ - For each uncovered acceptance criterion, generate a Playwright test script
152
+ - Run generated E2E tests, capture screenshots of failures
153
+ - **Only stop dev server if you started it.** Never stop a server that was already running.
154
+
155
+ If NOT met:
156
+ - Note what was skipped and why in the report
157
+ - If only the server wasn't startable: still generate E2E script files but mark as "not run — manual execution needed"
158
+
159
+ ### Phase 5: Unified Report
160
+
161
+ Create `.prizmkit/test/{YYYY_MM_DD_HH_MM_SS}_testresult/` directory.
162
+
163
+ **test-report.md** format:
164
+
165
+ ```markdown
166
+ # Test Report — {timestamp}
167
+
168
+ ## Summary
169
+ - Scope: {full / module: name / feature: ###-name}
170
+ - Architecture: {frontend / backend / fullstack}
171
+ - Test framework: {name}
172
+ - Mode: {interactive / headless}
173
+
174
+ ## Existing Tests
175
+ - Total: {N} | Passed: {N} | Failed: {N}
176
+ {failed test details or "All passing"}
177
+ {or "No existing tests found — generated first batch"}
178
+
179
+ ## Coverage Gaps Found
180
+ | Module | Interface | Type | Status |
181
+ |--------|-----------|------|--------|
182
+ | ... | ... | unit/integration/e2e | covered / generated / needs-review / unresolved / skipped |
183
+
184
+ ## Generated Tests
185
+ - Unit: {N} generated, {N} needs-review, {N} unresolved
186
+ - Integration: {N} generated, {N} needs-review, {N} unresolved
187
+ - E2E: {N} generated, {N} skipped ({reason})
188
+
189
+ ## Final Status
190
+ - All tests passing: {yes / no}
191
+ - Needs human review: {list of tests marked needs-review}
192
+ {remaining failures if any}
193
+ ```
194
+
195
+ Also save:
196
+ - `existing-test-output.txt` — raw output from Phase 2
197
+ - `generated-tests/` — copies of all generated test files
198
+ - `e2e-output/` — E2E logs and failure screenshots (if applicable)
199
+
200
+ ## Output
201
+
202
+ - Test report: `.prizmkit/test/{timestamp}_testresult/test-report.md`
203
+ - Generated test files written to project test directories
204
+ - Existing test output, generated test copies, and E2E artifacts in the report directory
205
+
206
+ ## Recovery
207
+
208
+ If the session is interrupted:
209
+ - Check `.prizmkit/test/` for the most recent report directory — it contains what was completed before interruption
210
+ - Re-run `/prizmkit-test` — it starts fresh, but Phase 2 will skip tests that already pass, and Phase 3 will re-evaluate gaps
211
+
212
+ ## Examples
213
+
214
+ ### Example 1: Full-Project Quality Check with Test Generation
215
+
216
+ **User**: `/prizmkit-test`
217
+
218
+ **Phase 0 — Architecture Detection**:
219
+ ```
220
+ Detected: Fullstack (React + Express)
221
+ Test framework: Vitest (7 existing test files)
222
+ ```
223
+
224
+ **Phase 1 — Scope Selection** (user selects option 1):
225
+ ```
226
+ Scope: Full project (all modules, all specs)
227
+ ```
228
+
229
+ **Phase 2 — Existing Tests**: 7 test files found, 20 tests run, 18 passed, 2 pre-existing failures (recorded, not fixed).
230
+
231
+ **Phase 3 — Gap Analysis** (excerpt):
232
+ | Module | Interface | Type | Status |
233
+ |--------|-----------|------|--------|
234
+ | auth | login() | unit | missing |
235
+ | auth | register() | unit | missing |
236
+ | payment | processPayment() | unit | missing |
237
+ | payment | api/checkout | integration | missing |
238
+ | — | Checkout flow | e2e | missing |
239
+
240
+ **Phase 4**: Generated 5 unit tests (3 passing, 2 assertion failures marked "needs-review"), 1 integration test (passing), 1 E2E test (passing).
241
+
242
+ **Phase 5 — Report Summary**:
243
+ ```
244
+ Generated: 5 unit (2 needs-review), 1 integration, 1 E2E
245
+ Report: .prizmkit/test/2026_05_23_14_30_00_testresult/test-report.md
246
+ Needs human review: processPayment (returns 400 for negative amounts, expected 422), refund (missing authorization header causes 500 instead of 401)
247
+ ```
248
+
249
+ ### Example 2: Single-Feature Targeted Test
250
+
251
+ **User**: `/prizmkit-test`
252
+
253
+ **Phase 0 — Architecture Detection**:
254
+ ```
255
+ Detected: Backend (Express)
256
+ Test framework: Vitest
257
+ ```
258
+
259
+ **Phase 1 — Scope Selection** (user selects option 3, then picks "042-payment-gateway"):
260
+ ```
261
+ Scope: Single feature — 042-payment-gateway
262
+ Test files in scope: 2
263
+
264
+ **Phase 2 — Existing Tests**: 2 test files, 8 tests, all passing.
265
+
266
+ **Phase 3 — Gap Analysis** (excerpt):
267
+ | Module | Interface | Type | Status |
268
+ |--------|-----------|------|--------|
269
+ | payment | processPayment() | unit | missing |
270
+ | payment | refund() | unit | missing |
271
+
272
+ **Phase 4**: Generated 2 unit tests (both passing). No integration/E2E applicable for this scope.
273
+
274
+ **Phase 5 — Report Summary**:
275
+ ```
276
+ Generated: 2 unit tests (all passing)
277
+ Report: .prizmkit/test/2026_05_23_15_00_00_testresult/test-report.md
278
+ All tests passing. Ready for commit.
279
+ ```
280
+
281
+ **HANDOFF:** Independent skill — no handoff. User may proceed to `/prizmkit-committer` if all tests pass, or fix issues manually if tests are marked "needs-review".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.1.78",
3
+ "version": "1.1.79",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {