@uoyo/mvtt 2.0.0-beta.0 → 2.0.0-beta.2

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 (151) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +194 -209
  3. package/dist/build/assembler.d.ts.map +1 -1
  4. package/dist/build/assembler.js +2 -0
  5. package/dist/build/assembler.js.map +1 -1
  6. package/dist/build/plan-validator.d.ts +26 -0
  7. package/dist/build/plan-validator.d.ts.map +1 -0
  8. package/dist/build/plan-validator.js +225 -0
  9. package/dist/build/plan-validator.js.map +1 -0
  10. package/dist/build/section-loader.d.ts.map +1 -1
  11. package/dist/build/section-loader.js +45 -9
  12. package/dist/build/section-loader.js.map +1 -1
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +2 -11
  15. package/dist/cli.js.map +1 -1
  16. package/dist/commands/doctor.d.ts.map +1 -1
  17. package/dist/commands/doctor.js +0 -1
  18. package/dist/commands/doctor.js.map +1 -1
  19. package/dist/commands/install.d.ts +1 -4
  20. package/dist/commands/install.d.ts.map +1 -1
  21. package/dist/commands/install.js +18 -14
  22. package/dist/commands/install.js.map +1 -1
  23. package/dist/commands/migrate.d.ts +16 -0
  24. package/dist/commands/migrate.d.ts.map +1 -0
  25. package/dist/commands/migrate.js +118 -0
  26. package/dist/commands/migrate.js.map +1 -0
  27. package/dist/commands/update.d.ts.map +1 -1
  28. package/dist/commands/update.js +35 -2
  29. package/dist/commands/update.js.map +1 -1
  30. package/dist/fs/core-manifest.d.ts +17 -0
  31. package/dist/fs/core-manifest.d.ts.map +1 -0
  32. package/dist/fs/core-manifest.js +76 -0
  33. package/dist/fs/core-manifest.js.map +1 -0
  34. package/dist/fs/install-manifest.d.ts +1 -2
  35. package/dist/fs/install-manifest.d.ts.map +1 -1
  36. package/dist/fs/install-manifest.js +1 -2
  37. package/dist/fs/install-manifest.js.map +1 -1
  38. package/dist/fs/materialize.d.ts.map +1 -1
  39. package/dist/fs/materialize.js +23 -3
  40. package/dist/fs/materialize.js.map +1 -1
  41. package/dist/types/core-manifest.d.ts +12 -0
  42. package/dist/types/core-manifest.d.ts.map +1 -0
  43. package/dist/types/core-manifest.js +2 -0
  44. package/dist/types/core-manifest.js.map +1 -0
  45. package/dist/types/registry.d.ts +13 -5
  46. package/dist/types/registry.d.ts.map +1 -1
  47. package/install-manifest.yaml +31 -27
  48. package/package.json +57 -57
  49. package/registry.yaml +198 -209
  50. package/sources/defaults/config.yaml +27 -30
  51. package/sources/defaults/project-context.yaml +15 -26
  52. package/sources/defaults/session.yaml +31 -23
  53. package/sources/knowledge/core/manifest.yaml +4 -45
  54. package/sources/sections/activation-load-config.md +11 -5
  55. package/sources/sections/activation-load-context.md +26 -11
  56. package/sources/sections/activation-preflight.md +14 -4
  57. package/sources/sections/footer-next-steps.md +35 -9
  58. package/sources/sections/output-language-constraint.md +11 -0
  59. package/sources/sections/role-header.md +13 -13
  60. package/sources/sections/session-update.md +47 -0
  61. package/sources/skills/mvt-analyze/business.md +69 -33
  62. package/sources/skills/mvt-analyze/manifest.yaml +90 -89
  63. package/sources/skills/mvt-analyze-code/business.md +82 -35
  64. package/sources/skills/mvt-analyze-code/manifest.yaml +96 -88
  65. package/sources/skills/mvt-bug-detect/business.md +101 -0
  66. package/sources/skills/mvt-bug-detect/manifest.yaml +84 -0
  67. package/sources/skills/mvt-check-context/business.md +89 -42
  68. package/sources/skills/mvt-check-context/manifest.yaml +63 -74
  69. package/sources/skills/mvt-cleanup/business.md +80 -31
  70. package/sources/skills/mvt-cleanup/manifest.yaml +85 -93
  71. package/sources/skills/mvt-config/business.md +94 -26
  72. package/sources/skills/mvt-config/manifest.yaml +96 -108
  73. package/sources/skills/mvt-create-skill/business.md +231 -111
  74. package/sources/skills/mvt-create-skill/manifest.yaml +91 -79
  75. package/sources/skills/mvt-design/business.md +116 -34
  76. package/sources/skills/mvt-design/manifest.yaml +96 -105
  77. package/sources/skills/mvt-fix/business.md +132 -28
  78. package/sources/skills/mvt-fix/manifest.yaml +85 -86
  79. package/sources/skills/mvt-help/business.md +74 -70
  80. package/sources/skills/mvt-help/manifest.yaml +67 -61
  81. package/sources/skills/mvt-implement/business.md +91 -32
  82. package/sources/skills/mvt-implement/manifest.yaml +80 -96
  83. package/sources/skills/mvt-init/business.md +164 -49
  84. package/sources/skills/mvt-init/manifest.yaml +101 -93
  85. package/sources/skills/mvt-manage-context/business.md +175 -0
  86. package/sources/skills/mvt-manage-context/manifest.yaml +123 -0
  87. package/sources/skills/mvt-plan-dev/business.md +75 -0
  88. package/sources/skills/mvt-plan-dev/manifest.yaml +91 -0
  89. package/sources/skills/mvt-quick-dev/business.md +99 -0
  90. package/sources/skills/mvt-quick-dev/manifest.yaml +69 -0
  91. package/sources/skills/mvt-refactor/business.md +104 -33
  92. package/sources/skills/mvt-refactor/manifest.yaml +86 -101
  93. package/sources/skills/mvt-resume/business.md +137 -0
  94. package/sources/skills/mvt-resume/manifest.yaml +71 -0
  95. package/sources/skills/mvt-review/business.md +112 -49
  96. package/sources/skills/mvt-review/manifest.yaml +87 -106
  97. package/sources/skills/mvt-status/business.md +71 -24
  98. package/sources/skills/mvt-status/manifest.yaml +66 -74
  99. package/sources/skills/mvt-sync-context/business.md +150 -25
  100. package/sources/skills/mvt-sync-context/manifest.yaml +96 -84
  101. package/sources/skills/mvt-template/business.md +96 -49
  102. package/sources/skills/mvt-template/manifest.yaml +63 -71
  103. package/sources/skills/mvt-test/business.md +104 -36
  104. package/sources/skills/mvt-test/manifest.yaml +102 -111
  105. package/sources/skills/mvt-update-plan/business.md +72 -0
  106. package/sources/skills/mvt-update-plan/manifest.yaml +132 -0
  107. package/sources/templates/analyze-output/body.md +15 -38
  108. package/sources/templates/analyze-output/manifest.yaml +11 -11
  109. package/sources/templates/design-output/body.md +17 -50
  110. package/sources/templates/design-output/manifest.yaml +11 -11
  111. package/sources/templates/implement-output/body.md +11 -32
  112. package/sources/templates/implement-output/manifest.yaml +11 -11
  113. package/sources/templates/project-context/body.md +13 -0
  114. package/sources/templates/project-context/manifest.yaml +12 -0
  115. package/sources/templates/review-output/body.md +11 -45
  116. package/sources/templates/review-output/manifest.yaml +11 -11
  117. package/sources/templates/test-output/body.md +7 -31
  118. package/sources/templates/test-output/manifest.yaml +11 -11
  119. package/dist/fs/protection.d.ts +0 -15
  120. package/dist/fs/protection.d.ts.map +0 -1
  121. package/dist/fs/protection.js +0 -16
  122. package/dist/fs/protection.js.map +0 -1
  123. package/sources/knowledge/core/review-principles.md +0 -51
  124. package/sources/knowledge/patterns/clean-architecture/manifest.yaml +0 -66
  125. package/sources/knowledge/patterns/clean-architecture/review-checklist.md +0 -230
  126. package/sources/knowledge/patterns/ddd/manifest.yaml +0 -83
  127. package/sources/knowledge/patterns/ddd/review-checklist.md +0 -226
  128. package/sources/knowledge/patterns/ddd/tactical-patterns.md +0 -12
  129. package/sources/knowledge/patterns/frontend-react/manifest.yaml +0 -44
  130. package/sources/knowledge/patterns/frontend-react/review-checklist.md +0 -78
  131. package/sources/knowledge/patterns/manifest.yaml +0 -113
  132. package/sources/skills/mvt-add-context/business.md +0 -47
  133. package/sources/skills/mvt-add-context/manifest.yaml +0 -83
  134. package/sources/templates/analyze-code-output/body.md +0 -44
  135. package/sources/templates/analyze-code-output/manifest.yaml +0 -11
  136. package/sources/templates/cleanup-output/body.md +0 -9
  137. package/sources/templates/cleanup-output/manifest.yaml +0 -11
  138. package/sources/templates/config-output/body.md +0 -11
  139. package/sources/templates/config-output/manifest.yaml +0 -11
  140. package/sources/templates/context-check-output/body.md +0 -32
  141. package/sources/templates/context-check-output/manifest.yaml +0 -11
  142. package/sources/templates/fix-output/body.md +0 -30
  143. package/sources/templates/fix-output/manifest.yaml +0 -11
  144. package/sources/templates/init-output/body.md +0 -34
  145. package/sources/templates/init-output/manifest.yaml +0 -11
  146. package/sources/templates/refactor-output/body.md +0 -32
  147. package/sources/templates/refactor-output/manifest.yaml +0 -11
  148. package/sources/templates/status-output/body.md +0 -36
  149. package/sources/templates/status-output/manifest.yaml +0 -11
  150. package/sources/templates/sync-context-output/body.md +0 -16
  151. package/sources/templates/sync-context-output/manifest.yaml +0 -11
