@pigcloud/skills 1.0.10 → 1.1.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.
- package/CHANGELOG.md +25 -20
- package/README.en.md +41 -75
- package/README.md +26 -39
- package/bin/cli.js +282 -188
- package/bin/rules-loader.js +271 -484
- package/codex-commands/README.md +25 -23
- package/codex-commands/commands/analyze.md +21 -22
- package/codex-commands/commands/build.md +22 -22
- package/codex-commands/commands/design.md +21 -22
- package/codex-commands/commands/distill.md +21 -21
- package/codex-commands/commands/doc.md +21 -22
- package/codex-commands/commands/infra.md +21 -21
- package/codex-commands/commands/init.md +20 -20
- package/codex-commands/commands/kb.md +21 -20
- package/codex-commands/commands/perf.md +21 -21
- package/codex-commands/commands/prd.md +21 -22
- package/codex-commands/commands/review.md +21 -22
- package/codex-commands/commands/security.md +21 -22
- package/codex-commands/commands/test.md +21 -21
- package/codex-commands/commands/workflow.md +21 -20
- package/package.json +5 -2
- package/rules/core/index.md +26 -41
- package/rules/delivery/index.md +25 -0
- package/rules/design/index.md +25 -0
- package/rules/discovery/index.md +25 -0
- package/rules/implementation/index.md +25 -0
- package/rules/index.md +24 -39
- package/rules/overlays/index.md +19 -19
- package/rules/overlays/pig-cloud.md +20 -45
- package/rules/shared/index.md +25 -0
- package/rules/skill-stage-map.json +26 -0
- package/rules/stages.json +48 -0
- package/rules/validation/index.md +25 -0
- package/scripts/add-skill-reference-nav.js +3 -0
- package/scripts/bootstrap-skill-specs.js +96 -0
- package/scripts/ci-validator.sh +51 -114
- package/scripts/generate-skill-prompt-library.js +3 -0
- package/scripts/golden-prompt-suite.current.js +211 -0
- package/scripts/migrate-skill-packages.js +309 -0
- package/scripts/run-golden-replays.js +110 -79
- package/scripts/validate-rules.js +128 -125
- package/scripts/validate-skill-replay-signals.js +45 -57
- package/scripts/validate-skill-shapes.js +153 -127
- package/scripts/validate-skill-stop-rules.js +54 -46
- package/skills/01-discovery/ambiguity-detection/SKILL.md +30 -0
- package/skills/01-discovery/ambiguity-detection/assets/golden-prompt-suite.current.js +22 -0
- package/skills/01-discovery/ambiguity-detection/references/README.md +17 -0
- package/skills/01-discovery/ambiguity-detection/references/cases.md +26 -0
- package/skills/01-discovery/ambiguity-detection/references/prompt-template.md +18 -0
- package/skills/01-discovery/ambiguity-detection/skill-spec.json +26 -0
- package/skills/01-discovery/business-analysis/SKILL.md +30 -0
- package/skills/01-discovery/business-analysis/assets/golden-prompt-suite.current.js +22 -0
- package/skills/01-discovery/business-analysis/references/README.md +17 -0
- package/skills/01-discovery/business-analysis/references/cases.md +26 -0
- package/skills/01-discovery/business-analysis/references/prompt-template.md +18 -0
- package/skills/01-discovery/business-analysis/skill-spec.json +26 -0
- package/skills/01-discovery/impact-analysis/SKILL.md +30 -0
- package/skills/01-discovery/impact-analysis/assets/golden-prompt-suite.current.js +22 -0
- package/skills/01-discovery/impact-analysis/references/README.md +17 -0
- package/skills/01-discovery/impact-analysis/references/cases.md +26 -0
- package/skills/01-discovery/impact-analysis/references/prompt-template.md +18 -0
- package/skills/01-discovery/impact-analysis/skill-spec.json +26 -0
- package/skills/01-discovery/requirement-discovery/SKILL.md +30 -0
- package/skills/01-discovery/requirement-discovery/assets/golden-prompt-suite.current.js +24 -0
- package/skills/01-discovery/requirement-discovery/references/README.md +17 -0
- package/skills/01-discovery/requirement-discovery/references/cases.md +28 -0
- package/skills/01-discovery/requirement-discovery/references/prompt-template.md +18 -0
- package/skills/01-discovery/requirement-discovery/skill-spec.json +26 -0
- package/skills/02-design/api-design/SKILL.md +29 -0
- package/skills/02-design/api-design/assets/golden-prompt-suite.current.js +22 -0
- package/skills/02-design/api-design/references/README.md +17 -0
- package/skills/02-design/api-design/references/cases.md +26 -0
- package/skills/02-design/api-design/references/prompt-template.md +18 -0
- package/skills/02-design/api-design/skill-spec.json +25 -0
- package/skills/02-design/architecture-design/SKILL.md +29 -0
- package/skills/02-design/architecture-design/assets/golden-prompt-suite.current.js +22 -0
- package/skills/02-design/architecture-design/references/README.md +17 -0
- package/skills/02-design/architecture-design/references/cases.md +26 -0
- package/skills/02-design/architecture-design/references/prompt-template.md +18 -0
- package/skills/02-design/architecture-design/skill-spec.json +25 -0
- package/skills/02-design/database-design/SKILL.md +29 -0
- package/skills/02-design/database-design/assets/golden-prompt-suite.current.js +22 -0
- package/skills/02-design/database-design/references/README.md +17 -0
- package/skills/02-design/database-design/references/cases.md +26 -0
- package/skills/02-design/database-design/references/prompt-template.md +18 -0
- package/skills/02-design/database-design/skill-spec.json +25 -0
- package/skills/02-design/task-breakdown/SKILL.md +29 -0
- package/skills/02-design/task-breakdown/assets/golden-prompt-suite.current.js +22 -0
- package/skills/02-design/task-breakdown/references/README.md +17 -0
- package/skills/02-design/task-breakdown/references/cases.md +26 -0
- package/skills/02-design/task-breakdown/references/prompt-template.md +18 -0
- package/skills/02-design/task-breakdown/skill-spec.json +25 -0
- package/skills/03-implementation/backend-development/SKILL.md +29 -0
- package/skills/03-implementation/backend-development/assets/golden-prompt-suite.current.js +22 -0
- package/skills/03-implementation/backend-development/references/README.md +17 -0
- package/skills/03-implementation/backend-development/references/cases.md +26 -0
- package/skills/03-implementation/backend-development/references/prompt-template.md +18 -0
- package/skills/03-implementation/backend-development/skill-spec.json +25 -0
- package/skills/03-implementation/bug-fix/SKILL.md +29 -0
- package/skills/03-implementation/bug-fix/assets/golden-prompt-suite.current.js +22 -0
- package/skills/03-implementation/bug-fix/references/README.md +17 -0
- package/skills/03-implementation/bug-fix/references/cases.md +26 -0
- package/skills/03-implementation/bug-fix/references/prompt-template.md +18 -0
- package/skills/03-implementation/bug-fix/skill-spec.json +25 -0
- package/skills/03-implementation/database-change/SKILL.md +29 -0
- package/skills/03-implementation/database-change/assets/golden-prompt-suite.current.js +22 -0
- package/skills/03-implementation/database-change/references/README.md +17 -0
- package/skills/03-implementation/database-change/references/cases.md +26 -0
- package/skills/03-implementation/database-change/references/prompt-template.md +18 -0
- package/skills/03-implementation/database-change/skill-spec.json +25 -0
- package/skills/03-implementation/frontend-development/SKILL.md +29 -0
- package/skills/03-implementation/frontend-development/assets/golden-prompt-suite.current.js +22 -0
- package/skills/03-implementation/frontend-development/references/README.md +17 -0
- package/skills/03-implementation/frontend-development/references/cases.md +26 -0
- package/skills/03-implementation/frontend-development/references/prompt-template.md +18 -0
- package/skills/03-implementation/frontend-development/skill-spec.json +25 -0
- package/skills/04-validation/code-review/SKILL.md +29 -0
- package/skills/04-validation/code-review/assets/golden-prompt-suite.current.js +22 -0
- package/skills/04-validation/code-review/references/README.md +17 -0
- package/skills/04-validation/code-review/references/cases.md +26 -0
- package/skills/04-validation/code-review/references/prompt-template.md +18 -0
- package/skills/04-validation/code-review/skill-spec.json +25 -0
- package/skills/04-validation/performance-review/SKILL.md +29 -0
- package/skills/04-validation/performance-review/assets/golden-prompt-suite.current.js +22 -0
- package/skills/04-validation/performance-review/references/README.md +17 -0
- package/skills/04-validation/performance-review/references/cases.md +26 -0
- package/skills/04-validation/performance-review/references/prompt-template.md +18 -0
- package/skills/04-validation/performance-review/skill-spec.json +25 -0
- package/skills/04-validation/regression-check/SKILL.md +29 -0
- package/skills/04-validation/regression-check/assets/golden-prompt-suite.current.js +22 -0
- package/skills/04-validation/regression-check/references/README.md +17 -0
- package/skills/04-validation/regression-check/references/cases.md +26 -0
- package/skills/04-validation/regression-check/references/prompt-template.md +18 -0
- package/skills/04-validation/regression-check/skill-spec.json +25 -0
- package/skills/04-validation/security-review/SKILL.md +29 -0
- package/skills/04-validation/security-review/assets/golden-prompt-suite.current.js +22 -0
- package/skills/04-validation/security-review/references/README.md +17 -0
- package/skills/04-validation/security-review/references/cases.md +26 -0
- package/skills/04-validation/security-review/references/prompt-template.md +18 -0
- package/skills/04-validation/security-review/skill-spec.json +25 -0
- package/skills/04-validation/unit-test/SKILL.md +29 -0
- package/skills/04-validation/unit-test/assets/golden-prompt-suite.current.js +22 -0
- package/skills/04-validation/unit-test/references/README.md +17 -0
- package/skills/04-validation/unit-test/references/cases.md +26 -0
- package/skills/04-validation/unit-test/references/prompt-template.md +18 -0
- package/skills/04-validation/unit-test/skill-spec.json +25 -0
- package/skills/05-delivery/change-log/SKILL.md +29 -0
- package/skills/05-delivery/change-log/assets/golden-prompt-suite.current.js +22 -0
- package/skills/05-delivery/change-log/references/README.md +17 -0
- package/skills/05-delivery/change-log/references/cases.md +26 -0
- package/skills/05-delivery/change-log/references/prompt-template.md +18 -0
- package/skills/05-delivery/change-log/skill-spec.json +25 -0
- package/skills/05-delivery/deployment-guide/SKILL.md +29 -0
- package/skills/05-delivery/deployment-guide/assets/golden-prompt-suite.current.js +22 -0
- package/skills/05-delivery/deployment-guide/references/README.md +17 -0
- package/skills/05-delivery/deployment-guide/references/cases.md +26 -0
- package/skills/05-delivery/deployment-guide/references/prompt-template.md +18 -0
- package/skills/05-delivery/deployment-guide/skill-spec.json +25 -0
- package/skills/05-delivery/release-check/SKILL.md +29 -0
- package/skills/05-delivery/release-check/assets/golden-prompt-suite.current.js +22 -0
- package/skills/05-delivery/release-check/references/README.md +17 -0
- package/skills/05-delivery/release-check/references/cases.md +26 -0
- package/skills/05-delivery/release-check/references/prompt-template.md +18 -0
- package/skills/05-delivery/release-check/skill-spec.json +25 -0
- package/skills/05-delivery/release-validation/SKILL.md +29 -0
- package/skills/05-delivery/release-validation/assets/golden-prompt-suite.current.js +22 -0
- package/skills/05-delivery/release-validation/references/README.md +17 -0
- package/skills/05-delivery/release-validation/references/cases.md +26 -0
- package/skills/05-delivery/release-validation/references/prompt-template.md +18 -0
- package/skills/05-delivery/release-validation/skill-spec.json +25 -0
- package/skills/shared/codebase-learning/SKILL.md +29 -0
- package/skills/shared/codebase-learning/assets/golden-prompt-suite.current.js +22 -0
- package/skills/shared/codebase-learning/references/README.md +17 -0
- package/skills/shared/codebase-learning/references/cases.md +26 -0
- package/skills/shared/codebase-learning/references/prompt-template.md +18 -0
- package/skills/shared/codebase-learning/skill-spec.json +25 -0
- package/skills/shared/evidence-collector/SKILL.md +29 -0
- package/skills/shared/evidence-collector/assets/golden-prompt-suite.current.js +22 -0
- package/skills/shared/evidence-collector/references/README.md +17 -0
- package/skills/shared/evidence-collector/references/cases.md +26 -0
- package/skills/shared/evidence-collector/references/prompt-template.md +18 -0
- package/skills/shared/evidence-collector/skill-spec.json +25 -0
- package/skills/shared/framework-guide/SKILL.md +28 -0
- package/skills/shared/framework-guide/assets/golden-prompt-suite.current.js +22 -0
- package/skills/shared/framework-guide/references/README.md +17 -0
- package/skills/shared/framework-guide/references/cases.md +26 -0
- package/skills/shared/framework-guide/references/prompt-template.md +18 -0
- package/skills/shared/framework-guide/skill-spec.json +24 -0
- package/rules/bundles.json +0 -358
- package/rules/coding/analysis.md +0 -27
- package/rules/coding/backend/cache-invalidation.md +0 -30
- package/rules/coding/backend/cache-keying.md +0 -30
- package/rules/coding/backend/cache.md +0 -37
- package/rules/coding/backend/database.md +0 -32
- package/rules/coding/backend/feign.md +0 -30
- package/rules/coding/backend/index.md +0 -42
- package/rules/coding/backend/query.md +0 -32
- package/rules/coding/backend/remote.md +0 -33
- package/rules/coding/backend/transaction-boundary.md +0 -30
- package/rules/coding/backend/transaction-rollback.md +0 -30
- package/rules/coding/backend/transaction.md +0 -38
- package/rules/coding/boundary.md +0 -25
- package/rules/coding/implementation.md +0 -26
- package/rules/coding/index.md +0 -38
- package/rules/coding/scaffold.md +0 -28
- package/rules/coding/testing.md +0 -29
- package/rules/coding/validation.md +0 -29
- package/rules/core/code-quality.md +0 -30
- package/rules/core/evidence.md +0 -26
- package/rules/core/interface.md +0 -26
- package/rules/core/iteration.md +0 -26
- package/rules/core/layer-boundary.md +0 -25
- package/rules/core/logging.md +0 -26
- package/rules/core/security.md +0 -26
- package/rules/core/task-boundary.md +0 -27
- package/rules/docs/api.md +0 -34
- package/rules/docs/capture-summary.md +0 -29
- package/rules/docs/capture.md +0 -34
- package/rules/docs/contract.md +0 -30
- package/rules/docs/decision-log.md +0 -32
- package/rules/docs/examples.md +0 -28
- package/rules/docs/index.md +0 -49
- package/rules/docs/reference.md +0 -32
- package/rules/overlays/pig-cloud/controller.md +0 -33
- package/rules/overlays/pig-cloud/dto-vo.md +0 -33
- package/rules/overlays/pig-cloud/entity.md +0 -32
- package/rules/overlays/pig-cloud/exception.md +0 -32
- package/rules/overlays/pig-cloud/layering.md +0 -31
- package/rules/overlays/pig-cloud/mapper.md +0 -32
- package/rules/overlays/pig-cloud/query-style.md +0 -32
- package/rules/overlays/pig-cloud/rest-response.md +0 -33
- package/rules/overlays/pig-cloud/service.md +0 -33
- package/rules/overlays/pig-cloud/transactions.md +0 -32
- package/rules/overlays/pig-cloud/validation.md +0 -33
- package/rules/product/acceptance.md +0 -25
- package/rules/product/briefing.md +0 -27
- package/rules/product/index.md +0 -36
- package/rules/product/intake.md +0 -27
- package/rules/product/modeling.md +0 -25
- package/rules/product/project-context.md +0 -29
- package/rules/review/code.md +0 -35
- package/rules/review/evidence.md +0 -31
- package/rules/review/index.md +0 -50
- package/rules/review/java.md +0 -42
- package/rules/review/performance.md +0 -38
- package/rules/review/rubric.md +0 -28
- package/rules/review/security.md +0 -38
- package/rules/review/ts.md +0 -33
- package/rules/review/vue.md +0 -33
- package/rules/skill-profile-map.json +0 -59
- package/rules/skill-profile-map.md +0 -29
- package/rules/workflow/handoff.md +0 -25
- package/rules/workflow/index.md +0 -37
- package/rules/workflow/refinement.md +0 -29
- package/rules/workflow/router.md +0 -25
- package/rules/workflow/selection.md +0 -25
- package/rules/workflow/stop.md +0 -25
- package/skills/api-contract-docs/SKILL.md +0 -77
- package/skills/business-fact-extraction/SKILL.md +0 -337
- package/skills/business-fact-extraction/scripts/write-knowledge-base.js +0 -228
- package/skills/code-review/SKILL.md +0 -136
- package/skills/code-review/references/findings-template.md +0 -51
- package/skills/code-review/references/performance-checklist.md +0 -213
- package/skills/code-review/references/rubric.md +0 -232
- package/skills/code-review/references/rules.md +0 -32
- package/skills/code-review/references/security-checklist.md +0 -178
- package/skills/code-review/references/stack-notes.md +0 -25
- package/skills/code-review/references/template-review.md +0 -39
- package/skills/code-review/scripts/lint-code-review.mjs +0 -431
- package/skills/domain-modeling/SKILL.md +0 -81
- package/skills/domain-modeling/references/README.md +0 -134
- package/skills/domain-modeling/references/distillation-checklist.md +0 -44
- package/skills/domain-modeling/references/test-cases-template.md +0 -128
- package/skills/environment-deploy/SKILL.md +0 -81
- package/skills/feature-build/SKILL.md +0 -122
- package/skills/feature-build/references/coding-checklist.md +0 -97
- package/skills/feature-build/references/comment-specification.md +0 -89
- package/skills/knowledge-capture/SKILL.md +0 -93
- package/skills/performance-audit/SKILL.md +0 -118
- package/skills/project-bootstrap/SKILL.md +0 -81
- package/skills/references/anti-rationalization.md +0 -144
- package/skills/references/business-fact-extraction.md +0 -415
- package/skills/references/engineering-delivery-method.md +0 -64
- package/skills/references/engineering-delivery-template.md +0 -81
- package/skills/references/golden-prompt-suite.js +0 -436
- package/skills/references/golden-prompt-suite.md +0 -33
- package/skills/references/project-requirement-alignment.md +0 -42
- package/skills/references/rule-loading-map.md +0 -117
- package/skills/references/skill-authoring-standard.md +0 -74
- package/skills/references/skill-boundary-template.md +0 -71
- package/skills/references/skill-enhanced-template.md +0 -103
- package/skills/references/skill-reference-matrix.md +0 -62
- package/skills/security-audit/SKILL.md +0 -119
- package/skills/spec-refinement/SKILL.md +0 -149
- package/skills/technical-design/SKILL.md +0 -106
- package/skills/technical-design/references/solid-checklist.md +0 -199
- package/skills/test-design/SKILL.md +0 -92
- package/skills/workflow-router/SKILL.md +0 -86
|
@@ -3,133 +3,159 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
|
|
6
|
-
const repoRoot = path.join(__dirname, '..');
|
|
7
|
-
const skillsRoot = path.join(repoRoot, 'skills');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
'
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
'
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
6
|
+
const repoRoot = path.join(__dirname, '..');
|
|
7
|
+
const skillsRoot = path.join(repoRoot, 'skills');
|
|
8
|
+
|
|
9
|
+
function readSkillDirectories() {
|
|
10
|
+
const results = [];
|
|
11
|
+
|
|
12
|
+
function walk(dir) {
|
|
13
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
14
|
+
if (entry.name === 'references') {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const fullPath = path.join(dir, entry.name);
|
|
19
|
+
if (entry.isDirectory()) {
|
|
20
|
+
const skillFile = path.join(fullPath, 'SKILL.md');
|
|
21
|
+
if (fs.existsSync(skillFile)) {
|
|
22
|
+
results.push(fullPath);
|
|
23
|
+
}
|
|
24
|
+
walk(fullPath);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
walk(skillsRoot);
|
|
30
|
+
return results.sort();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function readSkillFile(skillDir) {
|
|
34
|
+
return fs.readFileSync(path.join(skillDir, 'SKILL.md'), 'utf8');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function extractFrontmatter(content) {
|
|
38
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
39
|
+
return match ? match[1] : '';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function extractHeadings(content) {
|
|
43
|
+
return content
|
|
44
|
+
.split(/\r?\n/)
|
|
45
|
+
.map((line) => line.trim())
|
|
46
|
+
.filter((line) => /^##\s+/.test(line));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function extractSectionItems(content, sectionName) {
|
|
50
|
+
const lines = content.split(/\r?\n/);
|
|
51
|
+
const items = [];
|
|
52
|
+
let inSection = false;
|
|
53
|
+
|
|
54
|
+
for (const rawLine of lines) {
|
|
55
|
+
const line = rawLine.trim();
|
|
56
|
+
if (!inSection) {
|
|
57
|
+
if (line === `## ${sectionName}`) {
|
|
58
|
+
inSection = true;
|
|
59
|
+
}
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (line.startsWith('## ')) {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (line.startsWith('- ')) {
|
|
68
|
+
items.push(line.slice(2).trim());
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return items;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function assert(condition, message) {
|
|
76
|
+
if (!condition) {
|
|
77
|
+
throw new Error(message);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function parseFrontmatter(frontmatter) {
|
|
82
|
+
const entries = [];
|
|
83
|
+
for (const line of frontmatter.split(/\r?\n/)) {
|
|
84
|
+
const trimmed = line.trim();
|
|
85
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const match = trimmed.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
|
|
90
|
+
if (match) {
|
|
91
|
+
entries.push({ key: match[1], value: match[2] });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return entries;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function extractBody(content) {
|
|
99
|
+
const match = content.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?([\s\S]*)$/);
|
|
100
|
+
return match ? match[1] : '';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function validateSkill(skillDir) {
|
|
104
|
+
const skillName = path.basename(skillDir);
|
|
105
|
+
const specPath = path.join(skillDir, 'skill-spec.json');
|
|
106
|
+
const content = readSkillFile(skillDir);
|
|
107
|
+
assert(fs.existsSync(specPath), `${skillName}: missing skill-spec.json`);
|
|
108
|
+
const spec = JSON.parse(fs.readFileSync(specPath, 'utf8'));
|
|
109
|
+
const frontmatter = extractFrontmatter(content);
|
|
110
|
+
assert(frontmatter, `${skillName}: missing frontmatter`);
|
|
111
|
+
const entries = parseFrontmatter(frontmatter);
|
|
112
|
+
const keys = entries.map((entry) => entry.key);
|
|
113
|
+
assert(keys.includes('name'), `${skillName}: missing frontmatter key name`);
|
|
114
|
+
assert(keys.includes('description'), `${skillName}: missing frontmatter key description`);
|
|
115
|
+
|
|
116
|
+
const allowedKeys = new Set(['name', 'description']);
|
|
117
|
+
const extraKeys = entries.filter((entry) => !allowedKeys.has(entry.key));
|
|
118
|
+
assert(extraKeys.length === 0, `${skillName}: unexpected frontmatter keys: ${extraKeys.map((entry) => entry.key).join(', ')}`);
|
|
119
|
+
|
|
120
|
+
const body = extractBody(content).trim();
|
|
121
|
+
assert(body.length > 0, `${skillName}: skill body is missing`);
|
|
122
|
+
assert(spec.name === skillName, `${skillName}: skill-spec.json name mismatch`);
|
|
123
|
+
assert(spec.description === entries.find((entry) => entry.key === 'description')?.value, `${skillName}: skill-spec.json description mismatch`);
|
|
124
|
+
assert(Array.isArray(spec.whenToUse) && spec.whenToUse.length >= 2, `${skillName}: skill-spec.json whenToUse too short`);
|
|
125
|
+
assert(Array.isArray(spec.how) && spec.how.length >= 3, `${skillName}: skill-spec.json how too short`);
|
|
126
|
+
assert(Array.isArray(spec.whenToAvoid) && spec.whenToAvoid.length >= 2, `${skillName}: skill-spec.json whenToAvoid too short`);
|
|
127
|
+
assert(typeof spec.purpose === 'string' && spec.purpose.length > 0, `${skillName}: skill-spec.json purpose missing`);
|
|
128
|
+
|
|
129
|
+
const headings = extractHeadings(body);
|
|
130
|
+
const expectedOrder = ['## Purpose', '## When to Use', '## How', '## When to Avoid'];
|
|
131
|
+
let lastIndex = -1;
|
|
132
|
+
for (const section of expectedOrder) {
|
|
133
|
+
const index = headings.indexOf(section);
|
|
134
|
+
assert(index >= 0, `${skillName}: missing section ${section}`);
|
|
135
|
+
assert(index > lastIndex, `${skillName}: section order is invalid around ${section}`);
|
|
136
|
+
lastIndex = index;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
for (const heading of headings) {
|
|
140
|
+
assert(expectedOrder.includes(heading), `${skillName}: unexpected section ${heading}`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
assert(extractSectionItems(body, 'When to Use').length >= 2, `${skillName}: When to Use needs at least 2 bullets`);
|
|
144
|
+
assert(extractSectionItems(body, 'How').length >= 3, `${skillName}: How needs at least 3 bullets`);
|
|
145
|
+
assert(extractSectionItems(body, 'When to Avoid').length >= 2, `${skillName}: When to Avoid needs at least 2 bullets`);
|
|
146
|
+
const referencesDir = path.join(skillDir, 'references');
|
|
147
|
+
const assetsDir = path.join(skillDir, 'assets');
|
|
148
|
+
assert(fs.existsSync(path.join(referencesDir, 'README.md')), `${skillName}: missing local references README file`);
|
|
149
|
+
assert(fs.existsSync(path.join(referencesDir, 'prompt-template.md')), `${skillName}: missing local prompt template file`);
|
|
150
|
+
assert(fs.existsSync(path.join(referencesDir, 'cases.md')), `${skillName}: missing local replay cases file`);
|
|
151
|
+
assert(fs.existsSync(path.join(assetsDir, 'golden-prompt-suite.current.js')), `${skillName}: missing local replay asset file`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function main() {
|
|
155
|
+
assert(!fs.existsSync(path.join(skillsRoot, 'references')), 'legacy skills/references directory should not exist');
|
|
156
|
+
for (const skillDir of readSkillDirectories()) {
|
|
157
|
+
validateSkill(skillDir);
|
|
158
|
+
}
|
|
133
159
|
|
|
134
160
|
console.log('=== Skill shape validation complete ===');
|
|
135
161
|
}
|
|
@@ -6,17 +6,34 @@ const path = require('path');
|
|
|
6
6
|
const repoRoot = path.join(__dirname, '..');
|
|
7
7
|
const skillsRoot = path.join(repoRoot, 'skills');
|
|
8
8
|
|
|
9
|
-
function readSkillDirectories() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
function readSkillDirectories() {
|
|
10
|
+
const results = [];
|
|
11
|
+
|
|
12
|
+
function walk(dir) {
|
|
13
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
14
|
+
if (entry.name === 'references') {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const fullPath = path.join(dir, entry.name);
|
|
19
|
+
if (entry.isDirectory()) {
|
|
20
|
+
const skillFile = path.join(fullPath, 'SKILL.md');
|
|
21
|
+
if (fs.existsSync(skillFile)) {
|
|
22
|
+
results.push(fullPath);
|
|
23
|
+
}
|
|
24
|
+
walk(fullPath);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
walk(skillsRoot);
|
|
30
|
+
return results.sort();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function readSkillFile(skillDir) {
|
|
34
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
35
|
+
return fs.readFileSync(skillFile, 'utf8');
|
|
36
|
+
}
|
|
20
37
|
|
|
21
38
|
function extractFrontmatter(content) {
|
|
22
39
|
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
@@ -92,41 +109,32 @@ function hasMatchingRule(gate, stopRules) {
|
|
|
92
109
|
});
|
|
93
110
|
}
|
|
94
111
|
|
|
95
|
-
function validateSkill(
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (
|
|
110
|
-
throw new Error(`${skillName}:
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
stopRules,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function main() {
|
|
126
|
-
const skills = readSkillDirectories();
|
|
127
|
-
for (const skillName of skills) {
|
|
128
|
-
validateSkill(skillName);
|
|
129
|
-
}
|
|
112
|
+
function validateSkill(skillDir) {
|
|
113
|
+
const skillName = path.basename(skillDir);
|
|
114
|
+
const content = readSkillFile(skillDir);
|
|
115
|
+
const frontmatter = extractFrontmatter(content);
|
|
116
|
+
if (!frontmatter) {
|
|
117
|
+
throw new Error(`${skillName}: missing frontmatter`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const body = content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, '');
|
|
121
|
+
if (!/##\s+When to Avoid/.test(body)) {
|
|
122
|
+
throw new Error(`${skillName}: missing When to Avoid section`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const stopRules = extractStopRules(content);
|
|
126
|
+
if (stopRules.length > 0) {
|
|
127
|
+
throw new Error(`${skillName}: Stop Rules section should be removed`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return { skillName };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function main() {
|
|
134
|
+
const skills = readSkillDirectories();
|
|
135
|
+
for (const skillDir of skills) {
|
|
136
|
+
validateSkill(skillDir);
|
|
137
|
+
}
|
|
130
138
|
|
|
131
139
|
console.log(`=== Stop rule validation complete for ${skills.length} skills ===`);
|
|
132
140
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ambiguity-detection
|
|
3
|
+
description: Surface blockers, contradictions, and missing decisions before the work moves forward.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ambiguity Detection
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Find blockers that prevent the next stage from being safe or deterministic.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- The input contains conflicting or underspecified statements.
|
|
15
|
+
- You need to surface risks before committing to a plan.
|
|
16
|
+
- The same phrase could reasonably mean more than one thing.
|
|
17
|
+
|
|
18
|
+
## How
|
|
19
|
+
|
|
20
|
+
- Separate facts, assumptions, conflicts, and missing decisions before the work moves forward.
|
|
21
|
+
- Name each ambiguity, the decision it blocks, and the question that removes it.
|
|
22
|
+
- Classify each item as blocker, risk, or open question.
|
|
23
|
+
- Turn every assumption into an explicit decision or an explicit unknown.
|
|
24
|
+
- Stop after the blocker list is complete; do not resolve conflicts without evidence.
|
|
25
|
+
|
|
26
|
+
## When to Avoid
|
|
27
|
+
|
|
28
|
+
- The request is already routeable and only needs design work.
|
|
29
|
+
- The input is already clear enough for implementation.
|
|
30
|
+
- You only need wording cleanup or formatting.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
"name": "ambiguity-detection.golden-prompt-suite.current",
|
|
5
|
+
"skill": "ambiguity-detection",
|
|
6
|
+
"description": "Surface blockers, contradictions, and missing decisions before the work moves forward.",
|
|
7
|
+
"cases": [
|
|
8
|
+
{
|
|
9
|
+
"id": "ambiguity-conflict-scan",
|
|
10
|
+
"prompt": "This request may contain contradictions or hidden assumptions. Find them.",
|
|
11
|
+
"expectedFirstSkill": "ambiguity-detection",
|
|
12
|
+
"expectedOutput": [
|
|
13
|
+
"blockers",
|
|
14
|
+
"conflicts",
|
|
15
|
+
"missing decisions"
|
|
16
|
+
],
|
|
17
|
+
"expectedStop": "Do not resolve conflicts without evidence.",
|
|
18
|
+
"expectedHandoff": "impact-analysis"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# ambiguity-detection References
|
|
2
|
+
|
|
3
|
+
This directory is local to the skill and is the only reference entry point for this skill.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- `../skill-spec.json`: design source for regenerating this skill
|
|
8
|
+
- `prompt-template.md`: reusable prompt wording for this skill
|
|
9
|
+
- `cases.md`: human-readable replay case for this skill
|
|
10
|
+
- `../assets/golden-prompt-suite.current.js`: machine-readable local case fixture
|
|
11
|
+
|
|
12
|
+
## Guidance
|
|
13
|
+
|
|
14
|
+
- Keep skill-specific explanation here instead of pushing it into a stage-level shared library.
|
|
15
|
+
- Keep shared hard constraints in `../../../rules/index.md`.
|
|
16
|
+
- Keep canonical names unchanged.
|
|
17
|
+
- Skill summary: Surface blockers, contradictions, and missing decisions before the work moves forward.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# ambiguity-detection
|
|
2
|
+
|
|
3
|
+
## Replay Case
|
|
4
|
+
|
|
5
|
+
- Case: `ambiguity-conflict-scan`
|
|
6
|
+
- First skill: `ambiguity-detection`
|
|
7
|
+
|
|
8
|
+
### Prompt
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
This request may contain contradictions or hidden assumptions. Find them.
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Expected Output
|
|
15
|
+
|
|
16
|
+
- blockers
|
|
17
|
+
- conflicts
|
|
18
|
+
- missing decisions
|
|
19
|
+
|
|
20
|
+
### Stop Rule
|
|
21
|
+
|
|
22
|
+
- Do not resolve conflicts without evidence.
|
|
23
|
+
|
|
24
|
+
### Handoff
|
|
25
|
+
|
|
26
|
+
- impact-analysis
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# ambiguity-detection
|
|
2
|
+
|
|
3
|
+
## Prompt Template
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
You are handling the ambiguity-detection skill.
|
|
7
|
+
Goal: Surface blockers, contradictions, and missing decisions before the work moves forward
|
|
8
|
+
Inputs: the request, supporting evidence, constraints, and existing repository facts.
|
|
9
|
+
Output contract: blockers, conflicts, missing decisions.
|
|
10
|
+
Stop rule: Do not resolve conflicts without evidence.
|
|
11
|
+
Handoff: impact-analysis.
|
|
12
|
+
Keep the response scoped to this stage and do not absorb the work of the next stage.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Notes
|
|
16
|
+
|
|
17
|
+
- Keep the template aligned with the local replay case and local assets.
|
|
18
|
+
- Read `cases.md` for the matching replay example.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"group": "01-discovery",
|
|
3
|
+
"name": "ambiguity-detection",
|
|
4
|
+
"description": "Surface blockers, contradictions, and missing decisions before the work moves forward.",
|
|
5
|
+
"title": "Ambiguity Detection",
|
|
6
|
+
"purpose": "Find blockers that prevent the next stage from being safe or deterministic.",
|
|
7
|
+
"whenToUse": [
|
|
8
|
+
"The input contains conflicting or underspecified statements.",
|
|
9
|
+
"You need to surface risks before committing to a plan.",
|
|
10
|
+
"The same phrase could reasonably mean more than one thing."
|
|
11
|
+
],
|
|
12
|
+
"how": [
|
|
13
|
+
"Separate facts, assumptions, conflicts, and missing decisions before the work moves forward.",
|
|
14
|
+
"Name each ambiguity, the decision it blocks, and the question that removes it.",
|
|
15
|
+
"Classify each item as blocker, risk, or open question.",
|
|
16
|
+
"Turn every assumption into an explicit decision or an explicit unknown.",
|
|
17
|
+
"Stop after the blocker list is complete; do not resolve conflicts without evidence."
|
|
18
|
+
],
|
|
19
|
+
"whenToAvoid": [
|
|
20
|
+
"The request is already routeable and only needs design work.",
|
|
21
|
+
"The input is already clear enough for implementation.",
|
|
22
|
+
"You only need wording cleanup or formatting."
|
|
23
|
+
],
|
|
24
|
+
"caseId": "ambiguity-conflict-scan",
|
|
25
|
+
"source": "bootstrap-from-skill-md"
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: business-analysis
|
|
3
|
+
description: Normalize business terms, ownership, and rules into a reusable glossary.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Business Analysis
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Normalize business language into stable terms, ownership boundaries, and decision rules.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- The business logic is unclear.
|
|
15
|
+
- You need to define terms, rules, workflows, or ownership boundaries.
|
|
16
|
+
- Different stakeholders are using different words for the same thing.
|
|
17
|
+
|
|
18
|
+
## How
|
|
19
|
+
|
|
20
|
+
- Extract canonical terms, then define each term in one sentence.
|
|
21
|
+
- Map each term to owner, scope, rule, exception, and evidence.
|
|
22
|
+
- Separate user intent, business behavior, and implementation detail.
|
|
23
|
+
- Capture success conditions, exclusions, and exceptions, not just the happy path.
|
|
24
|
+
- Stop once later stages can reuse the glossary and business rules without re-interpretation.
|
|
25
|
+
|
|
26
|
+
## When to Avoid
|
|
27
|
+
|
|
28
|
+
- The glossary and business rules are already stable.
|
|
29
|
+
- The request is already technical and needs impact or design work.
|
|
30
|
+
- You only need wording cleanup or formatting.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
"name": "business-analysis.golden-prompt-suite.current",
|
|
5
|
+
"skill": "business-analysis",
|
|
6
|
+
"description": "Normalize business terms, ownership, and rules into a reusable glossary.",
|
|
7
|
+
"cases": [
|
|
8
|
+
{
|
|
9
|
+
"id": "analysis-business-terms",
|
|
10
|
+
"prompt": "This is a business description. Extract the business goal, terms, and boundaries.",
|
|
11
|
+
"expectedFirstSkill": "business-analysis",
|
|
12
|
+
"expectedOutput": [
|
|
13
|
+
"glossary",
|
|
14
|
+
"business rules",
|
|
15
|
+
"ownership boundaries"
|
|
16
|
+
],
|
|
17
|
+
"expectedStop": "Do not decide design or implementation details.",
|
|
18
|
+
"expectedHandoff": "ambiguity-detection"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# business-analysis References
|
|
2
|
+
|
|
3
|
+
This directory is local to the skill and is the only reference entry point for this skill.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- `../skill-spec.json`: design source for regenerating this skill
|
|
8
|
+
- `prompt-template.md`: reusable prompt wording for this skill
|
|
9
|
+
- `cases.md`: human-readable replay case for this skill
|
|
10
|
+
- `../assets/golden-prompt-suite.current.js`: machine-readable local case fixture
|
|
11
|
+
|
|
12
|
+
## Guidance
|
|
13
|
+
|
|
14
|
+
- Keep skill-specific explanation here instead of pushing it into a stage-level shared library.
|
|
15
|
+
- Keep shared hard constraints in `../../../rules/index.md`.
|
|
16
|
+
- Keep canonical names unchanged.
|
|
17
|
+
- Skill summary: Normalize business terms, ownership, and rules into a reusable glossary.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# business-analysis
|
|
2
|
+
|
|
3
|
+
## Replay Case
|
|
4
|
+
|
|
5
|
+
- Case: `analysis-business-terms`
|
|
6
|
+
- First skill: `business-analysis`
|
|
7
|
+
|
|
8
|
+
### Prompt
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
This is a business description. Extract the business goal, terms, and boundaries.
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Expected Output
|
|
15
|
+
|
|
16
|
+
- glossary
|
|
17
|
+
- business rules
|
|
18
|
+
- ownership boundaries
|
|
19
|
+
|
|
20
|
+
### Stop Rule
|
|
21
|
+
|
|
22
|
+
- Do not decide design or implementation details.
|
|
23
|
+
|
|
24
|
+
### Handoff
|
|
25
|
+
|
|
26
|
+
- ambiguity-detection
|