bmad-module-skill-forge 0.9.0 → 0.10.1-alpha.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.
- package/.claude-plugin/marketplace.json +39 -0
- package/.gitattributes +16 -0
- package/README.md +105 -38
- package/docs/404.md +13 -10
- package/docs/RELEASING.md +185 -0
- package/docs/STABILITY.md +123 -0
- package/docs/_data/pinned.yaml +98 -0
- package/docs/agents.md +16 -11
- package/docs/architecture.md +221 -0
- package/docs/bmad-synergy.md +11 -13
- package/docs/concepts.md +18 -108
- package/docs/examples.md +121 -80
- package/docs/getting-started.md +85 -147
- package/docs/how-it-works.md +25 -536
- package/docs/index.md +44 -27
- package/docs/skill-model.md +328 -0
- package/docs/troubleshooting.md +39 -0
- package/docs/verifying-a-skill.md +232 -0
- package/docs/why-skf.md +93 -0
- package/docs/workflows.md +119 -13
- package/package.json +25 -4
- package/src/README.md +23 -25
- package/src/forger/forge-tier.yaml +4 -2
- package/src/forger/preferences.yaml +7 -1
- package/src/knowledge/agentskills-spec.md +1 -1
- package/src/knowledge/architecture-verification.md +1 -1
- package/src/knowledge/ccc-bridge.md +16 -15
- package/src/knowledge/overview.md +11 -11
- package/src/knowledge/progressive-capability.md +3 -3
- package/src/knowledge/provenance-tracking.md +9 -3
- package/src/knowledge/qmd-registry.md +8 -8
- package/src/knowledge/skf-knowledge-index.csv +2 -2
- package/src/knowledge/skill-lifecycle.md +16 -1
- package/src/knowledge/split-body-strategy.md +1 -1
- package/src/knowledge/version-paths.md +17 -12
- package/src/module-help.csv +18 -17
- package/src/module.yaml +4 -0
- package/src/shared/health-check.md +372 -0
- package/src/shared/references/feasibility-report-schema.md +86 -0
- package/src/shared/references/headless-gate-convention.md +62 -0
- package/src/shared/references/output-contract-schema.md +35 -0
- package/src/shared/references/pipeline-contracts.md +102 -0
- package/src/shared/scripts/skf-atomic-write.py +370 -0
- package/src/shared/scripts/skf-manifest-ops.py +236 -0
- package/src/shared/scripts/skf-preflight.py +164 -0
- package/src/shared/scripts/skf-rebuild-managed-sections.py +201 -0
- package/src/shared/scripts/skf-severity-classify.py +163 -0
- package/src/shared/scripts/skf-skill-inventory.py +210 -0
- package/src/shared/scripts/skf-structural-diff.py +257 -0
- package/src/shared/scripts/skf-validate-frontmatter.py +318 -0
- package/src/shared/scripts/skf-validate-output.py +247 -0
- package/src/skf-analyze-source/SKILL.md +57 -0
- package/src/skf-analyze-source/assets/skill-brief-schema.md +125 -0
- package/src/skf-analyze-source/references/unit-detection-heuristics.md +124 -0
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-01-init.md +6 -66
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-01b-continue.md +4 -59
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-02-scan-project.md +7 -68
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-03-identify-units.md +6 -66
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-04-map-and-detect.md +7 -68
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-05-recommend.md +6 -66
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-06-generate-briefs.md +14 -66
- package/src/skf-analyze-source/steps-c/step-07-health-check.md +22 -0
- package/src/skf-audit-skill/SKILL.md +59 -0
- package/src/{workflows/audit-skill/data → skf-audit-skill/assets}/drift-report-template.md +7 -7
- package/src/{workflows/audit-skill/data → skf-audit-skill/references}/severity-rules.md +11 -11
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-01-init.md +24 -68
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-02-re-index.md +36 -71
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-03-structural-diff.md +21 -63
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-04-semantic-diff.md +6 -65
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-05-severity-classify.md +5 -63
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-06-report.md +10 -59
- package/src/skf-audit-skill/steps-c/step-07-health-check.md +22 -0
- package/src/skf-brief-skill/SKILL.md +53 -0
- package/src/{workflows/brief-skill/data → skf-brief-skill/assets}/scope-templates.md +23 -0
- package/src/skf-brief-skill/assets/skill-brief-schema.md +206 -0
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-01-gather-intent.md +6 -67
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-02-analyze-target.md +6 -66
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-03-scope-definition.md +12 -68
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-04-confirm-brief.md +5 -63
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-05-write-brief.md +10 -69
- package/src/skf-brief-skill/steps-c/step-06-health-check.md +22 -0
- package/src/skf-create-skill/SKILL.md +63 -0
- package/src/{workflows/create-skill/data → skf-create-skill/assets}/compile-assembly-rules.md +60 -0
- package/src/{workflows/create-skill/data → skf-create-skill/assets}/skill-sections.md +92 -23
- package/src/skf-create-skill/assets/tessl-dismissal-rules.md +102 -0
- package/src/{workflows/create-skill/data → skf-create-skill/references}/extraction-patterns-tracing.md +13 -13
- package/src/{workflows/create-skill/data → skf-create-skill/references}/extraction-patterns.md +8 -3
- package/src/skf-create-skill/references/source-resolution-protocols.md +239 -0
- package/src/{workflows/create-skill/data → skf-create-skill/references}/tier-degradation-rules.md +8 -7
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-01-load-brief.md +25 -63
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-02-ecosystem-check.md +8 -64
- package/src/skf-create-skill/steps-c/step-03-extract.md +379 -0
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-03d-component-extraction.md +18 -35
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-04-enrich.md +12 -69
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-05-compile.md +71 -75
- package/src/skf-create-skill/steps-c/step-06-validate.md +267 -0
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-07-generate-artifacts.md +30 -74
- package/src/skf-create-skill/steps-c/step-08-report.md +145 -0
- package/src/skf-create-skill/steps-c/step-09-health-check.md +23 -0
- package/src/{workflows/create-skill/steps-c → skf-create-skill/steps-c/sub}/step-02b-ccc-discover.md +8 -66
- package/src/skf-create-skill/steps-c/sub/step-03b-fetch-temporal.md +229 -0
- package/src/{workflows/create-skill/steps-c → skf-create-skill/steps-c/sub}/step-03c-fetch-docs.md +18 -42
- package/src/skf-create-stack-skill/SKILL.md +64 -0
- package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/assets}/stack-skill-template.md +2 -1
- package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/compose-mode-rules.md +19 -5
- package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/integration-patterns.md +1 -1
- package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/manifest-patterns.md +10 -10
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-01-init.md +14 -55
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-02-detect-manifests.md +29 -63
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-03-rank-and-confirm.md +9 -59
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-04-parallel-extract.md +29 -64
- package/src/skf-create-stack-skill/steps-c/step-05-detect-integrations.md +164 -0
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-06-compile-stack.md +7 -60
- package/src/skf-create-stack-skill/steps-c/step-07-generate-output.md +328 -0
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-08-validate.md +17 -63
- package/src/skf-create-stack-skill/steps-c/step-09-report.md +128 -0
- package/src/skf-create-stack-skill/steps-c/step-10-health-check.md +22 -0
- package/src/skf-drop-skill/SKILL.md +57 -0
- package/src/{workflows/drop-skill → skf-drop-skill}/steps-c/step-01-select.md +9 -69
- package/src/{workflows/drop-skill → skf-drop-skill}/steps-c/step-02-execute.md +30 -106
- package/src/skf-drop-skill/steps-c/step-03-report.md +83 -0
- package/src/skf-drop-skill/steps-c/step-04-health-check.md +22 -0
- package/src/skf-export-skill/SKILL.md +57 -0
- package/src/skf-export-skill/assets/managed-section-format.md +138 -0
- package/src/{workflows/export-skill/data → skf-export-skill/assets}/snippet-format.md +8 -12
- package/src/skf-export-skill/steps-c/step-01-load-skill.md +247 -0
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-02-package.md +5 -58
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-03-generate-snippet.md +15 -77
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-04-update-context.md +59 -133
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-05-token-report.md +4 -58
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-06-summary.md +20 -64
- package/src/skf-export-skill/steps-c/step-07-health-check.md +22 -0
- package/src/skf-forger/SKILL.md +110 -0
- package/src/skf-forger/bmad-skill-manifest.yaml +11 -0
- package/src/skf-quick-skill/SKILL.md +56 -0
- package/src/{workflows/quick-skill/data → skf-quick-skill/references}/registry-resolution.md +6 -6
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-01-resolve-target.md +9 -62
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-02-ecosystem-check.md +5 -59
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-03-quick-extract.md +18 -61
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-04-compile.md +6 -60
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-05-validate.md +58 -78
- package/src/skf-quick-skill/steps-c/step-06-write.md +73 -0
- package/src/skf-quick-skill/steps-c/step-07-health-check.md +22 -0
- package/src/skf-refine-architecture/SKILL.md +57 -0
- package/src/{workflows/refine-architecture/data → skf-refine-architecture/references}/refinement-rules.md +16 -16
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-01-init.md +6 -63
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-02-gap-analysis.md +29 -71
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-03-issue-detection.md +5 -65
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-04-improvements.md +5 -64
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-05-compile.md +5 -56
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-06-report.md +14 -64
- package/src/skf-refine-architecture/steps-c/step-07-health-check.md +22 -0
- package/src/skf-rename-skill/SKILL.md +58 -0
- package/src/{workflows/rename-skill → skf-rename-skill}/steps-c/step-01-select.md +12 -73
- package/src/{workflows/rename-skill → skf-rename-skill}/steps-c/step-02-execute.md +32 -113
- package/src/skf-rename-skill/steps-c/step-03-report.md +83 -0
- package/src/skf-rename-skill/steps-c/step-04-health-check.md +22 -0
- package/src/skf-setup/SKILL.md +55 -0
- package/src/{workflows/setup-forge → skf-setup}/steps-c/step-01-detect-and-tier.md +6 -62
- package/src/{workflows/setup-forge → skf-setup}/steps-c/step-01b-ccc-index.md +9 -65
- package/src/{workflows/setup-forge → skf-setup}/steps-c/step-02-write-config.md +15 -60
- package/src/{workflows/setup-forge → skf-setup}/steps-c/step-03-auto-index.md +7 -66
- package/src/skf-setup/steps-c/step-04-report.md +92 -0
- package/src/skf-setup/steps-c/step-05-health-check.md +22 -0
- package/src/skf-test-skill/SKILL.md +59 -0
- package/src/skf-test-skill/references/migration-section-rules.md +114 -0
- package/src/skf-test-skill/references/scoring-rules.md +207 -0
- package/src/skf-test-skill/references/source-access-protocol.md +109 -0
- package/src/skf-test-skill/scripts/compute-score.py +310 -0
- package/src/skf-test-skill/steps-c/step-01-init.md +238 -0
- package/src/{workflows/test-skill → skf-test-skill}/steps-c/step-02-detect-mode.md +4 -62
- package/src/skf-test-skill/steps-c/step-03-coverage-check.md +347 -0
- package/src/skf-test-skill/steps-c/step-04-coherence-check.md +239 -0
- package/src/{workflows/test-skill → skf-test-skill}/steps-c/step-04b-external-validators.md +42 -77
- package/src/skf-test-skill/steps-c/step-05-score.md +266 -0
- package/src/skf-test-skill/steps-c/step-06-report.md +290 -0
- package/src/skf-test-skill/steps-c/step-07-health-check.md +25 -0
- package/src/skf-test-skill/templates/test-report-template.md +58 -0
- package/src/skf-update-skill/SKILL.md +58 -0
- package/src/{workflows/update-skill/data → skf-update-skill/references}/manual-section-rules.md +6 -6
- package/src/{workflows/update-skill/data → skf-update-skill/references}/merge-conflict-rules.md +5 -5
- package/src/skf-update-skill/references/remote-source-resolution.md +94 -0
- package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-01-init.md +22 -69
- package/src/skf-update-skill/steps-c/step-02-detect-changes.md +255 -0
- package/src/skf-update-skill/steps-c/step-03-re-extract.md +336 -0
- package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-04-merge.md +60 -72
- package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-05-validate.md +5 -62
- package/src/skf-update-skill/steps-c/step-06-write.md +278 -0
- package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-07-report.md +11 -66
- package/src/skf-update-skill/steps-c/step-08-health-check.md +22 -0
- package/src/skf-verify-stack/SKILL.md +60 -0
- package/src/skf-verify-stack/assets/feasibility-report-template.md +76 -0
- package/src/{workflows/verify-stack/data → skf-verify-stack/references}/coverage-patterns.md +12 -4
- package/src/skf-verify-stack/references/integration-verification-rules.md +78 -0
- package/src/skf-verify-stack/steps-c/step-01-init.md +178 -0
- package/src/{workflows/verify-stack → skf-verify-stack}/steps-c/step-02-coverage.md +27 -72
- package/src/skf-verify-stack/steps-c/step-03-integrations.md +179 -0
- package/src/{workflows/verify-stack → skf-verify-stack}/steps-c/step-04-requirements.md +14 -67
- package/src/skf-verify-stack/steps-c/step-05-synthesize.md +147 -0
- package/src/skf-verify-stack/steps-c/step-06-report.md +156 -0
- package/src/skf-verify-stack/steps-c/step-07-health-check.md +25 -0
- package/tools/cli/commands/install.js +1 -1
- package/tools/cli/commands/status.js +21 -23
- package/tools/cli/commands/uninstall.js +11 -19
- package/tools/cli/commands/update.js +2 -2
- package/tools/cli/lib/ide-skills.js +216 -0
- package/tools/cli/lib/installer.js +29 -52
- package/tools/cli/lib/manifest.js +11 -5
- package/tools/cli/lib/platform-codes.yaml +223 -0
- package/tools/cli/lib/ui.js +76 -47
- package/tools/validate-docs-drift.js +193 -0
- package/src/agents/forger.agent.yaml +0 -114
- package/src/workflows/README.md +0 -174
- package/src/workflows/analyze-source/data/skill-brief-schema.md +0 -125
- package/src/workflows/analyze-source/data/unit-detection-heuristics.md +0 -124
- package/src/workflows/analyze-source/workflow.md +0 -61
- package/src/workflows/audit-skill/workflow.md +0 -64
- package/src/workflows/brief-skill/data/skill-brief-schema.md +0 -159
- package/src/workflows/brief-skill/workflow.md +0 -58
- package/src/workflows/create-skill/data/source-resolution-protocols.md +0 -200
- package/src/workflows/create-skill/steps-c/step-03-extract.md +0 -301
- package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +0 -253
- package/src/workflows/create-skill/steps-c/step-06-validate.md +0 -254
- package/src/workflows/create-skill/steps-c/step-08-report.md +0 -176
- package/src/workflows/create-skill/workflow.md +0 -53
- package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +0 -196
- package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +0 -270
- package/src/workflows/create-stack-skill/steps-c/step-09-report.md +0 -145
- package/src/workflows/create-stack-skill/workflow.md +0 -59
- package/src/workflows/drop-skill/steps-c/step-03-report.md +0 -135
- package/src/workflows/drop-skill/workflow.md +0 -63
- package/src/workflows/export-skill/data/managed-section-format.md +0 -103
- package/src/workflows/export-skill/steps-c/step-01-load-skill.md +0 -237
- package/src/workflows/export-skill/workflow.md +0 -58
- package/src/workflows/quick-skill/steps-c/step-06-write.md +0 -179
- package/src/workflows/quick-skill/workflow.md +0 -58
- package/src/workflows/refine-architecture/workflow.md +0 -61
- package/src/workflows/rename-skill/steps-c/step-03-report.md +0 -132
- package/src/workflows/rename-skill/workflow.md +0 -64
- package/src/workflows/setup-forge/steps-c/step-04-report.md +0 -156
- package/src/workflows/setup-forge/workflow.md +0 -51
- package/src/workflows/test-skill/data/scoring-rules.md +0 -123
- package/src/workflows/test-skill/data/source-access-protocol.md +0 -51
- package/src/workflows/test-skill/steps-c/step-01-init.md +0 -217
- package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +0 -280
- package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +0 -271
- package/src/workflows/test-skill/steps-c/step-05-score.md +0 -222
- package/src/workflows/test-skill/steps-c/step-06-report.md +0 -207
- package/src/workflows/test-skill/templates/test-report-template.md +0 -28
- package/src/workflows/test-skill/workflow.md +0 -57
- package/src/workflows/update-skill/data/remote-source-resolution.md +0 -57
- package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +0 -221
- package/src/workflows/update-skill/steps-c/step-03-re-extract.md +0 -256
- package/src/workflows/update-skill/steps-c/step-06-write.md +0 -265
- package/src/workflows/update-skill/workflow.md +0 -56
- package/src/workflows/verify-stack/data/feasibility-report-template.md +0 -63
- package/src/workflows/verify-stack/data/integration-verification-rules.md +0 -73
- package/src/workflows/verify-stack/steps-c/step-01-init.md +0 -179
- package/src/workflows/verify-stack/steps-c/step-03-integrations.md +0 -195
- package/src/workflows/verify-stack/steps-c/step-05-synthesize.md +0 -191
- package/src/workflows/verify-stack/steps-c/step-06-report.md +0 -197
- package/src/workflows/verify-stack/workflow.md +0 -61
- package/tools/cli/lib/compiler.js +0 -306
- package/tools/cli/lib/ide-commands.js +0 -244
- /package/src/{workflows/analyze-source → skf-analyze-source}/templates/analysis-report-template.md +0 -0
- /package/src/{workflows/quick-skill/data → skf-quick-skill/assets}/skill-template.md +0 -0
- /package/src/{workflows/setup-forge/data → skf-setup/references}/tier-rules.md +0 -0
- /package/src/{workflows/test-skill/data → skf-test-skill/assets}/output-section-formats.md +0 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
---
|
|
2
|
+
nextStepFile: './step-04-coherence-check.md'
|
|
3
|
+
outputFile: '{forge_version}/test-report-{skill_name}-{run_id}.md'
|
|
4
|
+
scoringRulesFile: 'references/scoring-rules.md'
|
|
5
|
+
sourceAccessProtocol: 'references/source-access-protocol.md'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Step 3: Coverage Check
|
|
9
|
+
|
|
10
|
+
## STEP GOAL:
|
|
11
|
+
|
|
12
|
+
Compare the exports, functions, classes, types, and interfaces documented in SKILL.md against the actual source code API surface. Identify missing documentation, undocumented exports, and signature mismatches. Analysis depth scales with forge tier.
|
|
13
|
+
|
|
14
|
+
## Rules
|
|
15
|
+
|
|
16
|
+
- Use subprocess optimization for per-file AST analysis when available; if unavailable, analyze sequentially
|
|
17
|
+
- For each source file, launch a subprocess for deep analysis — do not shortcut
|
|
18
|
+
- Coverage depth must match the detected forge tier
|
|
19
|
+
|
|
20
|
+
## MANDATORY SEQUENCE
|
|
21
|
+
|
|
22
|
+
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
|
|
23
|
+
|
|
24
|
+
### 0. Check for Docs-Only Mode
|
|
25
|
+
|
|
26
|
+
**If all SKILL.md citations are `[EXT:...]` format (no local source citations):**
|
|
27
|
+
|
|
28
|
+
Set `docs_only_mode: true` in context for step-05 scoring. Coverage scoring adapts: instead of comparing SKILL.md against source code exports, compare SKILL.md documented items against themselves for internal completeness (every documented function has a description, parameters, and return type). Score based on documentation completeness rather than source coverage.
|
|
29
|
+
|
|
30
|
+
**Quick-tier weight adjustment:** If `confidence_tier` is also `"Quick"`, apply Quick-tier weight redistribution (zeroing Signature Accuracy and Type Coverage) as an additional step per `{scoringRulesFile}`.
|
|
31
|
+
|
|
32
|
+
"**Docs-only skill detected.** Coverage check evaluates documentation completeness rather than source code coverage."
|
|
33
|
+
|
|
34
|
+
**If source-based skill:** Continue with standard coverage check below.
|
|
35
|
+
|
|
36
|
+
### 0b. Load Source Access Protocol
|
|
37
|
+
|
|
38
|
+
Load `{sourceAccessProtocol}` and follow both sections:
|
|
39
|
+
1. **Source API Surface Definition** — determines what counts as the public API for coverage denominator
|
|
40
|
+
2. **Source Access Resolution** — 5-state waterfall to determine how source files will be read and sets `analysis_confidence`
|
|
41
|
+
|
|
42
|
+
### 1. Extract Documented Exports from SKILL.md
|
|
43
|
+
|
|
44
|
+
<!-- Subagent delegation: read SKILL.md + references/*.md, return compact JSON inventory -->
|
|
45
|
+
|
|
46
|
+
Delegate reading of the skill under test to a subagent. The subagent receives the path to SKILL.md (and the `references/` directory path if it exists) and MUST:
|
|
47
|
+
1. Read SKILL.md
|
|
48
|
+
2. If a `references/` directory exists alongside SKILL.md and SKILL.md's `## Full` headings are absent or stubs, also read all `references/*.md` files
|
|
49
|
+
3. ONLY return this compact JSON inventory — no prose, no extra commentary:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"exports": [
|
|
54
|
+
{"name": "functionName", "kind": "function", "params": "...", "return_type": "...", "description": "..."},
|
|
55
|
+
{"name": "ClassName", "kind": "class", "methods": ["..."], "properties": ["..."]},
|
|
56
|
+
{"name": "TypeName", "kind": "type", "fields": ["..."]},
|
|
57
|
+
{"name": "CONST_NAME", "kind": "constant", "values": ["..."]},
|
|
58
|
+
{"name": "useHook", "kind": "hook", "usage_signature": "..."}
|
|
59
|
+
],
|
|
60
|
+
"capabilities": ["brief capability descriptions from the skill overview"],
|
|
61
|
+
"references": ["references/api-reference.md", "references/type-definitions.md"],
|
|
62
|
+
"cross_check_mismatches": [
|
|
63
|
+
{
|
|
64
|
+
"export": "functionName",
|
|
65
|
+
"skill_md_line": 42,
|
|
66
|
+
"reference_file": "references/api-reference.md",
|
|
67
|
+
"reference_line": 18,
|
|
68
|
+
"issue": "description of the signature mismatch"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Parent uses this JSON summary as the documented inventory.** Do not load SKILL.md or references file contents into parent context.
|
|
75
|
+
|
|
76
|
+
#### 1a. Parent-Side Schema Validation + Spot-Check (MANDATORY)
|
|
77
|
+
|
|
78
|
+
test-skill is a quality gate — it MUST NOT trust subagent output blindly. Before any downstream step consumes the inventory, the parent performs two checks and HALTs on any failure:
|
|
79
|
+
|
|
80
|
+
**Schema validation (required keys + types):**
|
|
81
|
+
|
|
82
|
+
1. Parse the subagent response as JSON. On parse failure → HALT "coverage-check: subagent response not valid JSON".
|
|
83
|
+
2. Required keys present: `exports` (list), `cross_check_mismatches` (list — may be empty). Missing key or wrong type → HALT "coverage-check: subagent JSON schema invalid — missing/typo: {key}". Note: the parent already knows the skill name from workflow context (`{resolved_skill_package}` from step-01) — the subagent is not required to echo it back, and doing so introduces a contract-drift surface without improving verification.
|
|
84
|
+
3. Each `exports[]` entry must be a dict with at minimum `name` (non-empty string) and `kind` (one of `function|class|type|constant|hook|interface|method`). Reject entries violating this; if >0 rejections, HALT "coverage-check: subagent returned malformed export entries — {count} entries do not match schema".
|
|
85
|
+
4. `cross_check_mismatches[]` entries (when non-empty) must carry `export`, `skill_md_line`, `reference_file`, `reference_line`, `issue`. Missing fields → HALT.
|
|
86
|
+
|
|
87
|
+
**Spot-check (ground-truth verification, zero-hallucination guard):**
|
|
88
|
+
|
|
89
|
+
1. If `len(exports) == 0`: skip the spot-check (no names to verify). Zero-exports policy is handled in section 3 (B1 zero-exports guard).
|
|
90
|
+
2. Otherwise, sample `min(3, len(exports))` exports deterministically — by default take indices `[0, len//2, len-1]` (first, middle, last) from the `exports` array after a stable sort by `name`.
|
|
91
|
+
3. For each sampled export, run: `grep -n "{export.name}" {resolved_skill_package}/SKILL.md` in the parent context. The name MUST appear at least once.
|
|
92
|
+
4. If ANY sampled name returns zero matches, HALT "coverage-check: subagent inventory failed ground-truth spot-check — `{name}` claimed as export but absent from SKILL.md".
|
|
93
|
+
|
|
94
|
+
These checks catch two hallucination classes: schema-shape drift (subagent paraphrased or dropped the contract) and fabricated exports (subagent invented names not in the document). Both are disqualifying for a grader skill — do not downgrade to a warning.
|
|
95
|
+
|
|
96
|
+
**Split-body traversal** is handled inside the subagent: if `references/` exists and `## Full` headings are absent or stubs in SKILL.md, the subagent extends its scan to all `references/*.md` files and includes them in the `exports` array. After split-body, Tier 2 content (Full API Reference, Full Type Definitions) lives in reference files — the inventory must reflect the full skill content regardless of where it resides.
|
|
97
|
+
|
|
98
|
+
### 1b. Cross-Check Split-Body Consistency
|
|
99
|
+
|
|
100
|
+
**Only execute if the subagent's `references` array is non-empty** (detected during split-body traversal in Section 1). Skip silently otherwise.
|
|
101
|
+
|
|
102
|
+
The subagent has already read both SKILL.md body and `references/*.md` files. For each function, class, type, or interface that appears in BOTH the SKILL.md body AND any `references/*.md` file, instruct the subagent (or perform in the same subagent call from Section 1) to compare the documented signatures and include mismatches in its JSON output as a `cross_check_mismatches` array:
|
|
103
|
+
|
|
104
|
+
- **Parameters:** name, type, order, optionality
|
|
105
|
+
- **Return types:** exact type match
|
|
106
|
+
- **Description:** no contradictions (brief vs detailed is acceptable; conflicting semantics is not)
|
|
107
|
+
|
|
108
|
+
**SKILL.md body is authoritative.** When a mismatch is found, the reference file is the one that needs updating.
|
|
109
|
+
|
|
110
|
+
Parent reads `cross_check_mismatches` from the subagent JSON summary. Build the split-body consistency findings list:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"cross_check_mismatches": [
|
|
115
|
+
{
|
|
116
|
+
"export": "formatDate",
|
|
117
|
+
"skill_md_line": 42,
|
|
118
|
+
"reference_file": "references/api-reference.md",
|
|
119
|
+
"reference_line": 18,
|
|
120
|
+
"issue": "SKILL.md shows (date: Date) => string, reference shows (date: Date, format?: string) => string"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"exports_cross_checked": 12,
|
|
124
|
+
"mismatches_found": 1
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Flag each mismatch as **High severity** — signature inconsistency between SKILL.md body and reference files undermines agent trust. These findings feed into the gap report (step-06).
|
|
129
|
+
|
|
130
|
+
### 2. Analyze Source Code (Tier-Dependent)
|
|
131
|
+
|
|
132
|
+
Start from the package entry point (see 0b) and identify the public API surface. Then analyze those exports at the appropriate tier depth.
|
|
133
|
+
|
|
134
|
+
**Quick Tier (no tools):**
|
|
135
|
+
- Read the entry point file(s) directly
|
|
136
|
+
- Identify public exports by scanning for `export` keywords, `module.exports`, `__init__.py` imports, or language-specific export patterns
|
|
137
|
+
- Compare against documented inventory by name matching
|
|
138
|
+
- Cannot verify signatures — note as "unverified" in report
|
|
139
|
+
|
|
140
|
+
**Forge Tier (ast-grep available):**
|
|
141
|
+
DO NOT BE LAZY — For EACH source file that defines public API exports, launch a subprocess that:
|
|
142
|
+
1. Uses ast-grep to extract all exported symbols with their full signatures
|
|
143
|
+
2. Matches each export against the documented inventory
|
|
144
|
+
3. Returns structured findings:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"file": "src/utils.ts",
|
|
149
|
+
"exports_found": ["formatDate", "parseConfig", "ConfigType"],
|
|
150
|
+
"exports_documented": ["formatDate", "parseConfig"],
|
|
151
|
+
"missing_docs": ["ConfigType"],
|
|
152
|
+
"signature_mismatches": [
|
|
153
|
+
{
|
|
154
|
+
"name": "formatDate",
|
|
155
|
+
"source_sig": "(date: Date, format?: string) => string",
|
|
156
|
+
"documented_sig": "(date: Date) => string",
|
|
157
|
+
"issue": "missing optional parameter 'format'"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
If subprocess unavailable, perform ast-grep analysis in main thread per file.
|
|
164
|
+
|
|
165
|
+
**Deep Tier (ast-grep + gh + QMD):**
|
|
166
|
+
- All Forge tier checks, plus:
|
|
167
|
+
- Use gh CLI to verify source repository matches documented version
|
|
168
|
+
- Cross-check type definitions against their source declarations
|
|
169
|
+
- Verify re-exported symbols trace to their original source
|
|
170
|
+
|
|
171
|
+
### 2b. Zero-Exports Guard (B1)
|
|
172
|
+
|
|
173
|
+
After the source-code analysis (§2) completes, compute `total_exports` — the count of exports discovered in the source / provenance-map / metadata.json, per the stratified-scope and State 2 rules resolved in §4.
|
|
174
|
+
|
|
175
|
+
**If `total_exports == 0` AND `docs_only_mode == false`:** HALT with:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
Error: indeterminate API surface — 0 exports discovered in source for {skill_name}.
|
|
179
|
+
|
|
180
|
+
A source-based skill with zero exports cannot be meaningfully tested:
|
|
181
|
+
Export Coverage is undefined (division by zero) and downstream scoring
|
|
182
|
+
would yield a vacuous PASS.
|
|
183
|
+
|
|
184
|
+
Fix one of:
|
|
185
|
+
- Set `scope.include` in the brief to point at the package's entry point(s)
|
|
186
|
+
- Add `[EXT:]` citations if this is actually a docs-only skill
|
|
187
|
+
- Verify the skill's source_path / source_ref resolve to the intended tree
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Do not write the Coverage Analysis section. Do not proceed to scoring. This is a true indeterminate state, not a FAIL — no score should be attached.
|
|
191
|
+
|
|
192
|
+
**If `docs_only_mode == true` and the documented inventory is empty:** HALT with the analogous docs-only message ("docs-only skill declares zero items — no API surface to test").
|
|
193
|
+
|
|
194
|
+
### 3. Build Coverage Results
|
|
195
|
+
|
|
196
|
+
Aggregate findings across all source files:
|
|
197
|
+
|
|
198
|
+
**Per-export status table:**
|
|
199
|
+
|
|
200
|
+
| Export | Type | Documented | Signature Match | File:Line | Status |
|
|
201
|
+
|--------|------|-----------|-----------------|-----------|--------|
|
|
202
|
+
| {name} | function/class/type | yes/no | yes/no/unverified | src/file.ts:42 | PASS/FAIL/WARN |
|
|
203
|
+
|
|
204
|
+
**Summary counts:**
|
|
205
|
+
- Total exports in source: {N}
|
|
206
|
+
- Documented in SKILL.md: {N}
|
|
207
|
+
- Missing documentation: {N}
|
|
208
|
+
- Signature mismatches: {N}
|
|
209
|
+
- Undocumented in SKILL.md but not in source (stale docs): {N}
|
|
210
|
+
|
|
211
|
+
### 4. Load Scoring Rules
|
|
212
|
+
|
|
213
|
+
Load `{scoringRulesFile}` to determine category scores:
|
|
214
|
+
|
|
215
|
+
- **Export Coverage:** (documented / total_exports) * 100
|
|
216
|
+
- **Signature Accuracy:** (matching_signatures / total_documented) * 100 (Forge/Deep only, "N/A" for Quick)
|
|
217
|
+
- **Type Coverage:** (documented_types / total_types) * 100 (Forge/Deep only, "N/A" for Quick)
|
|
218
|
+
|
|
219
|
+
**Stratified-scope denominator (monorepo curated subsets):** Before computing Export Coverage, check whether the Source Access Protocol's stratified-scope clause applies to this skill (see `{sourceAccessProtocol}` §Source API Surface Definition — "Stratified-scope monorepo packages"). When it applies:
|
|
220
|
+
|
|
221
|
+
1. **Prefer `metadata.json.stats.effective_denominator`** when present. Use it directly as `total_exports`.
|
|
222
|
+
2. **Otherwise re-derive at test time** from the brief's scope globs per the protocol. When the brief supplies `scope.tier_a_include`, re-derive from that narrower list; otherwise re-derive from `scope.include`. Use the resulting union count as `total_exports`.
|
|
223
|
+
3. **Run the denominator inflation check** defined in `{sourceAccessProtocol}` stratified-scope resolution step 3 whenever re-derivation fell back to `scope.include`. If the `scope.include` union exceeds the provenance-map entry count by more than 25%, emit the Medium-severity `denominator inflation — coarse scope.include union exceeds authored surface` gap and append it to the Coverage Analysis gap list.
|
|
224
|
+
4. **Apply provenance-map canonicalization** before intersecting documented exports against the raw provenance-map entry list — see `{sourceAccessProtocol}` §Source API Surface Definition → "Provenance-map canonicalization" for the folding rules (`_def`/`_exact` suffix, `a11y_` prefix, renderer-prefix disambiguation). Skip folding when `metadata.json.stats.effective_denominator` is present and already equals the raw provenance-map entry count. Record the fold summary in the Coverage Analysis section so it's auditable.
|
|
225
|
+
|
|
226
|
+
Record the denominator source in the Coverage Analysis section as `Denominator: stratified ({effective_denominator | tier_a_include union | scope.include union}, {N} files matched)`. When stratified scope does not apply, use the standard barrel-based denominator and omit the stratified annotation.
|
|
227
|
+
|
|
228
|
+
**M2 — Record the two non-chosen candidate values alongside the chosen one.**
|
|
229
|
+
Stratified-scope resolution picks ONE of three denominator candidates
|
|
230
|
+
(`stats.effective_denominator`, `tier_a_include` union, `scope.include` union)
|
|
231
|
+
per the priority above. To make the choice auditable, append a
|
|
232
|
+
`Denominator Candidates` block immediately after the `Denominator:` line listing
|
|
233
|
+
all three values — the chosen one explicitly marked and the other two recorded
|
|
234
|
+
as-observed (or `absent` when the candidate was not present for this skill):
|
|
235
|
+
|
|
236
|
+
```markdown
|
|
237
|
+
**Denominator Candidates** (M2 — stratified-scope audit trail):
|
|
238
|
+
- `stats.effective_denominator`: {N | absent} {← chosen if priority (1) applied}
|
|
239
|
+
- `scope.tier_a_include` union: {N | absent} {← chosen if priority (2) applied}
|
|
240
|
+
- `scope.include` union: {N | absent} {← chosen if priority (3) applied}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Readers can then spot-check whether the chosen denominator is reasonable
|
|
244
|
+
against the other two without re-running the extraction. A future reviewer who
|
|
245
|
+
suspects denominator gaming has the evidence inline.
|
|
246
|
+
|
|
247
|
+
**State 2 denominator validation:** When using provenance-map as the baseline (State 2), cross-reference the provenance-map entry count against `metadata.json`'s `exports[]` array before computing Export Coverage. If they diverge, use the union as the denominator per the source-access-protocol rules. Log the gap size if any. The stratified-scope rule above takes precedence when both conditions apply — compute the stratified denominator first, then validate the provenance-map entry count against it.
|
|
248
|
+
|
|
249
|
+
### 4b. Metadata Export-Count Coherence Cross-Check
|
|
250
|
+
|
|
251
|
+
After the denominator has been resolved (standard, stratified, or State 2), cross-check export counts *within each semantic cluster* to detect extraction drift without false-positiving on intentional multi-denominator reporting. Picking the denominator silently when sources disagree is a known friction — the tester cannot tell whether to trust the pick, ignore the drift, or report it. Make it explicit, but only for counts that are authored to measure the *same* surface.
|
|
252
|
+
|
|
253
|
+
**Collect available counts (skip any that are absent) and bin them into two clusters:**
|
|
254
|
+
|
|
255
|
+
**Cluster A — public-barrel surface** (what `__init__.py` / `index.ts` / `lib.rs` re-exports):
|
|
256
|
+
|
|
257
|
+
1. `metadata.json.stats.exports_public_api` — the declared public API count
|
|
258
|
+
2. `metadata.json.exports[]` array length — the enumerated public export list
|
|
259
|
+
|
|
260
|
+
**Cluster B — documented surface** (what was extracted and documented, including methods and submodule members):
|
|
261
|
+
|
|
262
|
+
3. `metadata.json.stats.exports_documented` — the declared documented count
|
|
263
|
+
4. Provenance-map entry count (if `{forge_data_folder}/{skill_name}/provenance-map.json` exists)
|
|
264
|
+
|
|
265
|
+
Cluster assignment is canonical: `skf-create-skill` step-05 derives `exports_public_api` from entry-point validation and writes the `exports[]` array from the same barrel surface (see `skf-create-skill/steps-c/step-05-compile.md:105`), while `exports_documented` tracks the broader documented surface that the provenance-map also enumerates.
|
|
266
|
+
|
|
267
|
+
**Intra-cluster divergence (Medium):** For each cluster, if two counts are present and disagree by more than 10% of the larger, emit a **Medium**-severity gap titled `metadata drift — {cluster} export counts diverge` (substitute `barrel` for Cluster A, `documented-surface` for Cluster B). Enumerate the offending counts in the gap body (e.g., `stats.exports_public_api=55, exports[].length=48` → 13% drift). This is the real drift signal — the two sources should mirror the same surface and they don't, so upstream extraction or compilation produced inconsistent output that a re-compile should reconcile. Classify under structural/metadata coherence regardless of naive/contextual mode.
|
|
268
|
+
|
|
269
|
+
**Cross-cluster divergence (Info):** After intra-cluster checks, if both clusters resolved to a representative count (pick the higher of each cluster's available counts) and the two cluster values differ by more than 10%, append a single **Info**-severity note titled `multi-denominator reporting — barrel vs documented surface` with both values (e.g., `barrel=55, documented=114`). This is expected for skills whose documented surface intentionally exceeds the barrel (methods, submodule members, re-exported classes) — it is not drift. The note exists so the test report makes the dual-denominator design visible and auditable without demanding action.
|
|
270
|
+
|
|
271
|
+
**When a cluster has only one count available:** Skip that cluster's intra-cluster check silently — there is nothing to cross-check within it.
|
|
272
|
+
|
|
273
|
+
**When both clusters agree within 10% of each other:** Skip the cross-cluster note silently — no multi-denominator reporting is in play.
|
|
274
|
+
|
|
275
|
+
**When only one count is available across both clusters:** Skip silently — there is nothing to cross-check.
|
|
276
|
+
|
|
277
|
+
Append any findings (Medium gaps and/or the Info note) to the Coverage Analysis section's gap list (built in section 5) so they surface in the final test report alongside coverage and signature findings. Findings are informational about data quality — they do not change the denominator chosen above.
|
|
278
|
+
|
|
279
|
+
### 5. Append Coverage Analysis to Output
|
|
280
|
+
|
|
281
|
+
Append the **Coverage Analysis** section to `{outputFile}`:
|
|
282
|
+
|
|
283
|
+
```markdown
|
|
284
|
+
## Coverage Analysis
|
|
285
|
+
|
|
286
|
+
**Tier:** {forge_tier}
|
|
287
|
+
**Source Access:** {analysis_confidence} (full | provenance-map | metadata-only | remote-only | docs-only)
|
|
288
|
+
**Source Path:** {source_path}
|
|
289
|
+
**Files Analyzed:** {count}
|
|
290
|
+
**Denominator:** {barrel | stratified ({effective_denominator | scope.include union}, {N} files matched)}
|
|
291
|
+
|
|
292
|
+
### Export Coverage
|
|
293
|
+
|
|
294
|
+
| Export | Type | Documented | Signature | Source Location | Status |
|
|
295
|
+
|--------|------|-----------|-----------|-----------------|--------|
|
|
296
|
+
| ... per-export rows ... |
|
|
297
|
+
|
|
298
|
+
### Coverage Summary
|
|
299
|
+
|
|
300
|
+
- **Exports Found:** {N}
|
|
301
|
+
- **Documented:** {N} ({percentage}%)
|
|
302
|
+
- **Missing Documentation:** {N}
|
|
303
|
+
- **Signature Mismatches:** {N}
|
|
304
|
+
- **Stale Documentation:** {N}
|
|
305
|
+
|
|
306
|
+
### Category Scores
|
|
307
|
+
|
|
308
|
+
| Category | Score |
|
|
309
|
+
|----------|-------|
|
|
310
|
+
| Export Coverage | {N}% |
|
|
311
|
+
| Signature Accuracy | {N}% or N/A |
|
|
312
|
+
| Type Coverage | {N}% or N/A |
|
|
313
|
+
|
|
314
|
+
Note: Weight application is deferred to step-05 where all category weights are calculated after external validation availability is known.
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### 6. Report Coverage Results
|
|
318
|
+
|
|
319
|
+
"**Coverage check complete.**
|
|
320
|
+
|
|
321
|
+
**{skill_name}** — {forge_tier} tier analysis of {file_count} source files:
|
|
322
|
+
|
|
323
|
+
- Exports: {documented}/{total} documented ({percentage}%)
|
|
324
|
+
- Signatures: {matching}/{total} accurate ({percentage}% or N/A for Quick)
|
|
325
|
+
- Types: {documented_types}/{total_types} covered ({percentage}% or N/A for Quick)
|
|
326
|
+
|
|
327
|
+
**{N} issues found** — details in Coverage Analysis section.
|
|
328
|
+
|
|
329
|
+
**Proceeding to coherence check...**"
|
|
330
|
+
|
|
331
|
+
### 7. Auto-Proceed
|
|
332
|
+
|
|
333
|
+
Display: "**Proceeding to coherence check...**"
|
|
334
|
+
|
|
335
|
+
#### Menu Handling Logic:
|
|
336
|
+
|
|
337
|
+
- After coverage analysis is complete, update {outputFile} frontmatter stepsCompleted, then immediately load, read entire file, then execute {nextStepFile}
|
|
338
|
+
|
|
339
|
+
#### EXECUTION RULES:
|
|
340
|
+
|
|
341
|
+
- This is an auto-proceed validation step with no user choices
|
|
342
|
+
- Proceed directly to next step after coverage is analyzed
|
|
343
|
+
|
|
344
|
+
## CRITICAL STEP COMPLETION NOTE
|
|
345
|
+
|
|
346
|
+
ONLY WHEN all source files have been analyzed, the Coverage Analysis section has been appended to {outputFile}, and category scores have been calculated, will you then load and read fully `{nextStepFile}` to execute coherence check.
|
|
347
|
+
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
nextStepFile: './step-04b-external-validators.md'
|
|
3
|
+
outputFile: '{forge_version}/test-report-{skill_name}-{run_id}.md'
|
|
4
|
+
outputFormatsFile: 'assets/output-section-formats.md'
|
|
5
|
+
scoringRulesFile: 'references/scoring-rules.md'
|
|
6
|
+
migrationSectionRules: 'references/migration-section-rules.md'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Step 4: Coherence Check
|
|
10
|
+
|
|
11
|
+
## STEP GOAL:
|
|
12
|
+
|
|
13
|
+
Validate internal consistency of the skill documentation. In contextual mode (stack skills): verify that all cross-references in SKILL.md point to real files, types match their declarations, and integration patterns are complete. In naive mode (individual skills): perform basic structural validation only.
|
|
14
|
+
|
|
15
|
+
## Rules
|
|
16
|
+
|
|
17
|
+
- Use subprocess optimization: grep for references, then per-reference deep validation
|
|
18
|
+
- For each reference in contextual mode, launch a subprocess to validate the target — do not shortcut
|
|
19
|
+
- Analysis depth is conditional on testMode (naive vs contextual)
|
|
20
|
+
|
|
21
|
+
## MANDATORY SEQUENCE
|
|
22
|
+
|
|
23
|
+
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
|
|
24
|
+
|
|
25
|
+
### 1. Check Test Mode
|
|
26
|
+
|
|
27
|
+
Read `testMode` from `{outputFile}` frontmatter.
|
|
28
|
+
|
|
29
|
+
**IF naive mode → Execute Naive Coherence (Section 2)**
|
|
30
|
+
**IF contextual mode → Execute Contextual Coherence (Sections 3-5)**
|
|
31
|
+
|
|
32
|
+
### 2. Naive Mode: Concrete Structural Validation (H1)
|
|
33
|
+
|
|
34
|
+
Perform the following explicit checks (no hand-waving — each recipe is a shell recipe or a literal pattern). Severity assignments are binding; do not relax them.
|
|
35
|
+
|
|
36
|
+
**2.1 Required sections present.** For each required top-level H2, run `grep -n "^## {section}" SKILL.md`. A required section is satisfied if **any** synonym in its set matches:
|
|
37
|
+
- Description: `## Description` OR frontmatter `description` field — either satisfies
|
|
38
|
+
- Usage: `## Usage` OR `## Examples` OR `## Quick Start` OR `## Common Workflows`
|
|
39
|
+
- API surface: `## Exports` OR `## Key API Summary` OR `## API`
|
|
40
|
+
- **Zero matches across an entire synonym set → High severity** finding: `naive-coherence — missing required section: {section-set-name}`
|
|
41
|
+
|
|
42
|
+
Note: SKF-template skills ship with `## Quick Start`, `## Common Workflows`, and `## Key API Summary`. These are first-class synonyms — do not downgrade to Low on literal-name miss; accept them.
|
|
43
|
+
|
|
44
|
+
**2.2 Code fence balance.** Count triple-backtick fences with `grep -c '^```' SKILL.md`. **Odd count → High severity** finding: `naive-coherence — unbalanced code fence (unclosed block)`.
|
|
45
|
+
|
|
46
|
+
**2.3 Language tags on opening fences.** Only **opening** fences are required to carry a language tag; closing fences are bare by markdown convention and must NOT be flagged. Do not use a plain `grep -n '^```$' SKILL.md` — that flags every closing fence and produces one false positive per well-formed code block.
|
|
47
|
+
|
|
48
|
+
Use a stateful open/close scan (toggle `in_code` on each `^```` line; flag only the line where `in_code` transitions 0→1 with no trailing language tag):
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
in_code = False
|
|
52
|
+
for i, line in enumerate(open('SKILL.md'), 1):
|
|
53
|
+
s = line.rstrip('\n')
|
|
54
|
+
if s.startswith('```'):
|
|
55
|
+
if not in_code:
|
|
56
|
+
if s == '```':
|
|
57
|
+
print(f'{i}: bare opening fence')
|
|
58
|
+
in_code = True
|
|
59
|
+
else:
|
|
60
|
+
in_code = False
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Each flagged opening fence → Medium severity** finding: `naive-coherence — opening code fence at line {N} missing language tag`.
|
|
64
|
+
|
|
65
|
+
**2.4 Exports cross-used in Usage section.** For each function name reported in the step-03 subagent inventory (`exports[].name` where `kind == "function"` or `kind == "method"`):
|
|
66
|
+
- `grep -c "{export.name}" SKILL.md` restricted to the Usage section (find the `## Usage` anchor from §2.1 and the next `^## ` anchor; count within that span).
|
|
67
|
+
- **Zero occurrences → High severity** finding: `naive-coherence — exported {kind} \`{name}\` is not referenced in the Usage section`. This catches the "documented but unused" failure mode that trivially fails discovery testing.
|
|
68
|
+
|
|
69
|
+
**2.5 Async/sync consistency.** For every export with `async` in its description prose (grep for `\basync\b` in the description segment), check the corresponding code example segment for `await` / `async` keywords:
|
|
70
|
+
- Description says async + example shows no `await` → **High severity** finding: `naive-coherence — \`{name}\` described as async but example lacks \`await\``
|
|
71
|
+
- Description says sync + example uses `await {name}` → **High severity** finding: `naive-coherence — \`{name}\` described as sync but example awaits it`
|
|
72
|
+
|
|
73
|
+
**2.6 Table syntax.** `grep -nE '^\|.*\|$' SKILL.md | head` — for each table row, normalize escaped pipes (`\|`) before splitting, then verify adjacent rows have the same column count. **Escaped pipes appear inside TypeScript union types and discriminated payloads** (e.g. `string \| undefined`) and must not inflate the count.
|
|
74
|
+
|
|
75
|
+
Recipe:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Normalize `\|` to a placeholder, split on |, count, restore.
|
|
79
|
+
grep -nE '^\|.*\|$' SKILL.md \
|
|
80
|
+
| sed 's/\\|/\x00/g' \
|
|
81
|
+
| awk -F'|' '{print NR, NF-2}' # -2 drops the empty leading/trailing fields
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or equivalent: hand off to a proper markdown-table parser. A plain `split on |` WILL produce false "column drift" findings on any table whose cells contain union types.
|
|
85
|
+
|
|
86
|
+
**Column-count drift → Medium severity** finding: `naive-coherence — table row at line {N} has {X} columns; neighboring rows have {Y}`.
|
|
87
|
+
|
|
88
|
+
**2.7 Scripts & Assets section.** If `{skillDir}/scripts/` or `{skillDir}/assets/` exists, `grep -n '^## Scripts' SKILL.md`:
|
|
89
|
+
- Directory exists AND no `## Scripts` section → **Medium severity** finding: `naive-coherence — scripts/assets directory exists but Scripts & Assets section missing` (per `{scoringRulesFile}`)
|
|
90
|
+
|
|
91
|
+
**Hard rule:** 0 findings across §§2.1–2.7 = naive coherence PASS. ≥1 finding = rerank per the severity rubric above; the count and severity list are appended to the Coherence Analysis output in §6.
|
|
92
|
+
|
|
93
|
+
Build the findings list:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"structural_issues": [
|
|
98
|
+
{"type": "missing_section", "severity": "High", "detail": "No 'Usage' section found", "line": null},
|
|
99
|
+
{"type": "unbalanced_fence", "severity": "High", "detail": "3 opening fences, 2 closing", "line": null},
|
|
100
|
+
{"type": "export_not_in_usage", "severity": "High", "detail": "exported function `formatDate` never referenced in Usage section", "line": 42},
|
|
101
|
+
{"type": "async_mismatch", "severity": "High", "detail": "`fetchData` described async but example lacks await", "line": 67}
|
|
102
|
+
],
|
|
103
|
+
"issues_found": 4
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**After naive coherence → Execute Section 2b if gate conditions met, then skip to Section 6 (Append Results)**
|
|
108
|
+
|
|
109
|
+
### 2b. Migration/Deprecation Verification (Mode-Independent)
|
|
110
|
+
|
|
111
|
+
Apply rules from `{migrationSectionRules}`. That file is the single source of
|
|
112
|
+
truth for the gate, scope, and case rules; §5b below applies the same rules on
|
|
113
|
+
the contextual path.
|
|
114
|
+
|
|
115
|
+
**After Section 2b (naive path) → Skip to Section 6 (Append Results)**
|
|
116
|
+
|
|
117
|
+
### 3. Contextual Mode: Extract References
|
|
118
|
+
|
|
119
|
+
Scan SKILL.md for all cross-references:
|
|
120
|
+
|
|
121
|
+
**Reference types to extract:**
|
|
122
|
+
- File path references (`./path/to/file.ts`, `../shared/types.ts`)
|
|
123
|
+
- Skill references (`See SKILL.md for {other-skill}`, `Integrates with {package}`)
|
|
124
|
+
- Type imports (`import { Type } from './module'`)
|
|
125
|
+
- Integration pattern references (middleware chains, plugin hooks, shared state)
|
|
126
|
+
- Script/asset references (`scripts/{file}`, `assets/{file}`) in SKILL.md body
|
|
127
|
+
|
|
128
|
+
Launch a subprocess to grep/regex SKILL.md for reference patterns and return all found references with line numbers as structured JSON (`references_found[]` with line, type, target fields). If subprocess unavailable, scan in main thread.
|
|
129
|
+
|
|
130
|
+
### 4. Contextual Mode: Validate Each Reference
|
|
131
|
+
|
|
132
|
+
DO NOT BE LAZY — For EACH reference found, launch a subprocess that:
|
|
133
|
+
|
|
134
|
+
1. Checks if the target exists (file exists, skill exists, type is declared)
|
|
135
|
+
2. If target exists, validates the reference is accurate:
|
|
136
|
+
- File path references: file exists at specified path
|
|
137
|
+
- Type imports: type is actually exported from the referenced module
|
|
138
|
+
- Skill references: referenced skill exists in skills output folder
|
|
139
|
+
- Integration patterns: documented pattern matches actual implementation
|
|
140
|
+
- Script/asset references: verify the referenced file exists in the skill's `scripts/` or `assets/` directory
|
|
141
|
+
3. Returns structured validation JSON per reference (reference, line, target_exists, type_match, signature_match, issues[])
|
|
142
|
+
|
|
143
|
+
If subprocess unavailable, validate each reference in main thread.
|
|
144
|
+
|
|
145
|
+
4. **Scripts/assets directory check:** If a `scripts/` or `assets/` directory exists alongside SKILL.md, verify that a "Scripts & Assets" section (Section 7b) is present in SKILL.md. This directory-level check applies in both modes (naive mode performs it in Section 2; contextual mode performs it here alongside per-reference validation). Flag absence as Medium severity gap per `{scoringRulesFile}`.
|
|
146
|
+
|
|
147
|
+
5. **Path containment (S8):** for every resolved reference target, compute its canonical path (`os.path.realpath`) and require that it lives inside `{skillDir}` OR inside `{source_path}` (the extraction tree recorded in metadata.json). References whose canonical path escapes both roots (e.g. `../../../etc/passwd`, absolute paths to unrelated dirs, symlink redirections outside the skill or its source) are **High severity** findings: `coherence — reference escapes skill/source sandbox: {raw_ref} → {canonical_path}`. Do NOT validate the target's contents for escaping references — the escape itself is the finding.
|
|
148
|
+
|
|
149
|
+
### 5. Contextual Mode: Check Integration Pattern Completeness
|
|
150
|
+
|
|
151
|
+
For stack skills, verify integration patterns are complete:
|
|
152
|
+
|
|
153
|
+
- **All documented integration points have corresponding code examples**
|
|
154
|
+
- **Shared types are consistently used across referenced components**
|
|
155
|
+
- **Middleware/plugin chains show complete flow, not fragments**
|
|
156
|
+
- **Event handlers reference valid event types**
|
|
157
|
+
|
|
158
|
+
Build integration completeness findings:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"patterns_documented": 5,
|
|
163
|
+
"patterns_complete": 4,
|
|
164
|
+
"incomplete_patterns": [
|
|
165
|
+
{
|
|
166
|
+
"pattern": "Auth middleware chain",
|
|
167
|
+
"issue": "Shows middleware registration but not the handler function signature",
|
|
168
|
+
"line": 95
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Zero integration patterns:** If no integration patterns are documented in SKILL.md (e.g., a contextual-mode skill that uses shared types but has no middleware chains, plugin hooks, or event flows): record `patterns_documented: 0`, `patterns_complete: 0`. The coherence score will use reference validity alone — see `{scoringRulesFile}` Coherence Score Aggregation: "If no integration patterns exist, combined coherence equals reference validity."
|
|
175
|
+
|
|
176
|
+
### 5b. Migration/Deprecation Verification (Contextual Path)
|
|
177
|
+
|
|
178
|
+
Apply rules from `{migrationSectionRules}`. Same rules as §2b — the reference
|
|
179
|
+
file is the single source of truth. Append findings to the coherence analysis
|
|
180
|
+
results.
|
|
181
|
+
|
|
182
|
+
### 5c. Calculate Coherence Scores
|
|
183
|
+
|
|
184
|
+
**Contextual mode only.** Calculate coherence percentages using the formulas defined in `{scoringRulesFile}` — Coherence Score Aggregation section:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
reference_validity = (valid_references / total_references) * 100
|
|
188
|
+
integration_completeness = (complete_patterns / total_patterns) * 100
|
|
189
|
+
combined_coherence = (reference_validity * 0.6) + (integration_completeness * 0.4)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Edge case:** If no integration patterns are documented (patterns_documented = 0), combined coherence equals reference validity alone. Do not divide by zero.
|
|
193
|
+
|
|
194
|
+
These values fill the `{percentage}%` placeholders in the output template loaded in Section 6.
|
|
195
|
+
|
|
196
|
+
### 6. Append Coherence Analysis to Output
|
|
197
|
+
|
|
198
|
+
Load `{outputFormatsFile}` and use the appropriate Coherence Analysis section format (naive or contextual) to append findings to `{outputFile}`.
|
|
199
|
+
|
|
200
|
+
### 7. Report Coherence Results
|
|
201
|
+
|
|
202
|
+
**For Naive Mode:**
|
|
203
|
+
"**Coherence check complete (naive mode).**
|
|
204
|
+
|
|
205
|
+
Basic structural validation of **{skill_name}**:
|
|
206
|
+
- {N} structural issues found
|
|
207
|
+
- Coherence category not scored (weight redistributed to coverage)
|
|
208
|
+
|
|
209
|
+
**Proceeding to external validation...**"
|
|
210
|
+
|
|
211
|
+
**For Contextual Mode:**
|
|
212
|
+
"**Coherence check complete (contextual mode).**
|
|
213
|
+
|
|
214
|
+
Reference validation of **{skill_name}**:
|
|
215
|
+
- References: {valid}/{total} valid ({percentage}%)
|
|
216
|
+
- Integration patterns: {complete}/{total} complete ({percentage}%)
|
|
217
|
+
- Combined coherence: {percentage}%
|
|
218
|
+
|
|
219
|
+
**{N} issues found** — details in Coherence Analysis section.
|
|
220
|
+
|
|
221
|
+
**Proceeding to external validation...**"
|
|
222
|
+
|
|
223
|
+
### 8. Auto-Proceed
|
|
224
|
+
|
|
225
|
+
Display: "**Proceeding to external validation...**"
|
|
226
|
+
|
|
227
|
+
#### Menu Handling Logic:
|
|
228
|
+
|
|
229
|
+
- After coherence analysis is complete, update {outputFile} frontmatter stepsCompleted, then immediately load, read entire file, then execute {nextStepFile}
|
|
230
|
+
|
|
231
|
+
#### EXECUTION RULES:
|
|
232
|
+
|
|
233
|
+
- This is an auto-proceed validation step with no user choices
|
|
234
|
+
- Proceed directly to next step after coherence is analyzed
|
|
235
|
+
|
|
236
|
+
## CRITICAL STEP COMPLETION NOTE
|
|
237
|
+
|
|
238
|
+
ONLY WHEN coherence analysis is complete (naive structural or contextual full validation), the Coherence Analysis section has been appended to {outputFile}, and coherence scores (if contextual) have been calculated, will you then load and read fully `{nextStepFile}` to execute external validation.
|
|
239
|
+
|