@@ -1,49 +1,96 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Load Template Inventory
4
- - Read registry to get all registered templates
5
- - Scan `custom/` directory for existing custom versions
6
- - Build status list: default / customized for each template
7
-
8
- ### Step 2: Display Template List
9
- Show all templates with their status:
10
-
11
- ```markdown
12
- ## Output Templates
13
-
14
- | # | Template | Skill | Status |
15
- |---|---------|-------|--------|
16
- | 1 | analyze-output.md | mvt-analyze | Default |
17
- | 2 | design-output.md | mvt-design | Customized |
18
- | ... | ... | ... | ... |
19
-
20
- **Actions**: `view {#}`, `customize {#}`, `reset {#}`, `export {#}`
21
- ```
22
-
23
- ### Step 3: Execute Action (based on user choice)
24
-
25
- **View**:
26
- - Display full template content
27
- - If custom version exists, show that; otherwise show default
28
- - Indicate which version is being shown
29
-
30
- **Customize**:
31
- 1. Show current default template
32
- 2. Ask user to describe desired modifications
33
- 3. Generate new template based on modifications
34
- 4. Preview the customized template
35
- 5. Save to `custom/{template-name}` after user confirmation
36
- 6. Custom template must retain frontmatter (`id`, `version`, `skill`)
37
-
38
- **Reset**:
39
- 1. Confirm user wants to reset to default
40
- 2. Delete the custom version from `custom/`
41
- 3. Confirm reset complete
42
-
43
- **Export**:
44
- - Output template content to user-specified location
45
- - Or display in a code block for manual copy
46
-
47
- ### Step 4: Confirmation
48
- - Show result of the action taken
49
- - Confirm files modified
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Load Inputs
4
+ - **Recommended**:
5
+ - `.ai-agents/skills/_templates/` -- default templates (read-only from this skill).
6
+
7
+ ### Step 2: Build Template Inventory
8
+ - **What**: produce the canonical list of templates with their status.
9
+ - **How**:
10
+ 1. From `registry.yaml`, collect every `skills.<name>.template` value that is not null.
11
+ 2. For each entry, derive the basename (e.g., `analyze-output.md`).
12
+ 3. For each basename:
13
+ - `default` exists if the file is present under `.ai-agents/skills/_templates/`.
14
+ - `custom` exists if the file is present under `.ai-agents/skills/_templates/custom/` with the same basename.
15
+ 4. Status:
16
+ - `Default` if only default exists.
17
+ - `Customized` if both exist.
18
+ - `Orphan-custom` if custom exists but registry has no skill referencing it (surface as a warning).
19
+ - `Missing` if registry references a basename that has no default file (surface as a warning).
20
+
21
+ ### Step 3: Display Inventory and Wait for Action
22
+ - Render the inventory as a numbered table:
23
+
24
+ ```markdown
25
+ | # | Template | Skill(s) | Status |
26
+ |---|----------|----------|--------|
27
+ | 1 | analyze-output.md | mvt-analyze | Default |
28
+ | 2 | design-output.md | mvt-design | Customized |
29
+ ```
30
+
31
+ - Below the table, list available actions: `view {#}`, `customize {#}`, `reset {#}`, `export {#} [path]`.
32
+ - If any `Orphan-custom` or `Missing` rows exist, print a one-line warning above the table.
33
+ - Wait for user input. The `{#}` may be a number or the basename.
34
+
35
+ ### Step 4: Dispatch Action
36
+
37
+ #### 4a. View
38
+ - **What**: show the active version of the template.
39
+ - **How**:
40
+ 1. If `Customized`, read the custom file. Otherwise read the default.
41
+ 2. Print the file content in a fenced code block, prefixed by a single line: `Showing: <default|custom> -- <path>`.
42
+ 3. No write.
43
+
44
+ #### 4b. Customize
45
+ - **What**: create or update the custom override; preserve a structure the assembler can still consume.
46
+ - **How** (4-step subflow):
47
+ 1. **Show baseline**: print the current active version (custom if exists, otherwise default).
48
+ 2. **Collect modifications from the user**: ask for one of these explicit input forms (do not improvise):
49
+ - "replace section `<heading>` with: ..."
50
+ - "add section `<heading>` after `<existing-heading>`: ..."
51
+ - "remove section `<heading>`"
52
+ - "edit frontmatter field `<key>` to `<value>`"
53
+ - "free-form patch: <unified diff>"
54
+ 3. **Preview**: render the resulting file (full content) and a diff against the baseline. Do NOT write yet.
55
+ 4. **Validate** (mandatory before write):
56
+ - Frontmatter block (`---\n...\n---`) must be present and parseable.
57
+ - Required frontmatter keys (`id`, `version`, `skill` if originally present) must be retained.
58
+ - All Mustache placeholders that were present in the default and that the assembler relies on (`{{...}}`, `{{#...}}`, `{{?...}}`, `{{^...}}`) must still be present unless the user explicitly removed them; warn if removed.
59
+ - Validation failures -> abort write, surface the failed checks, return to step 2 of this subflow.
60
+ 5. **Confirm and write**: prompt `Save customized template to .ai-agents/skills/_templates/custom/<name>? (y/n)`. On `y`, write atomically (temp + rename). Backup any existing custom file as `<name>.bak` first.
61
+
62
+ #### 4c. Reset
63
+ - **What**: revert to the default template.
64
+ - **How**:
65
+ 1. If no custom file exists, report "Already default, nothing to reset" and stop.
66
+ 2. Show a one-line summary of what will be deleted (`<path>`, last modified date).
67
+ 3. Require explicit confirmation: `Delete custom override <name>? (y/n)`.
68
+ 4. On `y`, delete the file. Do NOT keep a backup -- user must use git for recovery.
69
+ 5. Report success and the new status (`Default`).
70
+
71
+ #### 4d. Export
72
+ - **What**: emit the template content to a destination chosen by the user.
73
+ - **How**:
74
+ 1. Determine source: custom version if exists, otherwise default. Print which one is being exported.
75
+ 2. Determine destination using the table:
76
+
77
+ | User input | Destination |
78
+ |------------|-------------|
79
+ | No path given | Print the content as a fenced code block in chat |
80
+ | Relative or absolute file path | Write to that path; if file exists, ask for confirmation before overwriting |
81
+ | Literal string `custom` | Copy default to `.ai-agents/skills/_templates/custom/<name>` (use as starting point for customization) |
82
+
83
+ 3. Never write outside the project root unless an absolute path was explicitly provided by the user.
84
+
85
+ ### Step 5: (session update handled by shared section)
86
+
87
+ ## Edge Cases & Errors
88
+
89
+ | Case | Handling |
90
+ |------|----------|
91
+ | User selects a `#` that doesn't exist in inventory | Re-display the table, ask again |
92
+ | `customize` validation fails repeatedly | After two failed attempts, suggest user export to a file and edit manually, then re-import via `customize` with `free-form patch` |
93
+ | Custom file exists but registry no longer references the template (`Orphan-custom`) | Allow `view` and `reset`; refuse `customize` (stale target); recommend running `/mvt-init --refresh` or removing the file manually |
94
+ | Default file is missing (`Missing`) | Refuse all actions for that row; suggest reinstall (`mvtt install`) |
95
+ | User aborts at any confirmation prompt | Do not modify any file; report "no changes" |
96
+ | External process modified the file between preview and write | Detect via mtime check just before write; abort and re-run preview |
@@ -1,71 +1,63 @@
1
- name: mvt-template
2
- output: .claude/skills/mvt-template/SKILL.md
3
-
4
- frontmatter:
5
- name: mvt-template
6
- description: "View, customize, and manage output templates for MVTT skills. Use when user wants to see available templates, create custom template versions, reset to defaults, or export templates."
7
-
8
- sections:
9
- - type: inline
10
- content: |
11
- # MVT Custom Template
12
-
13
- ## Purpose
14
-
15
- Provide an interactive tool for viewing, customizing, and managing MVTT output templates. Users can inspect default templates, create custom versions that override defaults, reset customizations, and export templates.
16
-
17
- - type: shared
18
- source: sections/role-header.md
19
- params:
20
- role: Conductor
21
- role_desc: "a Workflow Coordinator"
22
- decision_rules:
23
- - rule: "No arguments -> Show template list with status"
24
- - rule: "User selects \"view\" -> Display full template content (custom version if exists)"
25
- - rule: "User selects \"customize\" -> Guide through modification process"
26
- - rule: "User selects \"reset\" -> Delete custom version, restore default"
27
- - rule: "User selects \"export\" -> Output template to specified location"
28
- - rule: "Custom template must preserve frontmatter format"
29
- boundaries:
30
- - scope: "modify default templates in `_templates/` root"
31
- skill: "(Only create/modify in `custom/`)"
32
- - scope: "modify skill logic"
33
- skill: "(Only change output formatting)"
34
-
35
- - type: shared
36
- source: sections/activation-load-context.md
37
- params:
38
- extended_context:
39
- - ".ai-agents/registry.yaml -- Template registry"
40
- - "Scan `.ai-agents/skills/_templates/custom/` for existing customizations"
41
-
42
- - type: shared
43
- source: sections/activation-load-config.md
44
-
45
- - type: inline
46
- content: |
47
- ### Step 3: Pre-flight Checks
48
- - No blocking checks required.
49
-
50
- ### Step 4: Execute
51
- Proceed to Execution Flow below.
52
-
53
- - type: file
54
- source: ./business.md
55
-
56
- - type: inline
57
- content: |
58
- ## Output Format
59
-
60
- No external template -- output is inline based on the action:
61
-
62
- ```markdown
63
- ## Template Manager
64
-
65
- {Action-specific content}
66
-
67
- ---
68
- **Suggested Next Steps**:
69
- - `/mvt-template` -- Manage more templates
70
- - `/mvt-help` -- View all available skills
71
- ```
1
+ name: mvt-template
2
+ output: .claude/skills/mvt-template/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-template
6
+ description: "View, customize, and manage output templates for MVTT skills. This skill should be used when user wants to inspect available templates, create custom template versions, reset customizations, or export templates."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Custom Template
12
+
13
+ ## Purpose
14
+
15
+ View, customize, and manage MVTT output templates. Inspect default templates, create custom versions that override defaults, reset customizations, and export templates.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Conductor
21
+ role_desc: "a Workflow Coordinator"
22
+ decision_rules:
23
+ - rule: "No arguments -> Show template list with status"
24
+ - rule: "User selects \"view\" -> Display full template content (custom version if exists)"
25
+ - rule: "User selects \"customize\" -> Guide through modification process"
26
+ - rule: "User selects \"reset\" -> Delete custom version, restore default"
27
+ - rule: "User selects \"export\" -> Output template to specified location"
28
+ - rule: "Custom template must preserve frontmatter format"
29
+ boundaries:
30
+ - scope: "modify default templates in `_templates/` root"
31
+ skill: "(Only create/modify in `custom/`)"
32
+ - scope: "modify skill logic"
33
+ skill: "(Only change output formatting)"
34
+
35
+ - type: shared
36
+ source: sections/activation-load-context.md
37
+ params:
38
+ extended_context:
39
+ - "Scan `.ai-agents/skills/_templates/custom/` for existing customizations"
40
+
41
+ - type: shared
42
+ source: sections/activation-load-config.md
43
+
44
+ - type: shared
45
+ source: sections/output-language-constraint.md
46
+
47
+ - type: inline
48
+ content: |
49
+ ### Step 3: Pre-flight Checks
50
+ - No blocking checks required.
51
+
52
+ - type: file
53
+ source: ./business.md
54
+
55
+ - type: shared
56
+ source: sections/session-update.md
57
+ params:
58
+ read_only: true
59
+
60
+ - type: shared
61
+ source: sections/footer-next-steps.md
62
+ params:
63
+ current_skill: mvt-template
@@ -1,36 +1,104 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Load Context
4
- - Read implementation files
5
- - Read project-context for tech stack and test framework
6
- - Identify test framework conventions
7
-
8
- ### Step 2: Analyze Test Scenarios
9
- - Identify happy path scenarios
10
- - Identify edge cases and boundary conditions
11
- - Identify error scenarios
12
- - Identify security test cases (if applicable)
13
-
14
- ### Step 3: Design Test Cases
15
- - Create test case table with IDs, scenarios, inputs, expected outputs
16
- - Define preconditions for each test
17
- - Prioritize by type (happy path and edge cases first)
18
-
19
- ### Step 4: Write Test Code
20
- - Follow project's test framework conventions
21
- - Write clear, descriptive test names
22
- - Include setup, action, and assertion sections
23
- - Use mocks/stubs for external dependencies
24
-
25
- ### Step 5: Coverage Analysis (with --coverage)
26
- - Map test cases to requirements
27
- - Identify coverage gaps
28
- - Recommend additional tests for missing coverage
29
-
30
- ### Step 6: Update Workspace
31
- 1. Update `.ai-agents/workspace/session.yaml`:
32
- - Set `progress.test: done`
33
- - Set `session.last_command: "/mvt-test"`
34
- - Append one-line summary to `recent_actions` (keep max 3)
35
- 2. Write test files to the project
36
- 3. Write artifact: `.ai-agents/workspace/artifacts/{change-id}/tests/`
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Load Inputs
4
+ - **Required**:
5
+ - The implementation files to test (see Step 2 for resolution).
6
+ - **Recommended**:
7
+ - Existing tests near the target files -- to follow conventions and avoid duplication.
8
+ - **Fallback**:
9
+ - If test framework is unspecified in `project-context.yaml`, infer from package manifests (jest/vitest/pytest/junit/...) and ask user to confirm before generating tests.
10
+ - If `project-context.md` business rules are missing, derive scenarios solely from code and design; mark coverage analysis as "rule-mapping unavailable".
11
+
12
+ ### Step 2: Resolve Test Target
13
+ - **What**: produce the file list under test.
14
+ - **How**: pick the FIRST source that yields a non-empty list.
15
+
16
+ | Source | Condition |
17
+ |--------|-----------|
18
+ | User-provided feature/file argument (`/mvt-test {feature}`) | Argument present |
19
+ | `implementation.md` -> `Files Touched` | Active change has implementation artifact |
20
+ | `git diff --name-only main...HEAD` filtered to source dirs | Inside a feature branch |
21
+ | Recently modified source files | Last-resort, last 24h mtime |
22
+
23
+ - For each target file, locate or plan its corresponding test file path using the project's test layout convention (mirror under `tests/`, sibling `*.test.ts`, etc.).
24
+
25
+ ### Step 3: Identify Test Scenarios
26
+ - **What**: produce a Scenario Table covering happy path, edge, negative, and security cases.
27
+ - **How**:
28
+ 1. For each public function / endpoint in scope, list at least: 1 happy path, 1 boundary, 1 invalid input.
29
+ 2. For each business rule from `project-context.md` that this code implements, list at least 1 scenario asserting the rule.
30
+ 3. For each error path declared in `design.md` data flow, list at least 1 scenario.
31
+ 4. Consult the Test Case Types table (provided in shared section above):
32
+ - Happy Path / Edge / Negative -> always include if applicable.
33
+ - Security -> include only when requirements mention auth, data sensitivity, or external input boundaries.
34
+ - Performance -> include only when requirements explicitly state SLAs.
35
+
36
+ ### Step 4: Choose Test Granularity
37
+ - **What**: assign each scenario to unit / integration / E2E.
38
+ - **How**: use the rule below; one scenario maps to one granularity.
39
+
40
+ | Granularity | Use when |
41
+ |-------------|----------|
42
+ | Unit | Pure logic, single class/function, no IO, deterministic |
43
+ | Integration | Crosses a system boundary (DB, HTTP, queue, file system); module collaboration without UI |
44
+ | E2E | User-visible flow that traverses multiple services or includes UI interaction |
45
+
46
+ - A single scenario should not be tested at multiple granularities unless explicitly required (avoid wasteful duplication).
47
+ - Flag scenarios that need integration but the project lacks an integration test setup -> note in artifact, suggest setup, do not invent a fixture.
48
+
49
+ ### Step 5: Design Test Cases
50
+ - **What**: turn each scenario into a concrete test case row.
51
+ - **How**: each row must include `id | scenario | granularity | preconditions | inputs | actions | expected | rule-traced-to`.
52
+ - Prioritize: every business rule trace must be present; happy paths first, then edges, then negatives, then security/performance.
53
+ - For external dependencies, decide mock/stub/fake per project conventions; document the choice.
54
+
55
+ ### Step 6: Write Test Code
56
+ - **What**: emit test files using project conventions.
57
+ - **How**:
58
+ 1. Match the project's existing test framework, file layout, and naming.
59
+ 2. Test names describe the scenario in business language ("rejects login when password is expired"), not the function name.
60
+ 3. Each test follows arrange / act / assert structure with no hidden setup.
61
+ 4. Use mocks/stubs only at boundaries identified in Step 4; do NOT mock the unit under test.
62
+ 5. Do not modify the production code being tested -- if implementation has a bug, surface it (Step 8) and recommend `/mvt-fix`.
63
+ 6. Avoid `skip` / `only` / commented-out tests in the final output.
64
+
65
+ ### Step 7: Coverage Analysis (only when `--coverage` flag set)
66
+ - **What**: produce a coverage map and gap list.
67
+ - **How**:
68
+ 1. Map each test case (Step 5) back to: a target file/function, and (if available) a business rule from `project-context.md`.
69
+ 2. Identify gaps: target functions with no test, business rules with no test, error paths from `design.md` with no test.
70
+ 3. Read coverage thresholds from `.ai-agents/config.yaml` if present; otherwise default targets: line >= 80%, branch >= 70%, business-rule == 100%.
71
+ 4. Recommend additional test cases for each gap; do not auto-generate them in this run unless user confirms.
72
+
73
+ ### Step 8: Surface Implementation Issues (if any)
74
+ - During scenario design or test writing you may discover the implementation is wrong (failing test reveals a real bug, not a test bug).
75
+ - **Do not** modify production code from this skill.
76
+ - Record each finding with: scenario id, expected vs observed, severity (Critical / Warning), and recommend `/mvt-fix`.
77
+
78
+ ### Step 9: Write Artifact
79
+ - **Path**: `.ai-agents/workspace/artifacts/{active_change.id}/tests/test-design.md`.
80
+ - **Template**: `.ai-agents/skills/_templates/test-output.md` (custom override at `_templates/custom/...` takes precedence).
81
+ - **Required content** (mapped to template headings):
82
+ - `Scope` -- target files, fallbacks applied.
83
+ - `Test Framework & Layout` -- chosen framework, file layout convention.
84
+ - `Test Scenarios` -- the Scenario Table from Step 3.
85
+ - `Test Cases` -- the row-level table from Step 5.
86
+ - `Granularity Decisions` -- summary from Step 4, including any "needs setup" gaps.
87
+ - `Coverage Analysis` -- only when `--coverage`; otherwise omit the heading.
88
+ - `Implementation Issues Found` -- from Step 8; empty list is fine.
89
+ - `Suggested Run Commands` -- one or two commands the user can copy-paste.
90
+ - The actual test files go to the project tree; the artifact is a record.
91
+
92
+ ### Step 10: (session update handled by shared section)
93
+
94
+ ## Edge Cases & Errors
95
+
96
+ | Case | Handling |
97
+ |------|----------|
98
+ | Test framework unsupported by environment (e.g., language has no widely-used framework) | STOP, report, ask user for guidance; do not improvise a custom harness |
99
+ | Implementation files have zero public API (purely internal) | Cap at integration-level scenarios; do not test private symbols |
100
+ | Existing tests for the target are present and conflict with new scenarios | Surface the conflict in `Implementation Issues Found`; do not silently delete or rewrite existing tests |
101
+ | External services required and not mockable (e.g., real LLM call) | Use recorded fixtures if conventional; otherwise mark scenarios as `requires-live-service` and skip code generation |
102
+ | Flaky test detected during writing | Add deterministic seeding/clock; if not possible, mark as `flaky-suspected` and surface in artifact |
103
+ | User asks to "skip edge cases" | Refuse: edge cases are a non-negotiable boundary of this skill; explain and continue |
104
+ | `--coverage` set but coverage tool not configured in project | Generate the gap list from scenarios alone; suggest tool setup; do not invoke a non-existent coverage runner |
@@ -1,111 +1,102 @@
1
- name: mvt-test
2
- output: .claude/skills/mvt-test/SKILL.md
3
-
4
- frontmatter:
5
- name: mvt-test
6
- description: "Generate and design tests to validate implementations. Creates test cases covering happy paths, edge cases, negative scenarios, and security. Use when user wants to write tests or validate code."
7
-
8
- sections:
9
- - type: inline
10
- content: |
11
- # MVT Test
12
-
13
- ## Purpose
14
-
15
- Design and write tests to validate implementations against requirements. Ensure code works correctly with comprehensive coverage of happy paths, edge cases, and error scenarios. This is the fifth phase in the full workflow: analyze -> design -> implement -> review -> test.
16
-
17
- - type: shared
18
- source: sections/role-header.md
19
- params:
20
- role: Tester
21
- role_desc: "a Quality Assurance Specialist"
22
- decision_rules:
23
- - rule: "Happy path works -> Add edge case and boundary tests"
24
- - rule: "Bug found during testing -> Document with reproduction steps, suggest `/mvt-fix`"
25
- - rule: "Coverage gap found -> Add tests focused on that area"
26
- - rule: "Flaky test detected -> Flag for investigation"
27
- - rule: "Test requires external service -> Use mocks/stubs, document the dependency"
28
- - rule: "Security constraints in requirements -> Add security-focused test cases"
29
- - rule: "Existing tests conflict with new implementation -> Flag the conflict"
30
- boundaries:
31
- - scope: "modify the code being tested"
32
- skill: "/mvt-fix"
33
- - scope: "make architecture decisions"
34
- skill: "(Test against existing design)"
35
- - scope: "skip edge cases or negative tests"
36
- skill: "(Never)"
37
-
38
- - type: inline
39
- content: |
40
- ## Variants
41
-
42
- | Variant | Description |
43
- |---------|-------------|
44
- | `/mvt-test` | Generate tests for recent implementation |
45
- | `/mvt-test {feature}` | Generate tests for specific feature |
46
- | `/mvt-test --coverage` | Generate tests with coverage analysis |
47
-
48
- - type: shared
49
- source: sections/activation-load-context.md
50
- params:
51
- extended_context:
52
- - ".ai-agents/knowledge/core/review-principles.md -- Code quality principles"
53
- - ".ai-agents/knowledge/patterns/{pattern.active}/ -- Active pattern knowledge"
54
- - ".ai-agents/knowledge/principle/coding-standards.md -- Project coding standards"
55
- - "Implementation files to be tested"
56
-
57
- - type: shared
58
- source: sections/activation-load-config.md
59
-
60
- - type: shared
61
- source: sections/activation-preflight.md
62
- params:
63
- checks:
64
- - order: "1"
65
- field: "session.initialized_at"
66
- level: "WARN"
67
- message: 'Session not initialized. Run `/mvt-init` first.'
68
- - order: "2"
69
- field: "no implementation files"
70
- level: "WARN"
71
- message: 'No implementation found. Run `/mvt-implement` first.'
72
- - order: "3"
73
- field: "pattern.active"
74
- level: "WARN"
75
- message: 'Architecture pattern not set. Suggest `/mvt-init`." (allow user to proceed)'
76
-
77
- - type: inline
78
- content: |
79
- ### Step 4: Execute
80
- Proceed to Execution Flow below.
81
-
82
- ## Test Case Types
83
-
84
- | Type | Description | Priority |
85
- |------|-------------|----------|
86
- | Happy Path | Normal successful flow | High |
87
- | Edge Case | Boundary conditions | High |
88
- | Negative | Invalid inputs, errors | High |
89
- | Security | Authentication, injection | Medium |
90
- | Performance | Load, stress | Low |
91
-
92
- - type: file
93
- source: ./business.md
94
-
95
- - type: inline
96
- content: |
97
- ## Output Format
98
-
99
- Read and use the output template from: `.ai-agents/skills/_templates/test-output.md`
100
-
101
- If a custom version exists at `.ai-agents/skills/_templates/custom/test-output.md`, use the custom version instead.
102
-
103
- Fill the template placeholders with the test design results.
104
-
105
- Every response MUST end with a Suggested Next Steps section.
106
-
107
- - type: shared
108
- source: sections/footer-next-steps.md
109
- params:
110
- next_primary: mvt-fix
111
- next_primary_desc: "Run tests with the appropriate command; if tests fail, use this"
1
+ name: mvt-test
2
+ output: .claude/skills/mvt-test/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-test
6
+ description: "Generate and design tests to validate implementations. This skill should be used when user wants to write tests, validate code, generate test cases, or analyze test coverage."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Test
12
+
13
+ ## Purpose
14
+
15
+ Design and write tests to validate implementations against requirements and business rules. Ensure code works correctly with comprehensive coverage of happy paths, edge cases, and error scenarios.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Tester
21
+ role_desc: "a Quality Assurance Specialist"
22
+ decision_rules:
23
+ - rule: "Happy path works -> Add edge case and boundary tests"
24
+ - rule: "Bug found during testing -> Document with reproduction steps, suggest `/mvt-fix`"
25
+ - rule: "Coverage gap found -> Add tests focused on that area"
26
+ - rule: "Flaky test detected -> Flag for investigation"
27
+ - rule: "Test requires external service -> Use mocks/stubs, document the dependency"
28
+ - rule: "Security constraints in requirements -> Add security-focused test cases"
29
+ - rule: "Existing tests conflict with new implementation -> Flag the conflict"
30
+ boundaries:
31
+ - scope: "modify the code being tested"
32
+ skill: "/mvt-fix"
33
+ - scope: "make architecture decisions"
34
+ skill: "(Test against existing design)"
35
+ - scope: "skip edge cases or negative tests"
36
+ skill: "(Never)"
37
+
38
+ - type: inline
39
+ content: |
40
+ ## Variants
41
+
42
+ | Variant | Description |
43
+ |---------|-------------|
44
+ | `/mvt-test` | Generate tests for recent implementation |
45
+ | `/mvt-test {feature}` | Generate tests for specific feature |
46
+ | `/mvt-test --coverage` | Generate tests with coverage analysis |
47
+
48
+ - type: shared
49
+ source: sections/activation-load-context.md
50
+ params:
51
+ extended_context:
52
+ - "Implementation files to be tested"
53
+
54
+ - type: shared
55
+ source: sections/activation-load-config.md
56
+
57
+ - type: shared
58
+ source: sections/output-language-constraint.md
59
+
60
+ - type: shared
61
+ source: sections/activation-preflight.md
62
+ params:
63
+ checks:
64
+ - order: "1"
65
+ field: "session.initialized_at"
66
+ level: "WARN"
67
+ message: "Session not initialized. Run `/mvt-init` first."
68
+ - order: "2"
69
+ field: "no implementation files"
70
+ level: "WARN"
71
+ message: "No implementation found. Run `/mvt-implement` first."
72
+
73
+ - type: inline
74
+ content: |
75
+ ## Test Case Types
76
+
77
+ | Type | Description | Priority |
78
+ |------|-------------|----------|
79
+ | Happy Path | Normal successful flow | High |
80
+ | Edge Case | Boundary conditions | High |
81
+ | Negative | Invalid inputs, errors | High |
82
+ | Security | Authentication, injection | Medium |
83
+ | Performance | Load, stress | Low |
84
+
85
+ - type: file
86
+ source: ./business.md
87
+
88
+ - type: inline
89
+ content: |
90
+ ## Artifact Structure
91
+ Read the document structure template from: `.ai-agents/skills/_templates/test-output.md`
92
+ If a custom version exists at `.ai-agents/skills/_templates/custom/test-output.md`, use the custom version instead.
93
+ The template defines section headings only. Generate content for each section based on test design results.
94
+ Write the artifact to: `.ai-agents/workspace/artifacts/{change-id}/tests/test-design.md`
95
+
96
+ - type: shared
97
+ source: sections/session-update.md
98
+
99
+ - type: shared
100
+ source: sections/footer-next-steps.md
101
+ params:
102
+ current_skill: mvt-test