@pigcloud/skills 1.0.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 (161) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +201 -0
  3. package/README.en.md +84 -0
  4. package/README.md +79 -0
  5. package/bin/cli.js +663 -0
  6. package/bin/postinstall.js +60 -0
  7. package/bin/rules-loader.js +484 -0
  8. package/bin/runtime-bootstrap.js +121 -0
  9. package/index.js +7 -0
  10. package/install.cmd +5 -0
  11. package/install.ps1 +74 -0
  12. package/install.sh +168 -0
  13. package/package.json +70 -0
  14. package/pig-cloud-skills-commands/.codex-plugin/plugin.json +35 -0
  15. package/pig-cloud-skills-commands/README.md +24 -0
  16. package/pig-cloud-skills-commands/commands/analyze.md +21 -0
  17. package/pig-cloud-skills-commands/commands/build.md +21 -0
  18. package/pig-cloud-skills-commands/commands/design.md +21 -0
  19. package/pig-cloud-skills-commands/commands/distill.md +21 -0
  20. package/pig-cloud-skills-commands/commands/doc.md +21 -0
  21. package/pig-cloud-skills-commands/commands/infra.md +21 -0
  22. package/pig-cloud-skills-commands/commands/init.md +20 -0
  23. package/pig-cloud-skills-commands/commands/kb.md +20 -0
  24. package/pig-cloud-skills-commands/commands/perf.md +20 -0
  25. package/pig-cloud-skills-commands/commands/prd.md +21 -0
  26. package/pig-cloud-skills-commands/commands/review.md +21 -0
  27. package/pig-cloud-skills-commands/commands/security.md +21 -0
  28. package/pig-cloud-skills-commands/commands/test.md +21 -0
  29. package/pig-cloud-skills-commands/commands/workflow.md +20 -0
  30. package/rules/bundles.json +358 -0
  31. package/rules/coding/analysis.md +27 -0
  32. package/rules/coding/backend/cache-invalidation.md +30 -0
  33. package/rules/coding/backend/cache-keying.md +30 -0
  34. package/rules/coding/backend/cache.md +37 -0
  35. package/rules/coding/backend/database.md +32 -0
  36. package/rules/coding/backend/feign.md +30 -0
  37. package/rules/coding/backend/index.md +42 -0
  38. package/rules/coding/backend/query.md +32 -0
  39. package/rules/coding/backend/remote.md +33 -0
  40. package/rules/coding/backend/transaction-boundary.md +30 -0
  41. package/rules/coding/backend/transaction-rollback.md +30 -0
  42. package/rules/coding/backend/transaction.md +38 -0
  43. package/rules/coding/boundary.md +25 -0
  44. package/rules/coding/implementation.md +30 -0
  45. package/rules/coding/index.md +38 -0
  46. package/rules/coding/scaffold.md +28 -0
  47. package/rules/coding/testing.md +29 -0
  48. package/rules/coding/validation.md +29 -0
  49. package/rules/core/code-quality.md +30 -0
  50. package/rules/core/evidence.md +26 -0
  51. package/rules/core/index.md +41 -0
  52. package/rules/core/interface.md +26 -0
  53. package/rules/core/iteration.md +26 -0
  54. package/rules/core/layer-boundary.md +25 -0
  55. package/rules/core/logging.md +26 -0
  56. package/rules/core/security.md +26 -0
  57. package/rules/core/task-boundary.md +27 -0
  58. package/rules/docs/api.md +34 -0
  59. package/rules/docs/capture-summary.md +29 -0
  60. package/rules/docs/capture.md +34 -0
  61. package/rules/docs/contract.md +30 -0
  62. package/rules/docs/decision-log.md +32 -0
  63. package/rules/docs/examples.md +28 -0
  64. package/rules/docs/index.md +49 -0
  65. package/rules/docs/reference.md +32 -0
  66. package/rules/index.md +46 -0
  67. package/rules/overlays/index.md +28 -0
  68. package/rules/overlays/pig-cloud/controller.md +33 -0
  69. package/rules/overlays/pig-cloud/dto-vo.md +33 -0
  70. package/rules/overlays/pig-cloud/entity.md +32 -0
  71. package/rules/overlays/pig-cloud/exception.md +32 -0
  72. package/rules/overlays/pig-cloud/layering.md +31 -0
  73. package/rules/overlays/pig-cloud/mapper.md +32 -0
  74. package/rules/overlays/pig-cloud/query-style.md +32 -0
  75. package/rules/overlays/pig-cloud/rest-response.md +33 -0
  76. package/rules/overlays/pig-cloud/service.md +33 -0
  77. package/rules/overlays/pig-cloud/transactions.md +32 -0
  78. package/rules/overlays/pig-cloud/validation.md +33 -0
  79. package/rules/overlays/pig-cloud.md +45 -0
  80. package/rules/product/acceptance.md +25 -0
  81. package/rules/product/briefing.md +27 -0
  82. package/rules/product/index.md +36 -0
  83. package/rules/product/intake.md +27 -0
  84. package/rules/product/modeling.md +25 -0
  85. package/rules/product/project-context.md +29 -0
  86. package/rules/review/code.md +35 -0
  87. package/rules/review/evidence.md +31 -0
  88. package/rules/review/index.md +50 -0
  89. package/rules/review/java.md +42 -0
  90. package/rules/review/performance.md +38 -0
  91. package/rules/review/rubric.md +28 -0
  92. package/rules/review/security.md +38 -0
  93. package/rules/review/ts.md +33 -0
  94. package/rules/review/vue.md +33 -0
  95. package/rules/skill-profile-map.json +58 -0
  96. package/rules/skill-profile-map.md +28 -0
  97. package/rules/workflow/handoff.md +25 -0
  98. package/rules/workflow/index.md +37 -0
  99. package/rules/workflow/refinement.md +29 -0
  100. package/rules/workflow/router.md +25 -0
  101. package/rules/workflow/selection.md +25 -0
  102. package/rules/workflow/stop.md +25 -0
  103. package/scripts/ci-validator.sh +114 -0
  104. package/scripts/run-golden-replays.js +312 -0
  105. package/scripts/validate-rules.js +125 -0
  106. package/scripts/validate-skill-replay-signals.js +75 -0
  107. package/scripts/validate-skill-shapes.js +141 -0
  108. package/scripts/validate-skill-stop-rules.js +139 -0
  109. package/scripts/validate-skills.cmd +3 -0
  110. package/scripts/validate-skills.ps1 +42 -0
  111. package/scripts/validate-skills.sh +36 -0
  112. package/skills/api-docs/SKILL.md +76 -0
  113. package/skills/code-review/SKILL.md +135 -0
  114. package/skills/code-review/references/findings-template.md +51 -0
  115. package/skills/code-review/references/performance-checklist.md +213 -0
  116. package/skills/code-review/references/rubric.md +232 -0
  117. package/skills/code-review/references/rules.md +32 -0
  118. package/skills/code-review/references/security-checklist.md +178 -0
  119. package/skills/code-review/references/stack-notes.md +25 -0
  120. package/skills/code-review/references/template-review.md +214 -0
  121. package/skills/code-review/scripts/lint-code-review.mjs +431 -0
  122. package/skills/domain-modeling/SKILL.md +80 -0
  123. package/skills/domain-modeling/references/README.md +134 -0
  124. package/skills/domain-modeling/references/distillation-checklist.md +152 -0
  125. package/skills/domain-modeling/references/test-cases-template.md +128 -0
  126. package/skills/environment-deploy/SKILL.md +81 -0
  127. package/skills/feature-build/SKILL.md +122 -0
  128. package/skills/feature-build/references/coding-checklist.md +97 -0
  129. package/skills/feature-build/references/comment-specification.md +102 -0
  130. package/skills/knowledge-capture/SKILL.md +84 -0
  131. package/skills/performance-check/SKILL.md +117 -0
  132. package/skills/product-intake/SKILL.md +98 -0
  133. package/skills/project-bootstrap/SKILL.md +80 -0
  134. package/skills/references/agent-personas.md +34 -0
  135. package/skills/references/anti-rationalization.md +144 -0
  136. package/skills/references/engineering-delivery-method.md +63 -0
  137. package/skills/references/engineering-delivery-template.md +80 -0
  138. package/skills/references/flow-test-cases.md +62 -0
  139. package/skills/references/full-chain-replay-scenarios.md +79 -0
  140. package/skills/references/golden-prompt-suite.js +385 -0
  141. package/skills/references/golden-prompt-suite.md +33 -0
  142. package/skills/references/hooks.md +67 -0
  143. package/skills/references/negative-replay-scenarios.md +49 -0
  144. package/skills/references/project-requirement-alignment.md +41 -0
  145. package/skills/references/prompt-replay-checklist.md +128 -0
  146. package/skills/references/requirements-separation-map.md +71 -0
  147. package/skills/references/rule-loading-map.md +108 -0
  148. package/skills/references/skill-authoring-standard.md +73 -0
  149. package/skills/references/skill-boundary-template.md +38 -0
  150. package/skills/references/skill-enhanced-template.md +53 -0
  151. package/skills/references/skill-reference-matrix.md +53 -0
  152. package/skills/references/slash-commands.md +34 -0
  153. package/skills/security-review/SKILL.md +117 -0
  154. package/skills/spec-refinement/SKILL.md +143 -0
  155. package/skills/spec-refinement/references/ears-syntax.md +127 -0
  156. package/skills/spec-refinement/references/requirement-checklist.md +139 -0
  157. package/skills/spec-refinement/references/spec-workbook.md +75 -0
  158. package/skills/technical-design/SKILL.md +105 -0
  159. package/skills/technical-design/references/solid-checklist.md +199 -0
  160. package/skills/test-design/SKILL.md +91 -0
  161. package/skills/workflow-router/SKILL.md +86 -0
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const repoRoot = path.join(__dirname, '..');
7
+ const skillsRoot = path.join(repoRoot, 'skills');
8
+ const enhancedTemplateSkills = new Set([
9
+ 'spec-refinement',
10
+ 'technical-design',
11
+ 'feature-build',
12
+ 'code-review',
13
+ 'security-review',
14
+ 'performance-check',
15
+ ]);
16
+ const enhancedSections = [
17
+ '## Quick Start',
18
+ '## Inputs / Outputs',
19
+ '## Gotchas',
20
+ ];
21
+ const shortTemplateSections = [
22
+ '## Quick Start',
23
+ '## Inputs / Outputs',
24
+ '## Gotchas',
25
+ ];
26
+
27
+ function readSkillDirectories() {
28
+ return fs.readdirSync(skillsRoot, { withFileTypes: true })
29
+ .filter((entry) => entry.isDirectory() && entry.name !== 'references')
30
+ .map((entry) => entry.name)
31
+ .sort();
32
+ }
33
+
34
+ function readSkillFile(skillName) {
35
+ return fs.readFileSync(path.join(skillsRoot, skillName, 'SKILL.md'), 'utf8');
36
+ }
37
+
38
+ function extractFrontmatter(content) {
39
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
40
+ return match ? match[1] : '';
41
+ }
42
+
43
+ function extractHeadings(content) {
44
+ return content
45
+ .split(/\r?\n/)
46
+ .map((line) => line.trim())
47
+ .filter((line) => /^##\s+/.test(line))
48
+ .map((line) => line);
49
+ }
50
+
51
+ function assert(condition, message) {
52
+ if (!condition) {
53
+ throw new Error(message);
54
+ }
55
+ }
56
+
57
+ function ensureFrontmatterKeys(skillName, frontmatter) {
58
+ const requiredKeys = [
59
+ 'name:',
60
+ 'description:',
61
+ 'lifecycle_stage:',
62
+ 'dependencies:',
63
+ 'triggers:',
64
+ 'inputs:',
65
+ 'outputs:',
66
+ 'workflow:',
67
+ 'gates:',
68
+ 'refs:',
69
+ 'rule_profile:',
70
+ ];
71
+
72
+ for (const key of requiredKeys) {
73
+ assert(frontmatter.includes(key), `${skillName}: missing frontmatter key ${key}`);
74
+ }
75
+ }
76
+
77
+ function ensureSectionOrder(skillName, headings, requiredOrder) {
78
+ let lastIndex = -1;
79
+ for (const section of requiredOrder) {
80
+ const index = headings.indexOf(section);
81
+ assert(index >= 0, `${skillName}: missing section ${section}`);
82
+ assert(index > lastIndex, `${skillName}: section order is invalid around ${section}`);
83
+ lastIndex = index;
84
+ }
85
+ }
86
+
87
+ function validateSkill(skillName) {
88
+ const content = readSkillFile(skillName);
89
+ const frontmatter = extractFrontmatter(content);
90
+ assert(frontmatter, `${skillName}: missing frontmatter`);
91
+ ensureFrontmatterKeys(skillName, frontmatter);
92
+
93
+ const headings = extractHeadings(content);
94
+ const requiredOrder = enhancedTemplateSkills.has(skillName)
95
+ ? [
96
+ '## Purpose',
97
+ '## Suitable / Unsuitable',
98
+ '## Quick Start',
99
+ '## Inputs / Outputs',
100
+ '## Workflow',
101
+ '## Replay Signals',
102
+ '## Gotchas',
103
+ '## Stop Rules',
104
+ '## References',
105
+ ]
106
+ : [
107
+ '## Purpose',
108
+ '## Suitable / Unsuitable',
109
+ '## Workflow',
110
+ '## Replay Signals',
111
+ '## Stop Rules',
112
+ '## References',
113
+ ];
114
+
115
+ ensureSectionOrder(skillName, headings, requiredOrder);
116
+
117
+ if (enhancedTemplateSkills.has(skillName)) {
118
+ for (const section of enhancedSections) {
119
+ assert(headings.includes(section), `${skillName}: missing enhanced section ${section}`);
120
+ }
121
+ } else {
122
+ for (const section of shortTemplateSections) {
123
+ assert(!headings.includes(section), `${skillName}: short template should not include ${section}`);
124
+ }
125
+ }
126
+ }
127
+
128
+ function main() {
129
+ for (const skillName of readSkillDirectories()) {
130
+ validateSkill(skillName);
131
+ }
132
+
133
+ console.log('=== Skill shape validation complete ===');
134
+ }
135
+
136
+ try {
137
+ main();
138
+ } catch (error) {
139
+ console.error(error.message);
140
+ process.exitCode = 1;
141
+ }
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const repoRoot = path.join(__dirname, '..');
7
+ const skillsRoot = path.join(repoRoot, 'skills');
8
+
9
+ function readSkillDirectories() {
10
+ return fs.readdirSync(skillsRoot, { withFileTypes: true })
11
+ .filter((entry) => entry.isDirectory() && entry.name !== 'references')
12
+ .map((entry) => entry.name)
13
+ .sort();
14
+ }
15
+
16
+ function readSkillFile(skillName) {
17
+ const skillFile = path.join(skillsRoot, skillName, 'SKILL.md');
18
+ return fs.readFileSync(skillFile, 'utf8');
19
+ }
20
+
21
+ function extractFrontmatter(content) {
22
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
23
+ return match ? match[1] : '';
24
+ }
25
+
26
+ function extractSectionList(block, sectionName) {
27
+ const lines = block.split(/\r?\n/);
28
+ const items = [];
29
+ let inSection = false;
30
+
31
+ for (const rawLine of lines) {
32
+ const line = rawLine.trim();
33
+ if (!inSection) {
34
+ if (line === `${sectionName}:`) {
35
+ inSection = true;
36
+ }
37
+ continue;
38
+ }
39
+
40
+ if (!line.startsWith('- ')) {
41
+ if (line.length === 0) {
42
+ continue;
43
+ }
44
+ break;
45
+ }
46
+
47
+ items.push(line.slice(2).trim());
48
+ }
49
+
50
+ return items;
51
+ }
52
+
53
+ function extractStopRules(content) {
54
+ const lines = content.split(/\r?\n/);
55
+ const items = [];
56
+ let inSection = false;
57
+
58
+ for (const rawLine of lines) {
59
+ const line = rawLine.trim();
60
+ if (!inSection) {
61
+ if (line === '## Stop Rules') {
62
+ inSection = true;
63
+ }
64
+ continue;
65
+ }
66
+
67
+ if (line.startsWith('## ')) {
68
+ break;
69
+ }
70
+
71
+ if (line.startsWith('- ')) {
72
+ items.push(line.slice(2).trim());
73
+ }
74
+ }
75
+
76
+ return items;
77
+ }
78
+
79
+ function normalize(text) {
80
+ return String(text || '')
81
+ .toLowerCase()
82
+ .replace(/\s+/g, ' ')
83
+ .replace(/[^\p{L}\p{N}\s-]+/gu, '')
84
+ .trim();
85
+ }
86
+
87
+ function hasMatchingRule(gate, stopRules) {
88
+ const normalizedGate = normalize(gate);
89
+ return stopRules.some((rule) => {
90
+ const normalizedRule = normalize(rule);
91
+ return normalizedRule.includes(normalizedGate) || normalizedGate.includes(normalizedRule);
92
+ });
93
+ }
94
+
95
+ function validateSkill(skillName) {
96
+ const content = readSkillFile(skillName);
97
+ const frontmatter = extractFrontmatter(content);
98
+ if (!frontmatter) {
99
+ throw new Error(`${skillName}: missing frontmatter`);
100
+ }
101
+
102
+ const gates = extractSectionList(frontmatter, 'gates');
103
+ const stopRules = extractStopRules(content);
104
+
105
+ if (!gates.length) {
106
+ throw new Error(`${skillName}: missing gates`);
107
+ }
108
+
109
+ if (!stopRules.length) {
110
+ throw new Error(`${skillName}: missing Stop Rules section`);
111
+ }
112
+
113
+ const missing = gates.filter((gate) => !hasMatchingRule(gate, stopRules));
114
+ if (missing.length > 0) {
115
+ throw new Error(`${skillName}: stop rules do not cover gates: ${missing.join(' | ')}`);
116
+ }
117
+
118
+ return {
119
+ skillName,
120
+ gates,
121
+ stopRules,
122
+ };
123
+ }
124
+
125
+ function main() {
126
+ const skills = readSkillDirectories();
127
+ for (const skillName of skills) {
128
+ validateSkill(skillName);
129
+ }
130
+
131
+ console.log(`=== Stop rule validation complete for ${skills.length} skills ===`);
132
+ }
133
+
134
+ try {
135
+ main();
136
+ } catch (error) {
137
+ console.error(error.message);
138
+ process.exitCode = 1;
139
+ }
@@ -0,0 +1,3 @@
1
+ @echo off
2
+ setlocal
3
+ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%~dp0validate-skills.ps1" %*
@@ -0,0 +1,42 @@
1
+ param(
2
+ [string]$SkillsRoot
3
+ )
4
+
5
+ $ErrorActionPreference = 'Stop'
6
+ $repoRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path
7
+ $python = Join-Path $repoRoot '.tools\python.cmd'
8
+ if (-not $SkillsRoot) {
9
+ if (Test-Path -LiteralPath (Join-Path $repoRoot 'skills')) {
10
+ $SkillsRoot = Join-Path $repoRoot 'skills'
11
+ } else {
12
+ $SkillsRoot = Join-Path $repoRoot '.agents\skills'
13
+ }
14
+ }
15
+ $codexHome = $env:CODEX_HOME
16
+ if (-not $codexHome) {
17
+ $codexHome = Join-Path $HOME '.codex'
18
+ }
19
+ $validator = Join-Path (Join-Path $codexHome 'skills') '.system\skill-creator\scripts\quick_validate.py'
20
+
21
+ if (-not (Test-Path -LiteralPath $validator)) {
22
+ throw "Validator not found: $validator"
23
+ }
24
+
25
+ $skillsRoot = (Resolve-Path -LiteralPath $SkillsRoot).Path
26
+ $skillDirs = Get-ChildItem -LiteralPath $skillsRoot -Directory
27
+
28
+ Write-Host "=== Validating skills under $skillsRoot ==="
29
+ $env:PYTHONUTF8 = '1'
30
+
31
+ foreach ($skillDir in $skillDirs) {
32
+ $skillFile = Join-Path $skillDir.FullName 'SKILL.md'
33
+ if (-not (Test-Path -LiteralPath $skillFile)) {
34
+ Write-Host "SKIP $($skillDir.Name) (no SKILL.md)"
35
+ continue
36
+ }
37
+
38
+ Write-Host "VALIDATE $($skillDir.Name)"
39
+ & $python $validator $skillDir.FullName
40
+ }
41
+
42
+ Write-Host "=== Validation complete ==="
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
+ python_cmd="$repo_root/.tools/python.sh"
6
+ codex_home="${CODEX_HOME:-$HOME/.codex}"
7
+ validator="$codex_home/skills/.system/skill-creator/scripts/quick_validate.py"
8
+ if [ -n "${1:-}" ]; then
9
+ skills_root="$1"
10
+ elif [ -d "$repo_root/skills" ]; then
11
+ skills_root="$repo_root/skills"
12
+ else
13
+ skills_root="$repo_root/.agents/skills"
14
+ fi
15
+
16
+ if [ ! -f "$validator" ]; then
17
+ echo "Validator not found: $validator" >&2
18
+ exit 1
19
+ fi
20
+
21
+ export PYTHONUTF8=1
22
+
23
+ echo "=== Validating skills under $skills_root ==="
24
+
25
+ find "$skills_root" -mindepth 1 -maxdepth 1 -type d | sort | while IFS= read -r skill_dir; do
26
+ skill_file="$skill_dir/SKILL.md"
27
+ if [ ! -f "$skill_file" ]; then
28
+ echo "SKIP $(basename "$skill_dir") (no SKILL.md)"
29
+ continue
30
+ fi
31
+
32
+ echo "VALIDATE $(basename "$skill_dir")"
33
+ "$python_cmd" "$validator" "$skill_dir"
34
+ done
35
+
36
+ echo "=== Validation complete ==="
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: api-docs
3
+ description: Document stable API behavior, request and response contracts, and examples when endpoints need reusable reference docs
4
+ lifecycle_stage: capture
5
+ rule_profile: api
6
+ dependencies:
7
+ - spec-refinement
8
+ triggers:
9
+ - API docs
10
+ - contract
11
+ - endpoint
12
+ - request response
13
+ - OpenAPI
14
+ - API reference
15
+ inputs:
16
+ - interface behavior
17
+ - endpoint list
18
+ - request and response shapes
19
+ outputs:
20
+ - API document
21
+ - contract notes
22
+ - examples
23
+ workflow:
24
+ - extract endpoint behavior
25
+ - write request and response contracts
26
+ - include examples and constraints
27
+ - hand off an API document to knowledge-capture
28
+ gates:
29
+ - stop at documentation
30
+ - do not change implementation
31
+ - do not rewrite product scope
32
+ refs:
33
+ - skills/references/rule-loading-map.md
34
+ - skills/references/prompt-replay-checklist.md
35
+ - skills/references/full-chain-replay-scenarios.md
36
+ - rules/index.md
37
+ ---
38
+
39
+ # API Docs
40
+
41
+ ## Purpose
42
+
43
+ Write clear API documentation and contracts for already defined behavior.
44
+
45
+ ## Suitable / Unsuitable
46
+
47
+ - Suitable: endpoint docs, request/response contracts, examples, API notes
48
+ - Unsuitable: implementation changes, product scope changes, rewrite of behavior
49
+
50
+ ## Workflow
51
+
52
+ 1. Extract endpoint behavior.
53
+ 2. Write request and response contracts.
54
+ 3. Include examples and constraints.
55
+ 4. Hand off an API document to `knowledge-capture`.
56
+
57
+ ## Replay Signals
58
+
59
+ - Input signal: interface behavior, endpoint list, request and response shapes.
60
+ - Output to verify: API document, contract notes, examples.
61
+ - Stop signal: implementation changes or product scope changes.
62
+ - Handoff signal: an API document is ready for `knowledge-capture`.
63
+
64
+ ## Stop Rules
65
+
66
+ - Stop at documentation.
67
+ - Do not change implementation.
68
+ - Do not rewrite product scope.
69
+ - Do not turn the task into implementation notes.
70
+
71
+ ## References
72
+
73
+ - `skills/references/rule-loading-map.md`
74
+ - `skills/references/prompt-replay-checklist.md`
75
+ - `skills/references/full-chain-replay-scenarios.md`
76
+ - `rules/index.md`
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: code-review
3
+ description: Review a diff or pull request for correctness, maintainability, and regression risk when a generic code review is needed
4
+ lifecycle_stage: review
5
+ rule_profile: code
6
+ dependencies:
7
+ - feature-build
8
+ triggers:
9
+ - diff
10
+ - pull request
11
+ - review
12
+ - quality gate
13
+ - checklist
14
+ - code review
15
+ inputs:
16
+ - diff
17
+ - pull request
18
+ - changed files
19
+ outputs:
20
+ - findings
21
+ - severity
22
+ - fix recommendation
23
+ - evidence summary
24
+ - review summary
25
+ workflow:
26
+ - lock the review scope
27
+ - identify the tech stack and load the matching review overlay(s)
28
+ - inspect correctness, maintainability, and regression risk
29
+ - route security-specific issues to `security-review`
30
+ - route performance-specific issues to `performance-check`
31
+ - rank findings by severity
32
+ - produce an actionable review report
33
+ gates:
34
+ - stop at review findings
35
+ - do not rewrite code
36
+ - do not perform implementation refactors
37
+ - do not become a general design discussion
38
+ refs:
39
+ - skills/references/rule-loading-map.md
40
+ - skills/references/flow-test-cases.md
41
+ - skills/references/full-chain-replay-scenarios.md
42
+ - skills/references/prompt-replay-checklist.md
43
+ - skills/code-review/references/rules.md
44
+ - skills/code-review/references/findings-template.md
45
+ - skills/code-review/references/stack-notes.md
46
+ - rules/index.md
47
+ ---
48
+
49
+ # Code Review
50
+
51
+ ## Purpose
52
+
53
+ Review a change set and return actionable findings.
54
+
55
+ ## Suitable / Unsuitable
56
+
57
+ - Suitable: PR review, diff review, quality gate, regression check, generic code quality review across Java, Vue, and mixed-stack changes
58
+ - Unsuitable: implementation work, refactoring, broad design discussion, security-specific review, performance-specific review, requirement rewriting
59
+
60
+ ## Quick Start
61
+
62
+ - Lock the review scope before reading details.
63
+ - Identify the stack(s) first. This repository may apply Java, Vue, or mixed-stack review overlays.
64
+ - Read the diff with the current rules bundle in mind.
65
+ - Report findings with severity and a concrete fix path.
66
+ - If the issue is clearly about auth, secrets, or exposure, hand off to `security-review`.
67
+ - If the issue is clearly about latency, throughput, or resource usage, hand off to `performance-check`.
68
+ - Keep stack-specific concerns in the matching overlay and keep the core review generic.
69
+
70
+ ## Report Format
71
+
72
+ - Use one entry per finding.
73
+ - Include `location`, `severity`, `evidence`, `why it matters`, and `fix recommendation`.
74
+ - When a stack overlay applies, anchor the finding to the smallest stack-specific surface:
75
+ - Java: controller, service, entity, mapper, DTO / VO, or MyBatis XML symbol
76
+ - Vue: component, composable, state module, template, or frontend build file
77
+ - TypeScript: typed utility, module boundary, state module, or TS config symbol
78
+ - Keep the review summary short when the change is acceptable.
79
+ - If there are no findings, explain why the change is acceptable and what was checked.
80
+ - Separate must-fix findings from optional suggestions.
81
+
82
+ ## Inputs / Outputs
83
+
84
+ - Inputs:
85
+ - diff
86
+ - pull request
87
+ - changed files
88
+ - Outputs:
89
+ - findings
90
+ - severity
91
+ - fix recommendation
92
+ - evidence summary
93
+
94
+ ## Workflow
95
+
96
+ 1. Lock the review scope.
97
+ 2. Identify the stack overlays and load the matching review baseline(s) when applicable.
98
+ 3. Inspect correctness, maintainability, and regression risk.
99
+ 4. Route security-specific issues to `security-review`.
100
+ 5. Route performance-specific issues to `performance-check`.
101
+ 6. Rank findings by severity.
102
+ 7. Produce an actionable review report.
103
+
104
+ ## Replay Signals
105
+
106
+ - Input signal: diff, PR, changed files, or quality gate request.
107
+ - Output to verify: findings, severity, fix recommendation, evidence summary, review summary.
108
+ - Stop signal: rewriting code, implementation refactors, or broad design discussion.
109
+ - Handoff signal: findings are ready for `knowledge-capture`.
110
+
111
+ ## Gotchas
112
+
113
+ - Do not turn review into implementation work.
114
+ - Do not broaden the scope beyond the submitted change.
115
+ - Do not produce findings without concrete evidence.
116
+ - Do not hide severity or fix recommendation.
117
+ - Do not keep security or performance findings inside generic code review when a specialized review skill fits better.
118
+ - Do not turn stack-specific rules into a generic design discussion.
119
+
120
+ ## Stop Rules
121
+
122
+ - Stop at review findings.
123
+ - Do not rewrite code.
124
+ - Do not perform implementation refactors.
125
+ - Do not become a general design discussion.
126
+ - Do not turn review into a design task.
127
+
128
+ ## References
129
+
130
+ - `skills/references/rule-loading-map.md`
131
+ - `skills/references/flow-test-cases.md`
132
+ - `rules/review/index.md`
133
+ - `rules/review/code.md`
134
+ - `rules/review/java.md`
135
+ - `rules/review/vue.md`
@@ -0,0 +1,51 @@
1
+ # Code Review Findings Template
2
+
3
+ ## Shared Shape
4
+
5
+ Use the same top-level fields for every finding:
6
+
7
+ - `location`
8
+ - `severity`
9
+ - `evidence`
10
+ - `why it matters`
11
+ - `fix recommendation`
12
+
13
+ ## Rules
14
+
15
+ - One finding should describe one issue.
16
+ - Keep the location as small as possible.
17
+ - Make the evidence concrete enough to verify.
18
+ - Keep the fix recommendation specific enough to act on.
19
+ - If there are no findings, explain what was checked and why the change is acceptable.
20
+
21
+ ## Section Hints
22
+
23
+ ### Java
24
+
25
+ - Prefer controller, service, entity, mapper, DTO / VO, or MyBatis XML anchors.
26
+ - Name the violated framework contract.
27
+ - If the issue spans layers, name the first layer where the fix should land.
28
+
29
+ ### Vue
30
+
31
+ - Prefer component, composable, state module, template, or build-file anchors.
32
+ - State whether the issue is rendering, state flow, reactivity, or build configuration.
33
+ - If the issue crosses files, name the owning frontend surface.
34
+
35
+ ### TypeScript
36
+
37
+ - Prefer typed utility, module boundary, state module, or TS config anchors.
38
+ - State whether the issue is type safety, module shape, async control flow, or shared utility determinism.
39
+ - If the issue is config-related, name the entrypoint or build target that drifts.
40
+
41
+ ### Security
42
+
43
+ - Prefer endpoint, auth flow, permission boundary, secret path, or exposure path anchors.
44
+ - Call out the violated trust boundary.
45
+ - State the attack path and impacted asset.
46
+
47
+ ### Performance
48
+
49
+ - Prefer query, cache path, allocation path, concurrency path, or hot loop anchors.
50
+ - State whether the pressure is CPU, memory, network, database, or allocation-related.
51
+ - Name the slower path and the observable impact.