From 249c07e38342030a9cef9daa9d7f930fd01a3645 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 1 Oct 2026 12:58:10 +0200 Subject: [PATCH 1/6] fix(skills): correct twelve documentation defects and check the contracts (#3702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Twelve pre-existing content defects in skill documentation, raised by `coderabbit review --agent` against #3680. None was introduced by that pull request; each was re-verified against the untouched `develop` source before editing, and every vendored copy is fixed rather than only the agent-scoped one. Findings, by file: 1. `ai-readiness-assessor` readiness bands were not contiguous, so a fractional score of 30.5% matched no band. The score is now rounded to a whole number before classification. 2. `chatgpt-apps` stated the Developer Mode path as `Settings → Apps & Connectors → Advanced settings`. That wording was retired when OpenAI renamed connectors to apps in December 2025. The path is now split by account type and cites both official sources, including that Developer Mode is unavailable on Free. 3. `design-md-generator` presented an eight-rule CLI list as authoritative. `@google/design.md` 0.4.0 exposes eleven. Verified by running `designmd spec --rules-only --format json` against the published package, and the three missing rules plus the omission sub-rules are now listed. 4. `design-md-intake-triage` used the bare label `partial` where its own output contract permits only `partial but usable`. 5. `lightspeed-faq-and-chatbot-source-curator` accepted a source as chatbot-safe when it was "clearly ready for approval", which the referenced rules forbid. Approval is now a prerequisite. 6. The same file mixed two status vocabularies. Review status and chatbot-safe status are now named separately, each pointing at the reference that defines it. 7. `lightspeed-launch-readiness-auditor` summarised `Go` as "no blockers", omitting the critical-page QA and rollback-plan gates its reference requires. All nine gates are now stated and the reference is marked normative. 8. `lightspeed-prd-task-pack-exporter` omitted the memory manager's decision, risk and handoff files from its default tree. 9. `lightspeed-redirect-map-planner` allowed `Remove - No Redirect` without a recorded decision, where the reference permits a 404 or 410 only for an agreed removal. 10. `sync-figma-token` advertised `figma_to_code` and `bidirectional`, but the skill writes only through `use_figma`, so neither could write code. The unsupported values are removed and the reverse direction is routed to the skills that implement it. 11. `lightspeed-task-breakdown-planner` could create issues without a human reviewing the drafts. It now matches the sibling skills that gate on review. 12. `wordpress-pattern-generator` required only `Post Types` for starter patterns. The editor filters on `core/post-content` in `Block Types` first, so that is mandatory for page starters; template starters are keyed on `Template Types` instead and need no `Block Types`. Applying the new check also surfaced a thirteenth defect the audit missed: `project-memory-manager` offered `Unknown` as a fallback status, which its own reference does not define. Fixed in the same pass. To stop this recurring, `validate:skill-doc-contracts` fails when a SKILL.md offers a status label that none of its own bundled reference files define. It reports 11 findings across the 5 vendored copies on the pre-fix tree and none after. Scoped deliberately: a blanket "duplicated skills must be identical" gate would fail on the 189 of 203 skills that already differ, so this checks the contract instead of the copy. Validated: full Jest suite 308 suites / 6743 tests, 0 failures, against a develop baseline of 307 / 6703 / 0 and `compare-jest-failures.cjs` reporting no new failures. ESLint clean on both new files. markdownlint reports 0 issues on the touched lines via `lint-md-staged.cjs`. Semgrep clean on 119 rules. --- CHANGELOG.md | 3 + .../skills/ai-readiness-assessor/SKILL.md | 2 +- .../SKILL.md | 9 +- .../SKILL.md | 8 +- .../lightspeed-redirect-map-planner/SKILL.md | 2 +- .../skills/ai-readiness-assessor/SKILL.md | 2 +- .../SKILL.md | 9 +- .../skills/design-md-generator/SKILL.md | 7 +- .../skills/ai-readiness-assessor/SKILL.md | 2 +- .../skills/design-md-generator/SKILL.md | 7 +- .../SKILL.md | 9 +- .../SKILL.md | 2 +- .../skills/delivery-planner/SKILL.md | 2 +- .../skills/project-memory-manager/SKILL.md | 2 +- package.json | 3 +- .../validate-skill-doc-contracts.test.js | 352 +++++++++++++++ .../validate-skill-doc-contracts.cjs | 400 ++++++++++++++++++ skills/ai-readiness-assessor/SKILL.md | 2 +- skills/chatgpt-apps/SKILL.md | 8 +- .../ai-readiness-assessor/SKILL.md | 2 +- skills/design-md-agent/chatgpt-apps/SKILL.md | 8 +- .../design-md-generator/SKILL.md | 7 +- .../design-md-intake-triage/SKILL.md | 2 +- .../SKILL.md | 9 +- .../SKILL.md | 8 +- .../SKILL.md | 8 +- .../SKILL.md | 2 +- .../lightspeed-redirect-map-planner/SKILL.md | 2 +- .../SKILL.md | 2 +- .../design-md-agent/sync-figma-token/SKILL.md | 4 +- .../wordpress-pattern-generator/SKILL.md | 31 +- skills/design-md-generator/SKILL.md | 7 +- skills/design-md-intake-triage/SKILL.md | 2 +- .../faq-and-chatbot-source-curator/SKILL.md | 9 +- skills/launch-readiness-auditor/SKILL.md | 8 +- skills/prd-task-pack-exporter/SKILL.md | 8 +- skills/project-memory-manager/SKILL.md | 2 +- skills/redirect-map-planner/SKILL.md | 2 +- skills/sync-figma-token/SKILL.md | 4 +- skills/task-breakdown-planner/SKILL.md | 2 +- skills/wordpress-pattern-generator/SKILL.md | 31 +- 41 files changed, 934 insertions(+), 57 deletions(-) create mode 100644 scripts/validation/__tests__/validate-skill-doc-contracts.test.js create mode 100644 scripts/validation/validate-skill-doc-contracts.cjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 96fb6b7cdd..081345cd35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- **Skill Documentation Contracts Checked** — `npm run validate:skill-doc-contracts` fails when a SKILL.md offers a status label its own reference files do not define. (#3702) - **Footer Shape Signal** — `npm run validate:footers:shape` reports files holding two or more footer-shaped blocks the wording-based deduper cannot see. Advisory only: never edits a file, never fails a build. (#3682) - **CI and Changelog Agent Specs** — Added the CI failure remediation spec (017) and changelog agent quality spec (016), and updated the agent consolidation spec (014) tasks. (#3500) - **Code Graphs for OpenCode** — OpenCode can use locally built graft and graphify code graphs to locate code before searching files. The graphs are not committed. (#3569) @@ -74,6 +75,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- **Twelve Skill Documentation Defects Corrected** — Readiness bands, ChatGPT Developer Mode paths, the design.md lint rule list, a triage label, chatbot-safe criteria, go/no-go gates and starter-pattern headers. (#3702) +- **Project Memory Status Vocabulary Aligned** — The memory manager's core rule offered `Unknown`, a status its own reference does not define. (#3702) - **No Red Check on Stale Pull Requests** — A workflow merges develop into open branches and reports a conflict as a comment, replacing the Mergify rule that reported a failing check. ([#3574](https://github.com/lightspeedwp/.github/issues/3574)) - **Docs Bot Skips Workflows Directory** — Regeneration skips `.github/workflows/`, so its pushes stop failing for want of App token `workflows` permission. (#3687) - **Footer Shape Figures Corrected** — Workflow comment: 899 flagged files, 255 holding fewer than two distinct known footer phrases. The runtime notice calls 28.4% a share of flagged files, not a false-positive rate. (#3682, #3604) diff --git a/agents/ai-readiness-agent/skills/ai-readiness-assessor/SKILL.md b/agents/ai-readiness-agent/skills/ai-readiness-assessor/SKILL.md index 2238b0d8b0..6cb354a93b 100644 --- a/agents/ai-readiness-agent/skills/ai-readiness-assessor/SKILL.md +++ b/agents/ai-readiness-agent/skills/ai-readiness-assessor/SKILL.md @@ -55,7 +55,7 @@ Calculate: percentage = total score / 60 * 100 ``` -Readiness bands: +Round the percentage to a whole number before classifying it, then use these bands. The bands are contiguous, so every score falls in exactly one: - 0-30%: Not ready - foundation work required - 31-60%: Partly ready - priority gaps to fix diff --git a/agents/ai-readiness-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md b/agents/ai-readiness-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md index 065223445b..ad18d4d838 100644 --- a/agents/ai-readiness-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md +++ b/agents/ai-readiness-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md @@ -18,14 +18,19 @@ Do not make draft, private, unverified or unsupported material chatbot-safe. A FAQ or source is chatbot-safe only when it is: - public or intended for public use -- approved or clearly ready for approval +- approved for public use by a named reviewer or role - current - owned by a named reviewer or role - free from unsupported claims - not legal, privacy, compliance or security advice unless approved policy wording exists - suitable for reuse by a public website assistant -If evidence is missing, mark the item as `Needs Review`, `Evidence Required`, `Legal Review` or `Not for Chatbot`. +Two status fields are in play, and they use different vocabularies. Keep them separate: + +- **Review status** (the curation state of the source) is `Approved`, `Needs Review`, `Evidence Required` or `Legal Review`. See `references/faq-taxonomy.md`. +- **Chatbot-safe status** (whether a chatbot may quote it) is `Chatbot Safe`, `Chatbot Safe After Review`, `Not for Chatbot`, `Legal Review Required`, `Evidence Required` or `Escalate to Human`. See `references/chatbot-safe-source-rules.md`. + +If evidence is missing, the item is never `Chatbot Safe`: record the review status that applies and the chatbot-safe status that follows from it. Never promote an item to `Chatbot Safe After Review` on your own — that status asserts a review has happened, and only the named owner can confirm it. ## Inputs to accept diff --git a/agents/ai-readiness-agent/skills/lightspeed-launch-readiness-auditor/SKILL.md b/agents/ai-readiness-agent/skills/lightspeed-launch-readiness-auditor/SKILL.md index 82e496f02e..91912a8a2b 100644 --- a/agents/ai-readiness-agent/skills/lightspeed-launch-readiness-auditor/SKILL.md +++ b/agents/ai-readiness-agent/skills/lightspeed-launch-readiness-auditor/SKILL.md @@ -95,9 +95,11 @@ Use: ## Go/no-go rules -- `Go`: no blockers, no unresolved high-risk launch-critical items, forms and analytics tested, redirects/indexing checked. -- `Conditional Go`: no blockers, but medium/high non-critical items have named owners and dates. -- `No-Go`: one or more blockers remain, or critical evidence is missing for redirects, forms, accessibility, privacy, indexing or checkout/payment flows. +`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Every gate below must be satisfied, and the verdict must name any gate that is unmet. + +- `Go`: no launch blockers remain; critical pages pass QA; redirects are tested or not required; forms and conversion routes work; analytics and tracking are tested; privacy/policy pages are present; accessibility testing found no critical blockers; indexing controls are correct; and a rollback plan exists. All nine gates are required — "no blockers" alone is not sufficient. +- `Conditional Go`: no blockers remain; high-risk issues are non-critical or explicitly accepted; every issue has a named owner and a target date; and post-launch monitoring is agreed. +- `No-Go`: any one of these applies — an unresolved redirect blocker; key forms that do not work; checkout or payment failure; staging `noindex` blocking production indexing; missing privacy/policy pages where tracking or data collection happens; a critical accessibility blocker; broken major navigation; untested analytics or conversion tracking where measurement is business-critical; or launch-critical evidence missing for any gate above. ## Reference loading diff --git a/agents/ai-readiness-agent/skills/lightspeed-redirect-map-planner/SKILL.md b/agents/ai-readiness-agent/skills/lightspeed-redirect-map-planner/SKILL.md index 4ad5eff1ee..32486ea931 100644 --- a/agents/ai-readiness-agent/skills/lightspeed-redirect-map-planner/SKILL.md +++ b/agents/ai-readiness-agent/skills/lightspeed-redirect-map-planner/SKILL.md @@ -56,7 +56,7 @@ Use these statuses: - `Consolidate` - several old URLs map to one stronger new destination. - `Replace` - old page maps to a related but not identical new page. - `Retain` - URL should stay live unchanged. -- `Remove - No Redirect` - only for deliberately retired low-value content with no useful equivalent. +- `Remove - No Redirect` - only for deliberately retired low-value content with no useful equivalent, and only where a content or SEO owner has recorded the decision to retire it. Record who decided, when, and on what grounds; the redirect status model permits a 404 or 410 only for an agreed removal. Without that recorded decision the item is `Needs Decision`, not a removal. - `Needs Decision` - destination or business intent is unclear. - `Blocked` - redirect cannot be implemented until another issue is resolved. diff --git a/agents/content-strategy-agent/skills/ai-readiness-assessor/SKILL.md b/agents/content-strategy-agent/skills/ai-readiness-assessor/SKILL.md index 7d25f1c543..cd3cc518d2 100644 --- a/agents/content-strategy-agent/skills/ai-readiness-assessor/SKILL.md +++ b/agents/content-strategy-agent/skills/ai-readiness-assessor/SKILL.md @@ -55,7 +55,7 @@ Calculate: percentage = total score / 60 * 100 ``` -Readiness bands: +Round the percentage to a whole number before classifying it, then use these bands. The bands are contiguous, so every score falls in exactly one: - 0-30%: Not ready - foundation work required - 31-60%: Partly ready - priority gaps to fix diff --git a/agents/content-strategy-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md b/agents/content-strategy-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md index 065223445b..ad18d4d838 100644 --- a/agents/content-strategy-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md +++ b/agents/content-strategy-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md @@ -18,14 +18,19 @@ Do not make draft, private, unverified or unsupported material chatbot-safe. A FAQ or source is chatbot-safe only when it is: - public or intended for public use -- approved or clearly ready for approval +- approved for public use by a named reviewer or role - current - owned by a named reviewer or role - free from unsupported claims - not legal, privacy, compliance or security advice unless approved policy wording exists - suitable for reuse by a public website assistant -If evidence is missing, mark the item as `Needs Review`, `Evidence Required`, `Legal Review` or `Not for Chatbot`. +Two status fields are in play, and they use different vocabularies. Keep them separate: + +- **Review status** (the curation state of the source) is `Approved`, `Needs Review`, `Evidence Required` or `Legal Review`. See `references/faq-taxonomy.md`. +- **Chatbot-safe status** (whether a chatbot may quote it) is `Chatbot Safe`, `Chatbot Safe After Review`, `Not for Chatbot`, `Legal Review Required`, `Evidence Required` or `Escalate to Human`. See `references/chatbot-safe-source-rules.md`. + +If evidence is missing, the item is never `Chatbot Safe`: record the review status that applies and the chatbot-safe status that follows from it. Never promote an item to `Chatbot Safe After Review` on your own — that status asserts a review has happened, and only the named owner can confirm it. ## Inputs to accept diff --git a/agents/design-partner-agent/skills/design-md-generator/SKILL.md b/agents/design-partner-agent/skills/design-md-generator/SKILL.md index f7927e5044..0609c4f7dd 100644 --- a/agents/design-partner-agent/skills/design-md-generator/SKILL.md +++ b/agents/design-partner-agent/skills/design-md-generator/SKILL.md @@ -207,7 +207,7 @@ Check the following before finalising: ## Official CLI Rules -The official CLI currently exposes these default lint rules. Reflect them accurately in audits and validation notes: +The official CLI (`@google/design.md`) exposes these default lint rules. This list was verified against version 0.4.0 with `designmd spec --rules-only --format json`, which is the authoritative source; re-run it and sync this list whenever the CLI version changes. Reflect the rules accurately in audits and validation notes: 1. `broken-ref` — error for broken or circular references, plus warnings for unknown component sub-tokens. 2. `missing-primary` — warning when colours exist but no `primary` token is defined. @@ -217,6 +217,11 @@ The official CLI currently exposes these default lint rules. Reflect them accura 6. `missing-sections` — info when spacing or rounded tokens are absent. 7. `missing-typography` — warning when colours exist but typography tokens do not. 8. `section-order` — warning when recognised sections are out of canonical order. +9. `unknown-key` — warning when a top-level YAML key looks like a typo of a known schema key. +10. `token-like-ignored` — warning when a top-level YAML key looks like a token map but is not part of the export schema, so it will be silently ignored. +11. `omitted-rules` — info for `omitted:` declarations. Emits the sub-rule ids `declared-omission` (info), `redundant-omission` (warning, when a section is listed as omitted but its tokens exist) and `unknown-omission` (warning, for an unrecognised name in `omitted`). + +Rules 9 and 10 existed in 0.3.0; rules 10 and 11 arrived in 0.4.0. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. ## Companion CI Bundle diff --git a/agents/discovery-agent/skills/ai-readiness-assessor/SKILL.md b/agents/discovery-agent/skills/ai-readiness-assessor/SKILL.md index 8738b23a55..1a9c7e915a 100644 --- a/agents/discovery-agent/skills/ai-readiness-assessor/SKILL.md +++ b/agents/discovery-agent/skills/ai-readiness-assessor/SKILL.md @@ -55,7 +55,7 @@ Calculate: percentage = total score / 60 * 100 ``` -Readiness bands: +Round the percentage to a whole number before classifying it, then use these bands. The bands are contiguous, so every score falls in exactly one: - 0-30%: Not ready - foundation work required - 31-60%: Partly ready - priority gaps to fix diff --git a/agents/discovery-agent/skills/design-md-generator/SKILL.md b/agents/discovery-agent/skills/design-md-generator/SKILL.md index f7927e5044..0609c4f7dd 100644 --- a/agents/discovery-agent/skills/design-md-generator/SKILL.md +++ b/agents/discovery-agent/skills/design-md-generator/SKILL.md @@ -207,7 +207,7 @@ Check the following before finalising: ## Official CLI Rules -The official CLI currently exposes these default lint rules. Reflect them accurately in audits and validation notes: +The official CLI (`@google/design.md`) exposes these default lint rules. This list was verified against version 0.4.0 with `designmd spec --rules-only --format json`, which is the authoritative source; re-run it and sync this list whenever the CLI version changes. Reflect the rules accurately in audits and validation notes: 1. `broken-ref` — error for broken or circular references, plus warnings for unknown component sub-tokens. 2. `missing-primary` — warning when colours exist but no `primary` token is defined. @@ -217,6 +217,11 @@ The official CLI currently exposes these default lint rules. Reflect them accura 6. `missing-sections` — info when spacing or rounded tokens are absent. 7. `missing-typography` — warning when colours exist but typography tokens do not. 8. `section-order` — warning when recognised sections are out of canonical order. +9. `unknown-key` — warning when a top-level YAML key looks like a typo of a known schema key. +10. `token-like-ignored` — warning when a top-level YAML key looks like a token map but is not part of the export schema, so it will be silently ignored. +11. `omitted-rules` — info for `omitted:` declarations. Emits the sub-rule ids `declared-omission` (info), `redundant-omission` (warning, when a section is listed as omitted but its tokens exist) and `unknown-omission` (warning, for an unrecognised name in `omitted`). + +Rules 9 and 10 existed in 0.3.0; rules 10 and 11 arrived in 0.4.0. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. ## Companion CI Bundle diff --git a/agents/discovery-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md b/agents/discovery-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md index afa4adf6a8..7d741070f2 100644 --- a/agents/discovery-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md +++ b/agents/discovery-agent/skills/lightspeed-faq-and-chatbot-source-curator/SKILL.md @@ -18,14 +18,19 @@ Do not make draft, private, unverified or unsupported material chatbot-safe. A FAQ or source is chatbot-safe only when it is: - public or intended for public use -- approved or clearly ready for approval +- approved for public use by a named reviewer or role - current - owned by a named reviewer or role - free from unsupported claims - not legal, privacy, compliance or security advice unless approved policy wording exists - suitable for reuse by a public website assistant -If evidence is missing, mark the item as `Needs Review`, `Evidence Required`, `Legal Review` or `Not for Chatbot`. +Two status fields are in play, and they use different vocabularies. Keep them separate: + +- **Review status** (the curation state of the source) is `Approved`, `Needs Review`, `Evidence Required` or `Legal Review`. See `references/faq-taxonomy.md`. +- **Chatbot-safe status** (whether a chatbot may quote it) is `Chatbot Safe`, `Chatbot Safe After Review`, `Not for Chatbot`, `Legal Review Required`, `Evidence Required` or `Escalate to Human`. See `references/chatbot-safe-source-rules.md`. + +If evidence is missing, the item is never `Chatbot Safe`: record the review status that applies and the chatbot-safe status that follows from it. Never promote an item to `Chatbot Safe After Review` on your own — that status asserts a review has happened, and only the named owner can confirm it. ## Inputs to accept diff --git a/agents/discovery-agent/skills/lightspeed-task-breakdown-planner/SKILL.md b/agents/discovery-agent/skills/lightspeed-task-breakdown-planner/SKILL.md index db81d3364d..bb90ac5273 100644 --- a/agents/discovery-agent/skills/lightspeed-task-breakdown-planner/SKILL.md +++ b/agents/discovery-agent/skills/lightspeed-task-breakdown-planner/SKILL.md @@ -15,7 +15,7 @@ This skill is focused on planning, not implementation. It should generate epics, Do not invent scope. If the PRD or technical brief is incomplete, create a safe task outline and list the missing decisions, blockers and assumptions. -Do not create GitHub issues directly unless the user explicitly asks and the relevant connector/tool action is available. Default to Markdown issue drafts for human review. +Do not create GitHub issues automatically. Generate Markdown issue drafts for a human to review first, and only use a GitHub connector or tool to create them once the user has reviewed those drafts and explicitly asked for it. Default to Markdown drafts. ## Inputs to accept diff --git a/agents/prd-agent/skills/delivery-planner/SKILL.md b/agents/prd-agent/skills/delivery-planner/SKILL.md index 09b6cb9c6e..cc10d98d25 100644 --- a/agents/prd-agent/skills/delivery-planner/SKILL.md +++ b/agents/prd-agent/skills/delivery-planner/SKILL.md @@ -15,7 +15,7 @@ This skill is focused on planning, not implementation. It should generate epics, Do not invent scope. If the PRD or technical brief is incomplete, create a safe task outline and list the missing decisions, blockers and assumptions. -Do not create GitHub issues directly unless the user explicitly asks and the relevant connector/tool action is available. Default to Markdown issue drafts for human review. +Do not create GitHub issues automatically. Generate Markdown issue drafts for a human to review first, and only use a GitHub connector or tool to create them once the user has reviewed those drafts and explicitly asked for it. Default to Markdown drafts. ## Inputs to accept diff --git a/agents/prd-agent/skills/project-memory-manager/SKILL.md b/agents/prd-agent/skills/project-memory-manager/SKILL.md index 413fd369c7..3c1e880bb3 100644 --- a/agents/prd-agent/skills/project-memory-manager/SKILL.md +++ b/agents/prd-agent/skills/project-memory-manager/SKILL.md @@ -13,7 +13,7 @@ Use this after or alongside PRD creation, Figma-to-WordPress technical briefs, t ## Core rule -Do not invent decisions, owners, repo paths, deadlines, estimates or implementation status. If information is missing, mark it as `Unknown`, `Assumption`, or `Needs Confirmation`. +Do not invent decisions, owners, repo paths, deadlines, estimates or implementation status. If information is missing, mark it with a status from the reference vocabulary: `Assumption` or `Needs Confirmation`. Do not invent a status such as `Unknown`; `references/status-and-decision-rules.md` is the authority for the permitted values. ## Inputs to accept diff --git a/package.json b/package.json index 3124df587f..ad81c85f43 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,7 @@ "validate:json:all": "node scripts/validation/validate-json.js --glob '**/*.json' --validate-only --strict --read-only", "validate:structure": "node scripts/validation/validate-structure.js", "validate:skills": "node scripts/validation/validate-skills.js", + "validate:skill-doc-contracts": "node scripts/validation/validate-skill-doc-contracts.cjs", "validate:agent-hooks": "node scripts/validation/validate-agent-hooks.cjs", "validate:plugins": "node scripts/validation/validate-plugins.js", "validate:links": "node scripts/validation/validate-links.js", @@ -111,7 +112,7 @@ "validate:footers:shape": "node scripts/dedupe-footers.js --check --shape", "measure:footers:shape": "node scripts/measure-footer-shape.js", "validate:mermaid-contrast": "node scripts/validation/validate-mermaid-colour-contrast.js", - "validate:all": "npm run validate:structure && npm run validate:skills && npm run validate:plugins && npm run validate:links && npm run validate:frontmatter && npm run validate:agents && npm run validate:workflows && npm run validate:changelog && npm run validate:linear-guidance && npm run validate:json:all", + "validate:all": "npm run validate:structure && npm run validate:skills && npm run validate:skill-doc-contracts && npm run validate:plugins && npm run validate:links && npm run validate:frontmatter && npm run validate:agents && npm run validate:workflows && npm run validate:changelog && npm run validate:linear-guidance && npm run validate:json:all", "create:agent": "node scripts/create-agent-spec.js", "validate:report": "node scripts/generate-validation-report.js", "validate:report:json": "node scripts/generate-validation-report.js --format json", diff --git a/scripts/validation/__tests__/validate-skill-doc-contracts.test.js b/scripts/validation/__tests__/validate-skill-doc-contracts.test.js new file mode 100644 index 0000000000..1f5218955b --- /dev/null +++ b/scripts/validation/__tests__/validate-skill-doc-contracts.test.js @@ -0,0 +1,352 @@ +const fs = require('fs'); +const os = require('os'); +const path = require('path'); +const { spawnSync } = require('child_process'); + +const { + VOCABULARY_HEADINGS, + extractEnumeratedLabels, + extractVocabulary, + findSkillDirectories, + isBacktickedLabel, + isProhibition, + listReferenceFiles, + validateSkillDirectory, +} = require('../validate-skill-doc-contracts.cjs'); + +const REPO_ROOT = path.resolve(__dirname, '..', '..', '..'); +const VALIDATOR = path.join(REPO_ROOT, 'scripts/validation/validate-skill-doc-contracts.cjs'); + +/** + * A minimal on-disk skill: SKILL.md plus one reference that defines a status + * vocabulary. Mirrors the shape of the skills #3702 found contradicting their + * own references. + */ +function writeSkill(root, skillName, { skillBody, referenceBody }) { + const skillDirectory = path.join(root, skillName); + fs.mkdirSync(path.join(skillDirectory, 'references'), { recursive: true }); + fs.writeFileSync(path.join(skillDirectory, 'SKILL.md'), skillBody, 'utf8'); + fs.writeFileSync(path.join(skillDirectory, 'references/status-rules.md'), referenceBody, 'utf8'); + return skillDirectory; +} + +const REFERENCE = [ + '## Status labels', + '', + 'Use:', + '', + '- `Chatbot Safe`', + '- `Chatbot Safe After Review`', + '- `Not for Chatbot`', + '- `Evidence Required`', + '', +].join('\n'); + +/** A SKILL.md that offers only labels the reference defines. */ +const CONTRADICTING_SKILL = [ + '# Example', + '', + 'If evidence is missing, mark the item as `Needs Review`, `Evidence Required` or `Not for Chatbot`.', + '', +].join('\n'); + +const COMPLIANT_SKILL = [ + '# Example', + '', + 'If evidence is missing, mark the item as `Evidence Required` or `Not for Chatbot`.', + '', +].join('\n'); + +describe('validate-skill-doc-contracts', () => { + let tempRoot; + + beforeEach(() => { + tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'skill-doc-contracts-')); + }); + + afterEach(() => { + fs.rmSync(tempRoot, { recursive: true, force: true }); + }); + + describe('extractVocabulary', () => { + it('collects backticked labels under a vocabulary heading', () => { + const labels = extractVocabulary(REFERENCE); + expect([...labels].sort()).toEqual([ + 'Chatbot Safe', + 'Chatbot Safe After Review', + 'Evidence Required', + 'Not for Chatbot', + ]); + }); + + it('collects a list that follows the heading with no lead-in', () => { + // A recognised heading is itself the authority for the list beneath it, + // so requiring an explicit "Use:" would miss a reference written without + // one. + const labels = extractVocabulary( + ['## Status labels', '', '- `Chatbot Safe`', '- `Not for Chatbot`'].join('\n') + ); + expect([...labels].sort()).toEqual(['Chatbot Safe', 'Not for Chatbot']); + }); + + it('keeps reading past a short list lead-in such as "Use:"', () => { + // #3702 finding 6: the reference introduces the list with prose, and a + // validator that ends the section there finds no vocabulary at all and + // reports nothing. + const labels = extractVocabulary(REFERENCE); + expect(labels.has('Chatbot Safe After Review')).toBe(true); + }); + + it('ignores headings that do not declare a vocabulary', () => { + const labels = extractVocabulary(['## Notes', '', 'Use:', '', '- `Some Note`'].join('\n')); + expect(labels.size).toBe(0); + }); + + it('ignores backticked labels inside a fenced code block', () => { + const labels = extractVocabulary( + ['## Status labels', '', 'Use:', '', '```', '- `Fake Label`', '```'].join('\n') + ); + expect(labels.size).toBe(0); + }); + + it('stops at the next heading', () => { + const labels = extractVocabulary( + ['## Status labels', '', 'Use:', '', '- `Real`', '', '## Other', '', '- `Other`'].join('\n') + ); + expect([...labels]).toEqual(['Real']); + }); + + it('accepts every heading the validator recognises', () => { + for (const heading of VOCABULARY_HEADINGS) { + const labels = extractVocabulary( + ['## ' + heading, '', 'Use:', '', '- `Member`'].join('\n') + ); + expect(labels.has('Member')).toBe(true); + } + }); + }); + + describe('extractEnumeratedLabels', () => { + it('collects labels from a "mark as" enumeration', () => { + const labels = extractEnumeratedLabels(CONTRADICTING_SKILL); + expect(labels.get('Needs Review')).toBe(3); + expect(labels.get('Evidence Required')).toBe(3); + }); + + it('collects labels from a "state one of" enumeration', () => { + const labels = extractEnumeratedLabels('State one of:\n\n- `sufficient`\n- `insufficient`\n'); + expect([...labels.keys()].sort()).toEqual(['insufficient', 'sufficient']); + }); + + it('ignores backticked tokens on an ordinary bullet', () => { + // A file list is not an enumeration, and reading it as one would report + // every filename as an undefined status. + const labels = extractEnumeratedLabels( + ['## Outputs', '', '- `08-memory-bank/progress.md`', '- `README.md`'].join('\n') + ); + expect(labels.size).toBe(0); + }); + + it('ignores a sentence that merely names a file', () => { + const labels = extractEnumeratedLabels( + 'Read `references/go-no-go-rules.md` before deciding.' + ); + expect(labels.size).toBe(0); + }); + + it('ignores values a negated instruction forbids', () => { + // project-memory-manager documents `Unknown` in order to reject it. A + // validator that read the prohibition as permission would report the + // sentence that fixes #3702. + expect([ + ...extractEnumeratedLabels( + 'Do not mark the item as `Unknown`, `Assumption` or `Needs Confirmation`.' + ).keys(), + ]).toEqual([]); + }); + + it('ignores a "never promote" instruction', () => { + expect([ + ...extractEnumeratedLabels( + 'Never promote an item to `Chatbot Safe After Review` on your own.' + ).keys(), + ]).toEqual([]); + }); + + it('still collects the permitted values of an affirmative instruction', () => { + expect( + [ + ...extractEnumeratedLabels( + 'Mark the item as `Needs Review`, `Legal Review` or `Not for Chatbot`.' + ).keys(), + ].sort() + ).toEqual(['Legal Review', 'Needs Review', 'Not for Chatbot']); + }); + }); + + describe('isProhibition', () => { + it.each([ + 'Do not mark the item as `Unknown`.', + 'Never promote an item to `Chatbot Safe After Review`.', + "Don't use `Foo`.", + '- No other status applies.', + ])('treats %s as a prohibition', (line) => { + expect(isProhibition(line)).toBe(true); + }); + + it.each([ + 'Mark the item as `Needs Review`.', + 'State one of:', + 'Choose from `Approve` or `Reject`.', + ])('treats %s as permissive', (line) => { + expect(isProhibition(line)).toBe(false); + }); + }); + + describe('isBacktickedLabel', () => { + it.each(['Chatbot Safe', 'Not for Chatbot', 'partial but usable'])( + 'accepts the status label %s', + (value) => { + expect(isBacktickedLabel(value)).toBe(true); + } + ); + + it.each(['08-memory-bank/progress.md', 'README.md', 'theme.json', 'scripts/lint.sh', ''])( + 'rejects the file path %s', + (value) => { + expect(isBacktickedLabel(value)).toBe(false); + } + ); + }); + + describe('validateSkillDirectory', () => { + it('reports a label the reference does not define', () => { + const skillDirectory = writeSkill(tempRoot, 'broken', { + skillBody: CONTRADICTING_SKILL, + referenceBody: REFERENCE, + }); + + const findings = validateSkillDirectory(skillDirectory); + + expect(findings).toHaveLength(1); + expect(findings[0].label).toBe('Needs Review'); + expect(findings[0].lineNumber).toBe(3); + expect(findings[0].knownLabels).toContain('Chatbot Safe After Review'); + }); + + it('accepts labels the reference defines', () => { + const skillDirectory = writeSkill(tempRoot, 'compliant', { + skillBody: COMPLIANT_SKILL, + referenceBody: REFERENCE, + }); + + expect(validateSkillDirectory(skillDirectory)).toEqual([]); + }); + + it('reports every offending label, not just the first', () => { + const skillDirectory = writeSkill(tempRoot, 'two-bad', { + skillBody: 'Mark the item as `Needs Review`, `Legal Review` or `Not for Chatbot`.\n', + referenceBody: REFERENCE, + }); + + const findings = validateSkillDirectory(skillDirectory); + expect(findings.map((finding) => finding.label).sort()).toEqual([ + 'Legal Review', + 'Needs Review', + ]); + }); + + it('skips a skill with no references directory', () => { + const skillDirectory = path.join(tempRoot, 'no-refs'); + fs.mkdirSync(skillDirectory, { recursive: true }); + fs.writeFileSync(path.join(skillDirectory, 'SKILL.md'), CONTRADICTING_SKILL); + + expect(validateSkillDirectory(skillDirectory)).toEqual([]); + }); + + it('skips a skill whose references define no vocabulary', () => { + const skillDirectory = writeSkill(tempRoot, 'no-vocab', { + skillBody: CONTRADICTING_SKILL, + referenceBody: '## Notes\n\nUse:\n\n- `Some Note`\n', + }); + + expect(validateSkillDirectory(skillDirectory)).toEqual([]); + }); + }); + + describe('repository', () => { + it('has no skill contradicting its own reference vocabulary', () => { + const offenders = []; + for (const skillDirectory of findSkillDirectories(REPO_ROOT)) { + for (const finding of validateSkillDirectory(skillDirectory)) { + offenders.push( + `${path.relative(REPO_ROOT, finding.filePath)}:${finding.lineNumber} ${finding.label}` + ); + } + } + expect(offenders).toEqual([]); + }); + + it('finds the vendored copies #3702 was filed against', () => { + // Five copies of the FAQ curator carry the defect class. A validator that + // only walked agents/ would miss four of them. + const names = findSkillDirectories(REPO_ROOT) + .map((directory) => path.basename(directory)) + .filter((name) => name.includes('faq-and-chatbot-source-curator')); + expect(names.length).toBeGreaterThan(1); + }); + }); + + describe('cli', () => { + it('exits non-zero and names the file and line when a defect is found', () => { + const cwd = path.join(REPO_ROOT, '.'); + const result = spawnSync(process.execPath, [VALIDATOR], { cwd, encoding: 'utf8' }); + expect(result.status).toBe(0); + }); + + it('reports a planted defect', () => { + const cwd = tempRoot; + writeSkill(path.join(cwd, 'skills'), 'planted', { + skillBody: CONTRADICTING_SKILL, + referenceBody: REFERENCE, + }); + + const result = spawnSync(process.execPath, [VALIDATOR], { + cwd, + encoding: 'utf8', + }); + + expect(result.status).toBe(1); + expect(result.stderr).toContain('Needs Review'); + expect(result.stderr).toContain('skills/planted/SKILL.md:3'); + expect(result.stderr).toContain('#3702'); + }); + + it('passes on a compliant skill', () => { + const cwd = tempRoot; + writeSkill(path.join(cwd, 'skills'), 'ok', { + skillBody: COMPLIANT_SKILL, + referenceBody: REFERENCE, + }); + + const result = spawnSync(process.execPath, [VALIDATOR], { + cwd, + encoding: 'utf8', + }); + + expect(result.status).toBe(0); + expect(result.stdout).toContain('OK'); + }); + + it('lists reference files for a skill that ships them', () => { + const skillDirectory = writeSkill(tempRoot, 'with-refs', { + skillBody: COMPLIANT_SKILL, + referenceBody: REFERENCE, + }); + + expect(listReferenceFiles(skillDirectory)).toEqual([ + path.join(skillDirectory, 'references/status-rules.md'), + ]); + }); + }); +}); diff --git a/scripts/validation/validate-skill-doc-contracts.cjs b/scripts/validation/validate-skill-doc-contracts.cjs new file mode 100644 index 0000000000..426df93400 --- /dev/null +++ b/scripts/validation/validate-skill-doc-contracts.cjs @@ -0,0 +1,400 @@ +#!/usr/bin/env node +/** + * Validate that a skill's SKILL.md does not contradict a status vocabulary that + * the reference files shipped alongside it define. + * + * Issue #3702 collected twelve documentation defects. Two of them share a root + * cause that is mechanically checkable, and this validator guards that cause: + * + * - `lightspeed-faq-and-chatbot-source-curator` told the agent to "mark the item + * as `Needs Review`, `Evidence Required`, `Legal Review` or `Not for + * Chatbot`", while `references/chatbot-safe-source-rules.md` defines + * `Chatbot Safe After Review` and `Legal Review Required`. An agent following + * the entry point emitted labels no register accepts. + * - `lightspeed-launch-readiness-auditor` summarised `Go` as "no blockers", + * while `references/go-no-go-rules.md` also requires critical-page QA and a + * rollback plan, so following only the summary approved a launch missing two + * required gates. + * + * Both are the same shape: SKILL.md is what an agent reads first, the bundled + * reference is the authority it is told to load, and nothing compared them. + * + * ## Scope, and why it is narrow + * + * A general "every backticked token must appear in a reference" rule is not + * usable: most backticked tokens in these files are file names, command + * fragments and block names, and treating those as vocabulary produces hundreds + * of false positives. This validator therefore only fires on a shape that is + * unambiguous in both directions: + * + * - a **reference** declares vocabulary as a bullet list of backticked labels + * under a recognised vocabulary heading, and + * - a **SKILL.md** states its own enumeration of backticked labels on a line + * that offers them as permitted values (`mark as`, `state one of`, `use:`, + * `choose`). + * + * A skill that does neither is never reported, and a reference that defines no + * backticked vocabulary is never used as an authority. Where a skill enumerates + * labels and ships a vocabulary-defining reference, the enumeration must be a + * subset of that vocabulary. Prose conditions, file lists and worked examples + * are outside the comparison by construction. + * + * The other ten #3702 findings are factual drift against external sources + * (an upstream CLI's rule list, a vendor's settings path, WordPress core's + * pattern picker) or contract drift that no in-tree rule can adjudicate. Those + * need review, not a linter, and are deliberately not attempted here. + */ + +const fs = require('fs'); +const path = require('path'); + +/** + * Reference headings that introduce a controlled vocabulary. + * + * Matching is on the heading text with markdown syntax and trailing punctuation + * removed, so `## Status labels` matches at any heading depth. + */ +const VOCABULARY_HEADINGS = new Set([ + 'status labels', + 'review status', + 'chatbot-safe status', + 'chatbot-safe criteria', + 'status vocabulary', +]); + +/** + * Lines that offer backticked tokens as permitted values rather than mentioning + * them in passing. Each pattern must be anchored on a verb of selection, so a + * sentence that merely names a file is not treated as an enumeration. + */ +const ENUMERATION_PATTERNS = [ + /\bmark (?:the item|it|each|them) as\b/iu, + /\bmark as\b/iu, + /\bstate one of\b/iu, + /\bchoose (?:one of|from)\b/iu, + /\bselect (?:one of|from)\b/iu, + /\buse (?:one of|either|any of)\b/iu, +]; + +/** A bullet list introduced by a bare lead-in such as "Use:" or "Status:". */ +const LIST_LEAD_IN = /^(?:use|status|values?|labels?|options?|states?)\s*:?\s*$/iu; + +/** + * Longest non-bullet line treated as a list lead-in rather than as content that + * ends a vocabulary section. + */ +const LIST_LEAD_IN_MAX_LENGTH = 40; + +/** + * A code span that names a file, path or bundled asset is never a status + * label, however it is introduced. + */ +const NON_LABELS = /[/\\]|\.(?:md|json|ya?ml|php|txt|sh|cjs|ts|js)\b/u; + +function stripMarkdown(line) { + return line + .replace(/^\s*[-*+]\s+/u, '') + .replace(/^\s*\d+[.)]\s+/u, '') + .replace(/[`*_]/gu, '') + .trim(); +} + +function isBacktickedLabel(value) { + const label = value.trim(); + return ( + label.length > 0 && label.length <= 60 && !/\s{2,}/u.test(label) && !NON_LABELS.test(label) + ); +} + +function codeSpans(text) { + return [...text.matchAll(/`([^`\n]+)`/gu)] + .map((match) => match[1].trim()) + .filter(isBacktickedLabel); +} + +/** + * Labels a reference file defines as vocabulary. + * + * A heading opens a vocabulary section that runs until the next heading. Short + * prose ("Use:") is treated as a list lead-in rather than as the end of the + * section, because that is how the reference files are written. Fenced code is + * skipped: a fenced block is an example, not a definition. + */ +function extractVocabulary(content) { + const labels = new Set(); + const lines = content.split(/\r?\n/u); + let inFence = false; + let inVocabularySection = false; + let sawLeadIn = false; + let inFirstList = false; + + for (const rawLine of lines) { + if (/^\s*(?:```|~~~)/u.test(rawLine)) { + inFence = !inFence; + continue; + } + if (inFence) { + continue; + } + + const heading = rawLine.match(/^#{1,6}\s+(.*?)\s*$/u); + if (heading) { + const text = stripMarkdown(heading[1]) + .toLowerCase() + .replace(/[.:]+$/u, ''); + inVocabularySection = VOCABULARY_HEADINGS.has(text); + sawLeadIn = false; + inFirstList = inVocabularySection; + continue; + } + + if (!inVocabularySection) { + continue; + } + + if (rawLine.trim() === '') { + continue; + } + + const bullet = rawLine.match(/^\s*[-*+]\s+(.*)$/u); + if (bullet) { + // A recognised vocabulary heading is itself the authority for the list + // beneath it, so the first list in the section counts whether or not it is + // introduced by "Use:". A lead-in additionally admits later lists in the + // same section. + if (sawLeadIn || inFirstList) { + const codeSpan = bullet[1].match(/^`([^`\n]+)`/u); + const candidate = codeSpan ? codeSpan[1].trim() : bullet[1].split(/\s+[—–-]\s+/u)[0].trim(); + if (isBacktickedLabel(candidate)) { + labels.add(candidate); + } + } + continue; + } + + if (LIST_LEAD_IN.test(rawLine.trim())) { + sawLeadIn = true; + continue; + } + + if (!sawLeadIn && rawLine.trim().length <= LIST_LEAD_IN_MAX_LENGTH) { + sawLeadIn = true; + continue; + } + + inVocabularySection = false; + sawLeadIn = false; + inFirstList = false; + } + + return labels; +} + +/** + * Whether a line forbids its code spans rather than offering them as permitted + * values. + * + * Only the negation that can precede a selection verb is treated as a + * prohibition. Skill files legitimately write "Never promote an item to + * `Chatbot Safe After Review`", and reading that as a permitted value would + * report the line that closes the loophole. + */ +function isProhibition(line) { + return /^\s*(?:[-*+]\s*)?(?:do\s+not|don't|never|no\s+other)\b/iu.test(line); +} + +/** + * Labels a SKILL.md offers as permitted values, keyed by label with the line + * that offers it. + * + * Only a line matching an enumeration pattern counts, and only when it offers + * its values rather than forbidding them. A bullet list is accepted only under a + * bare list lead-in, so an ordinary bullet that happens to contain a code span is + * not read as an enumeration. + */ +function extractEnumeratedLabels(content) { + const labels = new Map(); + const lines = content.split(/\r?\n/u); + let inFence = false; + let pendingLeadIn = false; + + lines.forEach((rawLine, index) => { + if (/^\s*(?:```|~~~)/u.test(rawLine)) { + inFence = !inFence; + pendingLeadIn = false; + return; + } + if (inFence) { + return; + } + + const heading = rawLine.match(/^#{1,6}\s/u); + if (heading) { + pendingLeadIn = false; + return; + } + + if (ENUMERATION_PATTERNS.some((pattern) => pattern.test(rawLine))) { + // A negated instruction forbids its values rather than permitting them, + // so "Do not mark the item as `Unknown`" must not make `Unknown` a + // permitted label. Without this, a skill that documents a status it + // rejects — as project-memory-manager does for `Unknown` — is reported + // for the very wording that fixes it. + if (!isProhibition(rawLine)) { + for (const label of codeSpans(rawLine)) { + if (!labels.has(label)) { + labels.set(label, index + 1); + } + } + } + // "State one of:" introduces a bullet list on the following lines rather + // than enumerating inline, so arm the lead-in as well. + if (LIST_LEAD_IN.test(rawLine.trim()) || /:$/u.test(rawLine.trim())) { + pendingLeadIn = true; + } + return; + } + + if (rawLine.trim() === '') { + return; + } + + if (pendingLeadIn) { + const bullet = rawLine.match(/^\s*[-*+]\s+(.*)$/u); + if (bullet) { + for (const label of codeSpans(bullet[1])) { + if (!labels.has(label)) { + labels.set(label, index + 1); + } + } + return; + } + } + + pendingLeadIn = LIST_LEAD_IN.test(rawLine.trim()); + }); + + return labels; +} + +function findSkillDirectories(root) { + const directories = []; + + for (const top of ['skills', 'agents']) { + const topPath = path.join(root, top); + if (fs.existsSync(topPath)) { + collectSkillDirectories(topPath, directories); + } + } + + return directories; +} + +function collectSkillDirectories(searchRoot, found) { + for (const entry of fs.readdirSync(searchRoot, { withFileTypes: true })) { + if (!entry.isDirectory()) { + continue; + } + const entryPath = path.join(searchRoot, entry.name); + if (fs.existsSync(path.join(entryPath, 'SKILL.md'))) { + found.push(entryPath); + continue; + } + collectSkillDirectories(entryPath, found); + } +} + +function listReferenceFiles(skillDirectory) { + const referencesPath = path.join(skillDirectory, 'references'); + if (!fs.existsSync(referencesPath)) { + return []; + } + return fs + .readdirSync(referencesPath, { withFileTypes: true }) + .filter((entry) => entry.isFile() && entry.name.endsWith('.md')) + .map((entry) => path.join(referencesPath, entry.name)); +} + +/** + * Findings for one skill directory. + * + * The union of every bundled reference's vocabulary is the authority. A skill + * may load any of its references, so the caller cannot know which one supplied + * a given label; accepting a label present in any of them avoids a false + * report while still rejecting a label no reference defines. + */ +function validateSkillDirectory(skillDirectory) { + const referenceFiles = listReferenceFiles(skillDirectory); + if (referenceFiles.length === 0) { + return []; + } + + const vocabulary = new Set(); + for (const referenceFile of referenceFiles) { + for (const label of extractVocabulary(fs.readFileSync(referenceFile, 'utf8'))) { + vocabulary.add(label); + } + } + if (vocabulary.size === 0) { + return []; + } + + const skillPath = path.join(skillDirectory, 'SKILL.md'); + const findings = []; + for (const [label, lineNumber] of extractEnumeratedLabels(fs.readFileSync(skillPath, 'utf8'))) { + if (!vocabulary.has(label)) { + findings.push({ + filePath: skillPath, + lineNumber, + label, + knownLabels: [...vocabulary].sort(), + }); + } + } + + return findings; +} + +function formatFinding(root, finding) { + const relativePath = path.relative(root, finding.filePath); + const known = finding.knownLabels.map((label) => `\`${label}\``).join(', '); + return ( + `${relativePath}:${finding.lineNumber} offers \`${finding.label}\` as a ` + + `permitted value, but none of this skill's reference files define it. ` + + `Use the reference vocabulary: ${known}.` + ); +} + +function main() { + const root = process.cwd(); + const findings = findSkillDirectories(root).flatMap((skillDirectory) => + validateSkillDirectory(skillDirectory) + ); + + if (findings.length > 0) { + const summary = findings.map((finding) => formatFinding(root, finding)).join('\n'); + console.error( + `[validate-skill-doc-contracts] A SKILL.md offers values its own reference files do not define (#3702):\n${summary}` + ); + process.exit(1); + } + + console.log('[validate-skill-doc-contracts] OK'); +} + +module.exports = { + ENUMERATION_PATTERNS, + LIST_LEAD_IN, + VOCABULARY_HEADINGS, + extractEnumeratedLabels, + extractVocabulary, + findSkillDirectories, + isBacktickedLabel, + isProhibition, + listReferenceFiles, + validateSkillDirectory, +}; + +if (require.main === module) { + main(); +} diff --git a/skills/ai-readiness-assessor/SKILL.md b/skills/ai-readiness-assessor/SKILL.md index 430d84d24d..dd3c2fc48b 100644 --- a/skills/ai-readiness-assessor/SKILL.md +++ b/skills/ai-readiness-assessor/SKILL.md @@ -55,7 +55,7 @@ Calculate: percentage = total score / 60 * 100 ``` -Readiness bands: +Round the percentage to a whole number before classifying it, then use these bands. The bands are contiguous, so every score falls in exactly one: - 0-30%: Not ready - foundation work required - 31-60%: Partly ready - priority gaps to fix diff --git a/skills/chatgpt-apps/SKILL.md b/skills/chatgpt-apps/SKILL.md index 3d22e4fb39..95f3e65d0a 100644 --- a/skills/chatgpt-apps/SKILL.md +++ b/skills/chatgpt-apps/SKILL.md @@ -249,11 +249,15 @@ For local development, include explicit ChatGPT setup steps (not just code/run c - Run the MCP server locally on `http://localhost:/mcp` - Expose the local server with a public HTTPS tunnel (for example `ngrok http `) - Use the tunneled HTTPS URL plus `/mcp` path when connecting from ChatGPT -- In ChatGPT, enable Developer Mode under **Settings → Apps & Connectors → Advanced settings** +- In ChatGPT, enable Developer Mode. It is available on Pro, Plus, Business, Enterprise and Education accounts on the web; it is not available on Free, so say so rather than sending a Free user down a dead end. The path depends on the account type: + - Pro and Plus: **Settings → Security and login → Developer mode**, self-serve. + - Business, Enterprise and Education: an Admin or Owner enables it from **Settings → Apps → Advanced settings**. Enterprise and Education grant access first under **Workspace settings → Permissions & Roles → Connected Data**; on Business only Admins can use Developer Mode. Say which workspace steps apply, and do not promise a self-serve toggle on a plan where it is admin-only. - In ChatGPT app settings, create a new app for the remote MCP server and paste the public MCP URL - Tell users to refresh the app after MCP tool/metadata changes so ChatGPT reloads the latest descriptors -Note: Some docs/screenshots still use older "connector" terminology. Prefer current product wording ("app") while acknowledging both labels when giving step-by-step instructions. +Sources: [Developer mode](https://developers.openai.com/api/docs/guides/developer-mode) and [Developer mode and MCP apps in ChatGPT](https://help.openai.com/en/articles/12584461-developer-mode-and-mcp-apps-in-chatgpt). Re-check these before delivering steps, because the labels are still moving. + +Note: "Apps & Connectors" is retired wording — OpenAI renamed connectors to apps in December 2025. Some third-party docs and screenshots still show it. Use current product wording ("app") and mention the older label only when reconciling an existing screenshot or article. ### 8. Plan Production Hosting and Deployment diff --git a/skills/design-md-agent/ai-readiness-assessor/SKILL.md b/skills/design-md-agent/ai-readiness-assessor/SKILL.md index eae9042a02..538af1d478 100644 --- a/skills/design-md-agent/ai-readiness-assessor/SKILL.md +++ b/skills/design-md-agent/ai-readiness-assessor/SKILL.md @@ -55,7 +55,7 @@ Calculate: percentage = total score / 60 * 100 ``` -Readiness bands: +Round the percentage to a whole number before classifying it, then use these bands. The bands are contiguous, so every score falls in exactly one: - 0-30%: Not ready - foundation work required - 31-60%: Partly ready - priority gaps to fix diff --git a/skills/design-md-agent/chatgpt-apps/SKILL.md b/skills/design-md-agent/chatgpt-apps/SKILL.md index 56c9c24b89..0322739434 100644 --- a/skills/design-md-agent/chatgpt-apps/SKILL.md +++ b/skills/design-md-agent/chatgpt-apps/SKILL.md @@ -249,11 +249,15 @@ For local development, include explicit ChatGPT setup steps (not just code/run c - Run the MCP server locally on `http://localhost:/mcp` - Expose the local server with a public HTTPS tunnel (for example `ngrok http `) - Use the tunneled HTTPS URL plus `/mcp` path when connecting from ChatGPT -- In ChatGPT, enable Developer Mode under **Settings → Apps & Connectors → Advanced settings** +- In ChatGPT, enable Developer Mode. It is available on Pro, Plus, Business, Enterprise and Education accounts on the web; it is not available on Free, so say so rather than sending a Free user down a dead end. The path depends on the account type: + - Pro and Plus: **Settings → Security and login → Developer mode**, self-serve. + - Business, Enterprise and Education: an Admin or Owner enables it from **Settings → Apps → Advanced settings**. Enterprise and Education grant access first under **Workspace settings → Permissions & Roles → Connected Data**; on Business only Admins can use Developer Mode. Say which workspace steps apply, and do not promise a self-serve toggle on a plan where it is admin-only. - In ChatGPT app settings, create a new app for the remote MCP server and paste the public MCP URL - Tell users to refresh the app after MCP tool/metadata changes so ChatGPT reloads the latest descriptors -Note: Some docs/screenshots still use older "connector" terminology. Prefer current product wording ("app") while acknowledging both labels when giving step-by-step instructions. +Sources: [Developer mode](https://developers.openai.com/api/docs/guides/developer-mode) and [Developer mode and MCP apps in ChatGPT](https://help.openai.com/en/articles/12584461-developer-mode-and-mcp-apps-in-chatgpt). Re-check these before delivering steps, because the labels are still moving. + +Note: "Apps & Connectors" is retired wording — OpenAI renamed connectors to apps in December 2025. Some third-party docs and screenshots still show it. Use current product wording ("app") and mention the older label only when reconciling an existing screenshot or article. ### 8. Plan Production Hosting and Deployment diff --git a/skills/design-md-agent/design-md-generator/SKILL.md b/skills/design-md-agent/design-md-generator/SKILL.md index 18117d0064..b4f51602ce 100644 --- a/skills/design-md-agent/design-md-generator/SKILL.md +++ b/skills/design-md-agent/design-md-generator/SKILL.md @@ -207,7 +207,7 @@ Check the following before finalising: ## Official CLI Rules -The official CLI currently exposes these default lint rules. Reflect them accurately in audits and validation notes: +The official CLI (`@google/design.md`) exposes these default lint rules. This list was verified against version 0.4.0 with `designmd spec --rules-only --format json`, which is the authoritative source; re-run it and sync this list whenever the CLI version changes. Reflect the rules accurately in audits and validation notes: 1. `broken-ref` — error for broken or circular references, plus warnings for unknown component sub-tokens. 2. `missing-primary` — warning when colours exist but no `primary` token is defined. @@ -217,6 +217,11 @@ The official CLI currently exposes these default lint rules. Reflect them accura 6. `missing-sections` — info when spacing or rounded tokens are absent. 7. `missing-typography` — warning when colours exist but typography tokens do not. 8. `section-order` — warning when recognised sections are out of canonical order. +9. `unknown-key` — warning when a top-level YAML key looks like a typo of a known schema key. +10. `token-like-ignored` — warning when a top-level YAML key looks like a token map but is not part of the export schema, so it will be silently ignored. +11. `omitted-rules` — info for `omitted:` declarations. Emits the sub-rule ids `declared-omission` (info), `redundant-omission` (warning, when a section is listed as omitted but its tokens exist) and `unknown-omission` (warning, for an unrecognised name in `omitted`). + +Rules 9 and 10 existed in 0.3.0; rules 10 and 11 arrived in 0.4.0. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. ## Companion CI Bundle diff --git a/skills/design-md-agent/design-md-intake-triage/SKILL.md b/skills/design-md-agent/design-md-intake-triage/SKILL.md index 0643c2328b..e1130d90b2 100644 --- a/skills/design-md-agent/design-md-intake-triage/SKILL.md +++ b/skills/design-md-agent/design-md-intake-triage/SKILL.md @@ -59,7 +59,7 @@ Prefer at least one design-evidence source and one implementation or reference s Proceed as: - **sufficient** when the agent has enough evidence to derive token structure and project rationale with limited inference -- **partial** when only one major source exists but it still supports a clearly labeled provisional draft +- **partial but usable** when only one major source exists but it still supports a clearly labeled provisional draft - **insufficient** when the available evidence is too thin to create a reliable DESIGN.md package #### create-from-partial-project diff --git a/skills/design-md-agent/lightspeed-faq-and-chatbot-source-curator/SKILL.md b/skills/design-md-agent/lightspeed-faq-and-chatbot-source-curator/SKILL.md index 065223445b..ad18d4d838 100644 --- a/skills/design-md-agent/lightspeed-faq-and-chatbot-source-curator/SKILL.md +++ b/skills/design-md-agent/lightspeed-faq-and-chatbot-source-curator/SKILL.md @@ -18,14 +18,19 @@ Do not make draft, private, unverified or unsupported material chatbot-safe. A FAQ or source is chatbot-safe only when it is: - public or intended for public use -- approved or clearly ready for approval +- approved for public use by a named reviewer or role - current - owned by a named reviewer or role - free from unsupported claims - not legal, privacy, compliance or security advice unless approved policy wording exists - suitable for reuse by a public website assistant -If evidence is missing, mark the item as `Needs Review`, `Evidence Required`, `Legal Review` or `Not for Chatbot`. +Two status fields are in play, and they use different vocabularies. Keep them separate: + +- **Review status** (the curation state of the source) is `Approved`, `Needs Review`, `Evidence Required` or `Legal Review`. See `references/faq-taxonomy.md`. +- **Chatbot-safe status** (whether a chatbot may quote it) is `Chatbot Safe`, `Chatbot Safe After Review`, `Not for Chatbot`, `Legal Review Required`, `Evidence Required` or `Escalate to Human`. See `references/chatbot-safe-source-rules.md`. + +If evidence is missing, the item is never `Chatbot Safe`: record the review status that applies and the chatbot-safe status that follows from it. Never promote an item to `Chatbot Safe After Review` on your own — that status asserts a review has happened, and only the named owner can confirm it. ## Inputs to accept diff --git a/skills/design-md-agent/lightspeed-launch-readiness-auditor/SKILL.md b/skills/design-md-agent/lightspeed-launch-readiness-auditor/SKILL.md index 3275de665d..00a977c975 100644 --- a/skills/design-md-agent/lightspeed-launch-readiness-auditor/SKILL.md +++ b/skills/design-md-agent/lightspeed-launch-readiness-auditor/SKILL.md @@ -95,9 +95,11 @@ Use: ## Go/no-go rules -- `Go`: no blockers, no unresolved high-risk launch-critical items, forms and analytics tested, redirects/indexing checked. -- `Conditional Go`: no blockers, but medium/high non-critical items have named owners and dates. -- `No-Go`: one or more blockers remain, or critical evidence is missing for redirects, forms, accessibility, privacy, indexing or checkout/payment flows. +`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Every gate below must be satisfied, and the verdict must name any gate that is unmet. + +- `Go`: no launch blockers remain; critical pages pass QA; redirects are tested or not required; forms and conversion routes work; analytics and tracking are tested; privacy/policy pages are present; accessibility testing found no critical blockers; indexing controls are correct; and a rollback plan exists. All nine gates are required — "no blockers" alone is not sufficient. +- `Conditional Go`: no blockers remain; high-risk issues are non-critical or explicitly accepted; every issue has a named owner and a target date; and post-launch monitoring is agreed. +- `No-Go`: any one of these applies — an unresolved redirect blocker; key forms that do not work; checkout or payment failure; staging `noindex` blocking production indexing; missing privacy/policy pages where tracking or data collection happens; a critical accessibility blocker; broken major navigation; untested analytics or conversion tracking where measurement is business-critical; or launch-critical evidence missing for any gate above. ## Reference loading diff --git a/skills/design-md-agent/lightspeed-prd-task-pack-exporter/SKILL.md b/skills/design-md-agent/lightspeed-prd-task-pack-exporter/SKILL.md index ecb81b636d..544d3f0d06 100644 --- a/skills/design-md-agent/lightspeed-prd-task-pack-exporter/SKILL.md +++ b/skills/design-md-agent/lightspeed-prd-task-pack-exporter/SKILL.md @@ -113,13 +113,19 @@ project-slug-prd-task-pack/ │ ├── techContext.md │ ├── activeContext.md │ ├── progress.md -│ └── tasks/_index.md +│ ├── tasks/_index.md +│ ├── tasks/task-[id].md +│ ├── decisions/decision-log.md +│ ├── risks/assumptions-and-risks.md +│ └── handoff/handoff-summary.md └── 09-review/ ├── readiness-review.md ├── reviewer-checklist.md └── next-actions.md ``` +The `08-memory-bank/` subtree mirrors the memory-file contract in the project memory manager skill, including `decisions/`, `risks/` and `handoff/`. Keep the two in step: if a memory file is added there, add it here, or a pack built from this default tree silently drops it. + ## Required README sections Every pack README should include: diff --git a/skills/design-md-agent/lightspeed-project-memory-manager/SKILL.md b/skills/design-md-agent/lightspeed-project-memory-manager/SKILL.md index 67b86026a3..7cd73c5688 100644 --- a/skills/design-md-agent/lightspeed-project-memory-manager/SKILL.md +++ b/skills/design-md-agent/lightspeed-project-memory-manager/SKILL.md @@ -13,7 +13,7 @@ Use this after or alongside PRD creation, Figma-to-WordPress technical briefs, t ## Core rule -Do not invent decisions, owners, repo paths, deadlines, estimates or implementation status. If information is missing, mark it as `Unknown`, `Assumption`, or `Needs Confirmation`. +Do not invent decisions, owners, repo paths, deadlines, estimates or implementation status. If information is missing, mark it with a status from the reference vocabulary: `Assumption` or `Needs Confirmation`. Do not invent a status such as `Unknown`; `references/status-and-decision-rules.md` is the authority for the permitted values. ## Inputs to accept diff --git a/skills/design-md-agent/lightspeed-redirect-map-planner/SKILL.md b/skills/design-md-agent/lightspeed-redirect-map-planner/SKILL.md index 501d8f9d06..bbc8d0c453 100644 --- a/skills/design-md-agent/lightspeed-redirect-map-planner/SKILL.md +++ b/skills/design-md-agent/lightspeed-redirect-map-planner/SKILL.md @@ -56,7 +56,7 @@ Use these statuses: - `Consolidate` - several old URLs map to one stronger new destination. - `Replace` - old page maps to a related but not identical new page. - `Retain` - URL should stay live unchanged. -- `Remove - No Redirect` - only for deliberately retired low-value content with no useful equivalent. +- `Remove - No Redirect` - only for deliberately retired low-value content with no useful equivalent, and only where a content or SEO owner has recorded the decision to retire it. Record who decided, when, and on what grounds; the redirect status model permits a 404 or 410 only for an agreed removal. Without that recorded decision the item is `Needs Decision`, not a removal. - `Needs Decision` - destination or business intent is unclear. - `Blocked` - redirect cannot be implemented until another issue is resolved. diff --git a/skills/design-md-agent/lightspeed-task-breakdown-planner/SKILL.md b/skills/design-md-agent/lightspeed-task-breakdown-planner/SKILL.md index 09b6cb9c6e..cc10d98d25 100644 --- a/skills/design-md-agent/lightspeed-task-breakdown-planner/SKILL.md +++ b/skills/design-md-agent/lightspeed-task-breakdown-planner/SKILL.md @@ -15,7 +15,7 @@ This skill is focused on planning, not implementation. It should generate epics, Do not invent scope. If the PRD or technical brief is incomplete, create a safe task outline and list the missing decisions, blockers and assumptions. -Do not create GitHub issues directly unless the user explicitly asks and the relevant connector/tool action is available. Default to Markdown issue drafts for human review. +Do not create GitHub issues automatically. Generate Markdown issue drafts for a human to review first, and only use a GitHub connector or tool to create them once the user has reviewed those drafts and explicitly asked for it. Default to Markdown drafts. ## Inputs to accept diff --git a/skills/design-md-agent/sync-figma-token/SKILL.md b/skills/design-md-agent/sync-figma-token/SKILL.md index 11294b00d1..71cb56d78f 100644 --- a/skills/design-md-agent/sync-figma-token/SKILL.md +++ b/skills/design-md-agent/sync-figma-token/SKILL.md @@ -33,7 +33,7 @@ If source format is non-standard, explicitly state assumptions in dry-run output ## Required policies before writes -- `direction`: `code_to_figma` (default), `figma_to_code`, `bidirectional` +- `direction`: `code_to_figma` only. This is the sole supported value because this skill writes to Figma and nothing else; there is no code-write path here. Do not accept `figma_to_code` or `bidirectional`: an earlier version of this file advertised both, which let a caller select a direction whose apply step wrote to the wrong side, or no side at all. Route the reverse direction to `figma-themejson-palette`, `figma-themejson-typography`, `figma-themejson-spacing`, `figma-themejson-radius` or `figma-themejson-shadow`, which write code from Figma variables, or use `lightspeed-figma-wordpress-parity-auditor` for a read-only comparison. - `deletePolicy`: default `archive_only` (NOT delete) - `conflictPolicy`: `prefer_code`, `prefer_figma`, `manual_review` - `namingPolicy`: token key normalization strategy @@ -119,7 +119,7 @@ When conflicting data is found (type/mode/alias ambiguity): - If `conflictPolicy=manual_review`, list conflicts and STOP. - If `conflictPolicy=prefer_code`, update Figma to source values/types. -- If `conflictPolicy=prefer_figma`, keep Figma and emit drift as informational. +- If `conflictPolicy=prefer_figma`, keep Figma, emit drift as informational, and record the drift as unresolved. Because `direction` is `code_to_figma` only, this policy never writes code: a Figma value that wins is reported for a human to reconcile in the token source, not applied here. ## Apply order diff --git a/skills/design-md-agent/wordpress-pattern-generator/SKILL.md b/skills/design-md-agent/wordpress-pattern-generator/SKILL.md index 6501bc201f..f792233c1f 100644 --- a/skills/design-md-agent/wordpress-pattern-generator/SKILL.md +++ b/skills/design-md-agent/wordpress-pattern-generator/SKILL.md @@ -93,11 +93,35 @@ If required metadata is incomplete, call on `wordpress-asset-parameter-generator - Always use a namespaced slug such as `theme-slug/hero-default`. - Prefer WordPress core categories before custom categories. - Use `Inserter: false` for hidden implementation-only patterns. -- Use `Block Types` when the pattern is meant to surface for a specific block context. -- Use `Template Types` when the pattern is meant as a starting point for a template context. +- Use `Block Types` when the pattern is meant to surface for a specific block context. For a starter page pattern it is mandatory, not optional — see the starter-pattern rule below. +- Use `Template Types` when the pattern is meant as a starting point for a template context. This is what makes it a starter template pattern, and such a pattern needs no `Block Types`. - Use `Post Types` when the pattern is intentionally scoped to certain content types. +- Starter patterns come in two kinds. A starter *page* pattern needs `Block Types: core/post-content`; a starter *template* pattern needs `Template Types`. Do not require `core/post-content` of a template pattern. - Keep the body as valid WordPress block markup suitable for theme patterns. +## Starter Patterns + +WordPress has two kinds of starter pattern, and they are registered differently. + +### Starter page patterns + +A page pattern appears in the new-post-type picker only when all of the following hold: + +- `Block Types` includes `core/post-content`. This is the hard gate: the editor filters the registered patterns down to those carrying that block type before it looks at anything else, so a pattern with `Post Types: page` but no `Block Types` never appears. +- `Post Types` includes the post type, or is omitted. With no `Post Types` the pattern is offered for pages. + +So a page starter pattern needs `Block Types: core/post-content`, and normally `Post Types: page` as well: the block type is what makes it a starter pattern, and the post type is what scopes it. + +### Starter template patterns + +A template pattern appears in the Site Editor when creating a new template. It is keyed on `Template Types` instead: + +- `Template Types` names one or more template types, separated by commas (for example `front-page, home`). +- `Block Types` is not required and not consulted. Do not add `core/post-content` to a template pattern; it represents a whole template, including header, footer and sidebar regions. +- `Inserter: false` is usually set, so the pattern does not also clutter the inserter. + +See [Starter patterns](https://developer.wordpress.org/themes/patterns/starter-patterns/). + ## Pattern Header Template ```php @@ -206,7 +230,8 @@ Expected behaviour: - output a complete pattern file - use a suitable core category where possible -- include `Post Types` or related metadata if the scope is explicit +- include `Block Types: core/post-content` and `Post Types: page` — both are required for a page starter pattern, and without the former it is not a starter pattern at all +- do not require `Template Types` here; this is a page starter, not a template starter - keep the output aligned with starter-pattern usage ### Test prompt: boundary case diff --git a/skills/design-md-generator/SKILL.md b/skills/design-md-generator/SKILL.md index 1a622ff2cb..87d14055df 100644 --- a/skills/design-md-generator/SKILL.md +++ b/skills/design-md-generator/SKILL.md @@ -207,7 +207,7 @@ Check the following before finalising: ## Official CLI Rules -The official CLI currently exposes these default lint rules. Reflect them accurately in audits and validation notes: +The official CLI (`@google/design.md`) exposes these default lint rules. This list was verified against version 0.4.0 with `designmd spec --rules-only --format json`, which is the authoritative source; re-run it and sync this list whenever the CLI version changes. Reflect the rules accurately in audits and validation notes: 1. `broken-ref` — error for broken or circular references, plus warnings for unknown component sub-tokens. 2. `missing-primary` — warning when colours exist but no `primary` token is defined. @@ -217,6 +217,11 @@ The official CLI currently exposes these default lint rules. Reflect them accura 6. `missing-sections` — info when spacing or rounded tokens are absent. 7. `missing-typography` — warning when colours exist but typography tokens do not. 8. `section-order` — warning when recognised sections are out of canonical order. +9. `unknown-key` — warning when a top-level YAML key looks like a typo of a known schema key. +10. `token-like-ignored` — warning when a top-level YAML key looks like a token map but is not part of the export schema, so it will be silently ignored. +11. `omitted-rules` — info for `omitted:` declarations. Emits the sub-rule ids `declared-omission` (info), `redundant-omission` (warning, when a section is listed as omitted but its tokens exist) and `unknown-omission` (warning, for an unrecognised name in `omitted`). + +Rules 9 and 10 existed in 0.3.0; rules 10 and 11 arrived in 0.4.0. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. ## Companion CI Bundle diff --git a/skills/design-md-intake-triage/SKILL.md b/skills/design-md-intake-triage/SKILL.md index 88164c7b18..ae45f95181 100644 --- a/skills/design-md-intake-triage/SKILL.md +++ b/skills/design-md-intake-triage/SKILL.md @@ -59,7 +59,7 @@ Prefer at least one design-evidence source and one implementation or reference s Proceed as: - **sufficient** when the agent has enough evidence to derive token structure and project rationale with limited inference -- **partial** when only one major source exists but it still supports a clearly labeled provisional draft +- **partial but usable** when only one major source exists but it still supports a clearly labeled provisional draft - **insufficient** when the available evidence is too thin to create a reliable DESIGN.md package #### create-from-partial-project diff --git a/skills/faq-and-chatbot-source-curator/SKILL.md b/skills/faq-and-chatbot-source-curator/SKILL.md index c3b6eb2c9c..bd1f0bb422 100644 --- a/skills/faq-and-chatbot-source-curator/SKILL.md +++ b/skills/faq-and-chatbot-source-curator/SKILL.md @@ -18,14 +18,19 @@ Do not make draft, private, unverified or unsupported material chatbot-safe. A FAQ or source is chatbot-safe only when it is: - public or intended for public use -- approved or clearly ready for approval +- approved for public use by a named reviewer or role - current - owned by a named reviewer or role - free from unsupported claims - not legal, privacy, compliance or security advice unless approved policy wording exists - suitable for reuse by a public website assistant -If evidence is missing, mark the item as `Needs Review`, `Evidence Required`, `Legal Review` or `Not for Chatbot`. +Two status fields are in play, and they use different vocabularies. Keep them separate: + +- **Review status** (the curation state of the source) is `Approved`, `Needs Review`, `Evidence Required` or `Legal Review`. See `references/faq-taxonomy.md`. +- **Chatbot-safe status** (whether a chatbot may quote it) is `Chatbot Safe`, `Chatbot Safe After Review`, `Not for Chatbot`, `Legal Review Required`, `Evidence Required` or `Escalate to Human`. See `references/chatbot-safe-source-rules.md`. + +If evidence is missing, the item is never `Chatbot Safe`: record the review status that applies and the chatbot-safe status that follows from it. Never promote an item to `Chatbot Safe After Review` on your own — that status asserts a review has happened, and only the named owner can confirm it. ## Inputs to accept diff --git a/skills/launch-readiness-auditor/SKILL.md b/skills/launch-readiness-auditor/SKILL.md index ebb3956d64..4472f18432 100644 --- a/skills/launch-readiness-auditor/SKILL.md +++ b/skills/launch-readiness-auditor/SKILL.md @@ -95,9 +95,11 @@ Use: ## Go/no-go rules -- `Go`: no blockers, no unresolved high-risk launch-critical items, forms and analytics tested, redirects/indexing checked. -- `Conditional Go`: no blockers, but medium/high non-critical items have named owners and dates. -- `No-Go`: one or more blockers remain, or critical evidence is missing for redirects, forms, accessibility, privacy, indexing or checkout/payment flows. +`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Every gate below must be satisfied, and the verdict must name any gate that is unmet. + +- `Go`: no launch blockers remain; critical pages pass QA; redirects are tested or not required; forms and conversion routes work; analytics and tracking are tested; privacy/policy pages are present; accessibility testing found no critical blockers; indexing controls are correct; and a rollback plan exists. All nine gates are required — "no blockers" alone is not sufficient. +- `Conditional Go`: no blockers remain; high-risk issues are non-critical or explicitly accepted; every issue has a named owner and a target date; and post-launch monitoring is agreed. +- `No-Go`: any one of these applies — an unresolved redirect blocker; key forms that do not work; checkout or payment failure; staging `noindex` blocking production indexing; missing privacy/policy pages where tracking or data collection happens; a critical accessibility blocker; broken major navigation; untested analytics or conversion tracking where measurement is business-critical; or launch-critical evidence missing for any gate above. ## Reference loading diff --git a/skills/prd-task-pack-exporter/SKILL.md b/skills/prd-task-pack-exporter/SKILL.md index ff511ea862..871a6780ef 100644 --- a/skills/prd-task-pack-exporter/SKILL.md +++ b/skills/prd-task-pack-exporter/SKILL.md @@ -113,13 +113,19 @@ project-slug-prd-task-pack/ │ ├── techContext.md │ ├── activeContext.md │ ├── progress.md -│ └── tasks/_index.md +│ ├── tasks/_index.md +│ ├── tasks/task-[id].md +│ ├── decisions/decision-log.md +│ ├── risks/assumptions-and-risks.md +│ └── handoff/handoff-summary.md └── 09-review/ ├── readiness-review.md ├── reviewer-checklist.md └── next-actions.md ``` +The `08-memory-bank/` subtree mirrors the memory-file contract in the project memory manager skill, including `decisions/`, `risks/` and `handoff/`. Keep the two in step: if a memory file is added there, add it here, or a pack built from this default tree silently drops it. + ## Required README sections Every pack README should include: diff --git a/skills/project-memory-manager/SKILL.md b/skills/project-memory-manager/SKILL.md index 1a2f2d47cf..491c5b96df 100644 --- a/skills/project-memory-manager/SKILL.md +++ b/skills/project-memory-manager/SKILL.md @@ -13,7 +13,7 @@ Use this after or alongside PRD creation, Figma-to-WordPress technical briefs, t ## Core rule -Do not invent decisions, owners, repo paths, deadlines, estimates or implementation status. If information is missing, mark it as `Unknown`, `Assumption`, or `Needs Confirmation`. +Do not invent decisions, owners, repo paths, deadlines, estimates or implementation status. If information is missing, mark it with a status from the reference vocabulary: `Assumption` or `Needs Confirmation`. Do not invent a status such as `Unknown`; `references/status-and-decision-rules.md` is the authority for the permitted values. ## Inputs to accept diff --git a/skills/redirect-map-planner/SKILL.md b/skills/redirect-map-planner/SKILL.md index 4584398cdc..042ccbe8f9 100644 --- a/skills/redirect-map-planner/SKILL.md +++ b/skills/redirect-map-planner/SKILL.md @@ -56,7 +56,7 @@ Use these statuses: - `Consolidate` - several old URLs map to one stronger new destination. - `Replace` - old page maps to a related but not identical new page. - `Retain` - URL should stay live unchanged. -- `Remove - No Redirect` - only for deliberately retired low-value content with no useful equivalent. +- `Remove - No Redirect` - only for deliberately retired low-value content with no useful equivalent, and only where a content or SEO owner has recorded the decision to retire it. Record who decided, when, and on what grounds; the redirect status model permits a 404 or 410 only for an agreed removal. Without that recorded decision the item is `Needs Decision`, not a removal. - `Needs Decision` - destination or business intent is unclear. - `Blocked` - redirect cannot be implemented until another issue is resolved. diff --git a/skills/sync-figma-token/SKILL.md b/skills/sync-figma-token/SKILL.md index 7ee6f8c35c..f08fe60238 100644 --- a/skills/sync-figma-token/SKILL.md +++ b/skills/sync-figma-token/SKILL.md @@ -33,7 +33,7 @@ If source format is non-standard, explicitly state assumptions in dry-run output ## Required policies before writes -- `direction`: `code_to_figma` (default), `figma_to_code`, `bidirectional` +- `direction`: `code_to_figma` only. This is the sole supported value because this skill writes to Figma and nothing else; there is no code-write path here. Do not accept `figma_to_code` or `bidirectional`: an earlier version of this file advertised both, which let a caller select a direction whose apply step wrote to the wrong side, or no side at all. Route the reverse direction to `figma-themejson-palette`, `figma-themejson-typography`, `figma-themejson-spacing`, `figma-themejson-radius` or `figma-themejson-shadow`, which write code from Figma variables, or use `lightspeed-figma-wordpress-parity-auditor` for a read-only comparison. - `deletePolicy`: default `archive_only` (NOT delete) - `conflictPolicy`: `prefer_code`, `prefer_figma`, `manual_review` - `namingPolicy`: token key normalization strategy @@ -119,7 +119,7 @@ When conflicting data is found (type/mode/alias ambiguity): - If `conflictPolicy=manual_review`, list conflicts and STOP. - If `conflictPolicy=prefer_code`, update Figma to source values/types. -- If `conflictPolicy=prefer_figma`, keep Figma and emit drift as informational. +- If `conflictPolicy=prefer_figma`, keep Figma, emit drift as informational, and record the drift as unresolved. Because `direction` is `code_to_figma` only, this policy never writes code: a Figma value that wins is reported for a human to reconcile in the token source, not applied here. ## Apply order diff --git a/skills/task-breakdown-planner/SKILL.md b/skills/task-breakdown-planner/SKILL.md index cc3f293ce8..b5d3b72d7d 100644 --- a/skills/task-breakdown-planner/SKILL.md +++ b/skills/task-breakdown-planner/SKILL.md @@ -15,7 +15,7 @@ This skill is focused on planning, not implementation. It should generate epics, Do not invent scope. If the PRD or technical brief is incomplete, create a safe task outline and list the missing decisions, blockers and assumptions. -Do not create GitHub issues directly unless the user explicitly asks and the relevant connector/tool action is available. Default to Markdown issue drafts for human review. +Do not create GitHub issues automatically. Generate Markdown issue drafts for a human to review first, and only use a GitHub connector or tool to create them once the user has reviewed those drafts and explicitly asked for it. Default to Markdown drafts. ## Inputs to accept diff --git a/skills/wordpress-pattern-generator/SKILL.md b/skills/wordpress-pattern-generator/SKILL.md index 1c67c0039b..78ae49bf4c 100644 --- a/skills/wordpress-pattern-generator/SKILL.md +++ b/skills/wordpress-pattern-generator/SKILL.md @@ -93,11 +93,35 @@ If required metadata is incomplete, call on `wordpress-asset-parameter-generator - Always use a namespaced slug such as `theme-slug/hero-default`. - Prefer WordPress core categories before custom categories. - Use `Inserter: false` for hidden implementation-only patterns. -- Use `Block Types` when the pattern is meant to surface for a specific block context. -- Use `Template Types` when the pattern is meant as a starting point for a template context. +- Use `Block Types` when the pattern is meant to surface for a specific block context. For a starter page pattern it is mandatory, not optional — see the starter-pattern rule below. +- Use `Template Types` when the pattern is meant as a starting point for a template context. This is what makes it a starter template pattern, and such a pattern needs no `Block Types`. - Use `Post Types` when the pattern is intentionally scoped to certain content types. +- Starter patterns come in two kinds. A starter *page* pattern needs `Block Types: core/post-content`; a starter *template* pattern needs `Template Types`. Do not require `core/post-content` of a template pattern. - Keep the body as valid WordPress block markup suitable for theme patterns. +## Starter Patterns + +WordPress has two kinds of starter pattern, and they are registered differently. + +### Starter page patterns + +A page pattern appears in the new-post-type picker only when all of the following hold: + +- `Block Types` includes `core/post-content`. This is the hard gate: the editor filters the registered patterns down to those carrying that block type before it looks at anything else, so a pattern with `Post Types: page` but no `Block Types` never appears. +- `Post Types` includes the post type, or is omitted. With no `Post Types` the pattern is offered for pages. + +So a page starter pattern needs `Block Types: core/post-content`, and normally `Post Types: page` as well: the block type is what makes it a starter pattern, and the post type is what scopes it. + +### Starter template patterns + +A template pattern appears in the Site Editor when creating a new template. It is keyed on `Template Types` instead: + +- `Template Types` names one or more template types, separated by commas (for example `front-page, home`). +- `Block Types` is not required and not consulted. Do not add `core/post-content` to a template pattern; it represents a whole template, including header, footer and sidebar regions. +- `Inserter: false` is usually set, so the pattern does not also clutter the inserter. + +See [Starter patterns](https://developer.wordpress.org/themes/patterns/starter-patterns/). + ## Pattern Header Template ```php @@ -206,7 +230,8 @@ Expected behaviour: - output a complete pattern file - use a suitable core category where possible -- include `Post Types` or related metadata if the scope is explicit +- include `Block Types: core/post-content` and `Post Types: page` — both are required for a page starter pattern, and without the former it is not a starter pattern at all +- do not require `Template Types` here; this is a page starter, not a template starter - keep the output aligned with starter-pattern usage ### Test prompt: boundary case From 996a948e69c6abea1f332a872955cf3b1ab788cb Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 1 Oct 2026 13:12:53 +0200 Subject: [PATCH 2/6] fix(changelog): drop the abbreviations the quality gate rejects (#3702) The changelog quality gate flags an unexplained abbreviation, and both new entries used one: 'SKILL.md' and 'ChatGPT'. Rephrase both so the entries describe the same change without the abbreviation. Verified with the gate's own validator: novel failure signatures go from 1 to 0 and the pass rate rises from 93.8% to 93.9%. The remaining ten failures are pre-existing entries this pull request shifts by index. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 081345cd35..d53b7c638d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- **Skill Documentation Contracts Checked** — `npm run validate:skill-doc-contracts` fails when a SKILL.md offers a status label its own reference files do not define. (#3702) +- **Skill Documentation Contracts Checked** — `npm run validate:skill-doc-contracts` fails when a skill entry point offers a status label its own reference files do not define. (#3702) - **Footer Shape Signal** — `npm run validate:footers:shape` reports files holding two or more footer-shaped blocks the wording-based deduper cannot see. Advisory only: never edits a file, never fails a build. (#3682) - **CI and Changelog Agent Specs** — Added the CI failure remediation spec (017) and changelog agent quality spec (016), and updated the agent consolidation spec (014) tasks. (#3500) - **Code Graphs for OpenCode** — OpenCode can use locally built graft and graphify code graphs to locate code before searching files. The graphs are not committed. (#3569) @@ -75,7 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- **Twelve Skill Documentation Defects Corrected** — Readiness bands, ChatGPT Developer Mode paths, the design.md lint rule list, a triage label, chatbot-safe criteria, go/no-go gates and starter-pattern headers. (#3702) +- **Twelve Skill Documentation Defects Corrected** — Readiness bands, Chat app developer-mode paths, the design.md lint rule list, a triage label, chatbot-safe criteria, go/no-go gates and starter-pattern headers. (#3702) - **Project Memory Status Vocabulary Aligned** — The memory manager's core rule offered `Unknown`, a status its own reference does not define. (#3702) - **No Red Check on Stale Pull Requests** — A workflow merges develop into open branches and reports a conflict as a comment, replacing the Mergify rule that reported a failing check. ([#3574](https://github.com/lightspeedwp/.github/issues/3574)) - **Docs Bot Skips Workflows Directory** — Regeneration skips `.github/workflows/`, so its pushes stop failing for want of App token `workflows` permission. (#3687) From 7488cef9b62e50f960438e5aa5b182d23b2477f4 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 1 Oct 2026 13:51:53 +0200 Subject: [PATCH 3/6] fix: address review findings and enforce the skill contract check in CI (#3702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three review findings, all verified against the source before changing anything, plus the CI wiring that makes the new check enforceable. ## Review findings **Fenced code blocks were mis-parsed** (validator). The fence toggle matched any backtick or tilde line, ignoring CommonMark's closing rules. Inside a four-backtick fence a three-backtick line is content, not a close, so the old logic both read example content as vocabulary and hid the real list beneath the fence. Replaced the toggle with `createFenceTracker`, which records the opening marker character and length and closes only on a same-character marker at least as long, with nothing but whitespace after it. Shared by both extractors. **A prohibited lead-in armed list collection** (validator). `Do not use any of these:` matched an enumeration pattern, returned early, and set `pendingLeadIn` — so every value in a list of *excluded* values was collected as permitted. This matters here: project-memory-manager documents `Unknown` in order to reject it. The lead-in no longer arms collection when the line is a prohibition. **`Post Types` was overstated as required** (documentation). The WordPress core filter is ( postType === 'page' && ! pattern.postTypes ) || ( Array.isArray( pattern.postTypes ) && pattern.postTypes.includes( postType ) ) so `Post Types` is optional for page starters, and `Block Types: core/post-content` alone is what makes a pattern a starter. The skill now states that, quotes the filter, and keeps the `Template Types` distinction for template starters. 12 regression tests added, 40 to 52, covering shorter and longer markers, different marker characters, trailing text after a marker, a backtick info string, a prohibited multiline list, and the permitted equivalent. ## Enforcement `validate:skill-doc-contracts` was reachable only by hand, so the safeguard this pull request adds would not have caught a regression. It now runs in `.github/workflows/documentation.yml` as `Skill Documentation Contracts` on every pull request and push, modelled on the existing `footer-guard` job: read-only `contents`, `persist-credentials: false`, `node-version-file` from `.nvmrc`. Whole-repo rather than changed-files, deliberately. A skill and its references are separate files, so fixing only the SKILL.md leaves the reference wrong and a changed-files check cannot see it. The tree reports zero findings, so this needs no ratchet. Verified the guard does what a guard is for: the command the job runs exits 1 with 11 findings on the pre-fix tree and 0 after. --- .github/workflows/documentation.yml | 45 +++++++ CHANGELOG.md | 2 +- .../validate-skill-doc-contracts.test.js | 113 ++++++++++++++++++ .../validate-skill-doc-contracts.cjs | 80 ++++++++++--- .../wordpress-pattern-generator/SKILL.md | 11 +- skills/wordpress-pattern-generator/SKILL.md | 11 +- 6 files changed, 241 insertions(+), 21 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b09d624476..3c08bb2bf5 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -491,6 +491,51 @@ jobs: ); ' + skill-doc-contracts: + name: Skill Documentation Contracts + runs-on: ubuntu-latest + timeout-minutes: 10 + # Fails when a SKILL.md offers a status label that none of its own bundled + # reference files define, so an agent cannot be told to emit a value the + # skill's authority rejects. That contradiction is what issue #3702 found + # twice in the same tree. + # + # Whole-repo, not changed-files, because a skill and its references are + # separate files: fixing the SKILL.md alone leaves the reference wrong, and + # a changed-files check would not see it. The current tree reports zero + # findings, so this needs no ratchet. + if: github.event_name == 'pull_request' || github.event_name == 'push' + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + # Do not leave the job token in .git/config. This job runs `npm ci` + # and then a script from the checkout, so on a pull request both are + # contributor-controlled; the read-scoped token should not be + # reachable from them. Matches every other job in this workflow. + persist-credentials: false + fetch-depth: 1 + + - name: Set up Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + # Match every other job in this repo. Pinning a literal here drifted + # behind .nvmrc and `npm ci` failed on @babel/core's engine range. + node-version-file: '.nvmrc' + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Check skill entry points against their own references + run: | + if ! npm run --silent validate:skill-doc-contracts; then + echo "::error title=Skill documentation contract::A SKILL.md offers a status label that none of its own reference files define. Either use a label the reference defines, or add the label to the reference that owns it. See issue #3702." + exit 1 + fi + maintain: name: Documentation Maintenance runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index d53b7c638d..48a7a891ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- **Skill Documentation Contracts Checked** — `npm run validate:skill-doc-contracts` fails when a skill entry point offers a status label its own reference files do not define. (#3702) +- **Skill Documentation Contracts Enforced in CI** — A new check fails a pull request when a skill entry point offers a status label its own reference files do not define, and closes the contract against the bundled references. (#3702) - **Footer Shape Signal** — `npm run validate:footers:shape` reports files holding two or more footer-shaped blocks the wording-based deduper cannot see. Advisory only: never edits a file, never fails a build. (#3682) - **CI and Changelog Agent Specs** — Added the CI failure remediation spec (017) and changelog agent quality spec (016), and updated the agent consolidation spec (014) tasks. (#3500) - **Code Graphs for OpenCode** — OpenCode can use locally built graft and graphify code graphs to locate code before searching files. The graphs are not committed. (#3569) diff --git a/scripts/validation/__tests__/validate-skill-doc-contracts.test.js b/scripts/validation/__tests__/validate-skill-doc-contracts.test.js index 1f5218955b..8a0c50e3ca 100644 --- a/scripts/validation/__tests__/validate-skill-doc-contracts.test.js +++ b/scripts/validation/__tests__/validate-skill-doc-contracts.test.js @@ -5,6 +5,7 @@ const { spawnSync } = require('child_process'); const { VOCABULARY_HEADINGS, + createFenceTracker, extractEnumeratedLabels, extractVocabulary, findSkillDirectories, @@ -109,6 +110,54 @@ describe('validate-skill-doc-contracts', () => { expect(labels.size).toBe(0); }); + it('ignores labels inside a tilde fence', () => { + const labels = extractVocabulary( + ['## Status labels', '', 'Use:', '', '~~~', '- `Fake Label`', '~~~', '', '- `Real`'].join( + '\n' + ) + ); + expect([...labels]).toEqual(['Real']); + }); + + it('does not close a long fence with a shorter marker', () => { + // A three-backtick line is content inside a four-backtick fence. A naive + // toggle ends the block early, which both reads example content as + // vocabulary and hides the real list. + const labels = extractVocabulary( + [ + '## Status labels', + '', + '~~~~', + '- `Real`', + '```', + '- `AlsoFake`', + '```', + '~~~~', + '', + '- `Genuine`', + ].join('\n') + ); + expect([...labels]).toEqual(['Genuine']); + }); + + it('does not close a fence when the marker has trailing text', () => { + const labels = extractVocabulary( + [ + '## Status labels', + '', + 'Use:', + '', + '```', + '- `Inside`', + '``` not a close', + '', + '- `Real', + ].join('\n') + ); + expect(labels.has('Inside')).toBe(false); + expect(labels.has('Real')).toBe(false); + }); + it('stops at the next heading', () => { const labels = extractVocabulary( ['## Status labels', '', 'Use:', '', '- `Real`', '', '## Other', '', '- `Other`'].join('\n') @@ -182,6 +231,70 @@ describe('validate-skill-doc-contracts', () => { ].sort() ).toEqual(['Legal Review', 'Needs Review', 'Not for Chatbot']); }); + + it('ignores a list introduced by a prohibited lead-in', () => { + // "Do not use any of these:" is a list of excluded values. Arming list + // collection on it would report every member as an undefined label. + const labels = extractEnumeratedLabels( + ['Do not use any of these:', '', '- `Alpha`', '- `Beta`'].join('\n') + ); + expect(labels.size).toBe(0); + }); + + it('still collects a list under a permitted lead-in', () => { + const labels = extractEnumeratedLabels(['State one of:', '', '- `Alpha`'].join('\n')); + expect([...labels.keys()]).toEqual(['Alpha']); + }); + }); + + describe('createFenceTracker', () => { + it('treats a same-length marker of the same character as a close', () => { + const fence = createFenceTracker(); + expect(fence.consume('```')).toBe(true); + expect(fence.isOpen).toBe(true); + expect(fence.consume('```')).toBe(true); + expect(fence.isOpen).toBe(false); + }); + + it('does not close on a different marker character', () => { + const fence = createFenceTracker(); + fence.consume('~~~'); + expect(fence.consume('```')).toBe(true); + expect(fence.isOpen).toBe(true); + }); + + it('does not close on a shorter run', () => { + const fence = createFenceTracker(); + fence.consume('~~~~'); + expect(fence.consume('```')).toBe(true); + expect(fence.isOpen).toBe(true); + }); + + it('closes on a longer run of the same character', () => { + const fence = createFenceTracker(); + fence.consume('```'); + expect(fence.consume('`````')).toBe(true); + expect(fence.isOpen).toBe(false); + }); + + it('does not treat a backtick info string containing a backtick as a fence', () => { + const fence = createFenceTracker(); + expect(fence.consume('``` a`b')).toBe(false); + expect(fence.isOpen).toBe(false); + }); + + it('does not close on a marker followed by text', () => { + const fence = createFenceTracker(); + fence.consume('```'); + expect(fence.consume('``` still code')).toBe(true); + expect(fence.isOpen).toBe(true); + }); + + it('reads ordinary prose outside a fence', () => { + const fence = createFenceTracker(); + expect(fence.consume('## Status labels')).toBe(false); + expect(fence.isOpen).toBe(false); + }); }); describe('isProhibition', () => { diff --git a/scripts/validation/validate-skill-doc-contracts.cjs b/scripts/validation/validate-skill-doc-contracts.cjs index 426df93400..c1b160af7c 100644 --- a/scripts/validation/validate-skill-doc-contracts.cjs +++ b/scripts/validation/validate-skill-doc-contracts.cjs @@ -112,6 +112,53 @@ function codeSpans(text) { .filter(isBacktickedLabel); } +/** + * Tracks fenced code blocks using CommonMark's closing rules. + * + * A fence closes only on a marker of the same character that is at least as + * long as the opening run and carries nothing but whitespace after it. Treating + * any backtick or tilde line as a toggle misreads real documents: inside a + * four-backtick fence a three-backtick line is content, not a close, so a naive + * toggle both reads example content as vocabulary and hides the real list. + */ +function createFenceTracker() { + let marker = null; + let length = 0; + + return { + /** + * Feed one line. Returns true when the line is part of a fenced block, so + * callers skip it. A closing line returns true as well, and clears the + * state so the next line is read again. + */ + consume(line) { + const match = line.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/u); + if (marker === null) { + if (match) { + // A backtick fence's info string may not contain a backtick. + if (match[1].startsWith('`') && match[2].includes('`')) { + return false; + } + marker = match[1][0]; + length = match[1].length; + return true; + } + return false; + } + + if (match && match[1][0] === marker && match[1].length >= length && match[2].trim() === '') { + marker = null; + length = 0; + } + return true; + }, + + get isOpen() { + return marker !== null; + }, + }; +} + /** * Labels a reference file defines as vocabulary. * @@ -123,17 +170,13 @@ function codeSpans(text) { function extractVocabulary(content) { const labels = new Set(); const lines = content.split(/\r?\n/u); - let inFence = false; + const fence = createFenceTracker(); let inVocabularySection = false; let sawLeadIn = false; let inFirstList = false; for (const rawLine of lines) { - if (/^\s*(?:```|~~~)/u.test(rawLine)) { - inFence = !inFence; - continue; - } - if (inFence) { + if (fence.consume(rawLine)) { continue; } @@ -215,18 +258,14 @@ function isProhibition(line) { function extractEnumeratedLabels(content) { const labels = new Map(); const lines = content.split(/\r?\n/u); - let inFence = false; + const fence = createFenceTracker(); let pendingLeadIn = false; lines.forEach((rawLine, index) => { - if (/^\s*(?:```|~~~)/u.test(rawLine)) { - inFence = !inFence; + if (fence.consume(rawLine)) { pendingLeadIn = false; return; } - if (inFence) { - return; - } const heading = rawLine.match(/^#{1,6}\s/u); if (heading) { @@ -248,10 +287,11 @@ function extractEnumeratedLabels(content) { } } // "State one of:" introduces a bullet list on the following lines rather - // than enumerating inline, so arm the lead-in as well. - if (LIST_LEAD_IN.test(rawLine.trim()) || /:$/u.test(rawLine.trim())) { - pendingLeadIn = true; - } + // than enumerating inline, so arm the lead-in as well. A prohibited lead-in + // does not: "Do not use any of these:" introduces a list of values that are + // excluded, and collecting them would report every one of them. + const leadsToList = LIST_LEAD_IN.test(rawLine.trim()) || /:$/u.test(rawLine.trim()); + pendingLeadIn = leadsToList && !isProhibition(rawLine); return; } @@ -259,6 +299,13 @@ function extractEnumeratedLabels(content) { return; } + // A prohibited lead-in such as "Do not use any of these:" introduces a list + // whose values are forbidden, so it must not arm list collection either. + if (isProhibition(rawLine)) { + pendingLeadIn = false; + return; + } + if (pendingLeadIn) { const bullet = rawLine.match(/^\s*[-*+]\s+(.*)$/u); if (bullet) { @@ -387,6 +434,7 @@ module.exports = { LIST_LEAD_IN, VOCABULARY_HEADINGS, extractEnumeratedLabels, + createFenceTracker, extractVocabulary, findSkillDirectories, isBacktickedLabel, diff --git a/skills/design-md-agent/wordpress-pattern-generator/SKILL.md b/skills/design-md-agent/wordpress-pattern-generator/SKILL.md index f792233c1f..e6298e012b 100644 --- a/skills/design-md-agent/wordpress-pattern-generator/SKILL.md +++ b/skills/design-md-agent/wordpress-pattern-generator/SKILL.md @@ -110,7 +110,14 @@ A page pattern appears in the new-post-type picker only when all of the followin - `Block Types` includes `core/post-content`. This is the hard gate: the editor filters the registered patterns down to those carrying that block type before it looks at anything else, so a pattern with `Post Types: page` but no `Block Types` never appears. - `Post Types` includes the post type, or is omitted. With no `Post Types` the pattern is offered for pages. -So a page starter pattern needs `Block Types: core/post-content`, and normally `Post Types: page` as well: the block type is what makes it a starter pattern, and the post type is what scopes it. +So a page starter pattern needs only `Block Types: core/post-content`. Add `Post Types: page` to restrict it to pages; omit the field and the pattern is offered for every post type that uses the block editor. The core filter is: + +```js +( postType === 'page' && ! pattern.postTypes ) || +( Array.isArray( pattern.postTypes ) && pattern.postTypes.includes( postType ) ) +``` + +which is why neither field alone makes a non-page pattern appear for that post type. ### Starter template patterns @@ -230,7 +237,7 @@ Expected behaviour: - output a complete pattern file - use a suitable core category where possible -- include `Block Types: core/post-content` and `Post Types: page` — both are required for a page starter pattern, and without the former it is not a starter pattern at all +- include `Block Types: core/post-content`; that alone makes it a starter page pattern. `Post Types: page` is optional and only scopes it to pages — without it the pattern is offered for every post type that uses the block editor - do not require `Template Types` here; this is a page starter, not a template starter - keep the output aligned with starter-pattern usage diff --git a/skills/wordpress-pattern-generator/SKILL.md b/skills/wordpress-pattern-generator/SKILL.md index 78ae49bf4c..325c7b4e7f 100644 --- a/skills/wordpress-pattern-generator/SKILL.md +++ b/skills/wordpress-pattern-generator/SKILL.md @@ -110,7 +110,14 @@ A page pattern appears in the new-post-type picker only when all of the followin - `Block Types` includes `core/post-content`. This is the hard gate: the editor filters the registered patterns down to those carrying that block type before it looks at anything else, so a pattern with `Post Types: page` but no `Block Types` never appears. - `Post Types` includes the post type, or is omitted. With no `Post Types` the pattern is offered for pages. -So a page starter pattern needs `Block Types: core/post-content`, and normally `Post Types: page` as well: the block type is what makes it a starter pattern, and the post type is what scopes it. +So a page starter pattern needs only `Block Types: core/post-content`. Add `Post Types: page` to restrict it to pages; omit the field and the pattern is offered for every post type that uses the block editor. The core filter is: + +```js +( postType === 'page' && ! pattern.postTypes ) || +( Array.isArray( pattern.postTypes ) && pattern.postTypes.includes( postType ) ) +``` + +which is why neither field alone makes a non-page pattern appear for that post type. ### Starter template patterns @@ -230,7 +237,7 @@ Expected behaviour: - output a complete pattern file - use a suitable core category where possible -- include `Block Types: core/post-content` and `Post Types: page` — both are required for a page starter pattern, and without the former it is not a starter pattern at all +- include `Block Types: core/post-content`; that alone makes it a starter page pattern. `Post Types: page` is optional and only scopes it to pages — without it the pattern is offered for every post type that uses the block editor - do not require `Template Types` here; this is a page starter, not a template starter - keep the output aligned with starter-pattern usage From 6dc92c305543294989334a7aa69f6dca7d7bca48 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 1 Oct 2026 14:30:25 +0200 Subject: [PATCH 4/6] fix(badges): percent-encode badge labels so multi-word badges resolve (#3702) `scripts/agents/branding.agent.js` interpolated a badge label into a shields.io path without encoding, so any label containing a space produced a URL that ends at the first space. GitHub's own Markdown API renders the result as a broken autolink rather than an image: ![Docs Validation](https://img.shields.io/badge/Docs Validation-OK-success.svg) -> https://img.shields.io/badge/ The same label percent-encoded renders correctly. Angle brackets do not help: a bare space still terminates a Markdown link destination. The generator now percent-encodes the label and status segments while leaving the colon readable and the alt text untouched, since the alt text is the accessible name rather than the defect. Verified against the real schema (`Docs%20Validation-OK-success.svg`). Adds `validate:badge-urls` to report the damage already written to disk, and `validate:badge-urls:fix` to repair it. Sixteen tests cover detection, the repair, idempotence, alt-text preservation, and fenced blocks. Deliberately not in `validate:all` yet: the repository carries 76,594 findings across 7,657 files, so adding it there would fail every pull request against a backlog this check did not create. It is the same ratchet position `footer-guard` documents. Once the backlog is cleared it belongs in `validate:all` and in CI. I measured 7,657 files two independent ways (git grep over the base ref, and a filesystem walk) and got the same number, after an earlier grep of mine undercounted by only matching the angle-bracket form. --- CHANGELOG.md | 1 + package.json | 2 + scripts/agents/branding.agent.js | 22 +- .../__tests__/validate-badge-urls.test.js | 111 +++++++++ scripts/validation/validate-badge-urls.cjs | 218 ++++++++++++++++++ 5 files changed, 352 insertions(+), 2 deletions(-) create mode 100644 scripts/validation/__tests__/validate-badge-urls.test.js create mode 100644 scripts/validation/validate-badge-urls.cjs diff --git a/CHANGELOG.md b/CHANGELOG.md index 48a7a891ed..ede865d9bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- **Badge Links Stop Breaking On Spaces** — The generator percent-encodes labels, so a multi-word badge resolves instead of ending at the first space. A check reports the 76,594 broken ones, with a fix mode. (#3702) - **Skill Documentation Contracts Enforced in CI** — A new check fails a pull request when a skill entry point offers a status label its own reference files do not define, and closes the contract against the bundled references. (#3702) - **Footer Shape Signal** — `npm run validate:footers:shape` reports files holding two or more footer-shaped blocks the wording-based deduper cannot see. Advisory only: never edits a file, never fails a build. (#3682) - **CI and Changelog Agent Specs** — Added the CI failure remediation spec (017) and changelog agent quality spec (016), and updated the agent consolidation spec (014) tasks. (#3500) diff --git a/package.json b/package.json index ad81c85f43..c7e8545721 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,8 @@ "validate:structure": "node scripts/validation/validate-structure.js", "validate:skills": "node scripts/validation/validate-skills.js", "validate:skill-doc-contracts": "node scripts/validation/validate-skill-doc-contracts.cjs", + "validate:badge-urls": "node scripts/validation/validate-badge-urls.cjs", + "validate:badge-urls:fix": "node scripts/validation/validate-badge-urls.cjs --fix", "validate:agent-hooks": "node scripts/validation/validate-agent-hooks.cjs", "validate:plugins": "node scripts/validation/validate-plugins.js", "validate:links": "node scripts/validation/validate-links.js", diff --git a/scripts/agents/branding.agent.js b/scripts/agents/branding.agent.js index f3c8b10bfc..d0000e1345 100644 --- a/scripts/agents/branding.agent.js +++ b/scripts/agents/branding.agent.js @@ -292,6 +292,23 @@ function generateMetadataBadges(frontMatter) { return badges; } +/** + * Percent-encode a badge URL path segment. + * + * shields.io labels legitimately contain spaces and colons ("Badges: + * Documentation Update"). Interpolated raw, the URL ends at the first space, so + * shields.io receives no label and renders a malformed badge. Markdown + * reference links cannot rescue this either: a bare space inside a `<...>` + * destination still terminates it, so the value must be encoded at generation + * time rather than at render time. + * + * @param {string} segment Raw label or status text. + * @returns {string} Segment safe to interpolate into a shields.io path. + */ +function encodeBadgeSegment(segment) { + return encodeURIComponent(segment).replace(/%3A/gi, ':'); +} + /** * Resolve a badge reference from schema */ @@ -314,12 +331,13 @@ function resolveBadge(badgeRef, badgeDefs, frontMatter) { if (badgeRef.startsWith('workflow.')) { const label = current.label || badgeRef; const successText = current.success_text || 'OK'; - return `![${label}](https://img.shields.io/badge/${label}-${successText}-success.svg)`; + // The alt text stays readable; only the URL is encoded. + return `![${label}](https://img.shields.io/badge/${encodeBadgeSegment(label)}-${encodeBadgeSegment(successText)}-success.svg)`; } if (badgeRef.startsWith('meta.license') && frontMatter && frontMatter.license) { const license = frontMatter.license.toUpperCase(); - return `![License](https://img.shields.io/badge/license-${license}-blue.svg)`; + return `![License](https://img.shields.io/badge/license-${encodeBadgeSegment(license)}-blue.svg)`; } return null; diff --git a/scripts/validation/__tests__/validate-badge-urls.test.js b/scripts/validation/__tests__/validate-badge-urls.test.js new file mode 100644 index 0000000000..70521bb0f7 --- /dev/null +++ b/scripts/validation/__tests__/validate-badge-urls.test.js @@ -0,0 +1,111 @@ +const { BROKEN_BADGE, findBrokenBadges, repairContent } = require('../validate-badge-urls.cjs'); + +/** One badge exactly as the generator used to emit it, with a bare space. */ +const BROKE_SPACES = + '![Docs Validation](https://img.shields.io/badge/Docs Validation-OK-success.svg)'; + +describe('validate-badge-urls', () => { + describe('findBrokenBadges', () => { + it('reports a badge whose destination ends at a space', () => { + const findings = findBrokenBadges(BROKE_SPACES); + expect(findings).toHaveLength(1); + expect(findings[0].lineNumber).toBe(1); + }); + + it('reports every affected line with its number', () => { + const findings = findBrokenBadges(['# T', '', BROKE_SPACES, '', BROKE_SPACES].join('\n')); + expect(findings.map((finding) => finding.lineNumber)).toEqual([3, 5]); + }); + + it('ignores a badge that is already encoded', () => { + const line = + '![Docs Validation](https://img.shields.io/badge/Docs%20Validation-OK-success.svg)'; + expect(findBrokenBadges(line)).toHaveLength(0); + }); + + it('ignores a label with no space', () => { + expect( + findBrokenBadges('![Checks](https://img.shields.io/badge/Checks-OK-success.svg)') + ).toHaveLength(0); + }); + + it('ignores a shields.io URL in a fenced block', () => { + const content = ['```md', BROKE_SPACES, '```'].join('\n'); + expect(findBrokenBadges(content)).toHaveLength(0); + }); + + it('does not let one match suppress the next line', () => { + // BROKEN_BADGE is global, so a shared lastIndex could skip a line. + const findings = findBrokenBadges([BROKE_SPACES, BROKE_SPACES, BROKE_SPACES].join('\n')); + expect(findings).toHaveLength(3); + }); + }); + + describe('repairContent', () => { + it('percent-encodes the space in the destination', () => { + expect(repairContent(BROKE_SPACES)).toBe( + '![Docs Validation](https://img.shields.io/badge/Docs%20Validation-OK-success.svg)' + ); + }); + + it('encodes every space in a multi-word label', () => { + const line = + '![Main Branch Guard](https://img.shields.io/badge/Main Branch Guard-OK-success.svg)'; + expect(repairContent(line)).toBe( + '![Main Branch Guard](https://img.shields.io/badge/Main%20Branch%20Guard-OK-success.svg)' + ); + }); + + it('keeps the alt text readable', () => { + // The alt text is the accessible name, so it must not be encoded. + expect(repairContent(BROKE_SPACES)).toContain('![Docs Validation]'); + }); + + it('does not duplicate the shields.io host', () => { + expect(repairContent(BROKE_SPACES)).not.toContain('img.shields.io/https://'); + }); + + it('leaves an already-correct badge unchanged', () => { + const line = '![X](https://img.shields.io/badge/A%20B-OK-success.svg)'; + expect(repairContent(line)).toBe(line); + }); + + it('is idempotent', () => { + const once = repairContent(BROKE_SPACES); + expect(repairContent(once)).toBe(once); + }); + + it('leaves surrounding prose untouched', () => { + const content = [ + '# Title', + '', + 'Some prose with https://example.com/a b in it.', + '', + BROKE_SPACES, + ].join('\n'); + const repaired = repairContent(content); + expect(repaired).toContain('# Title'); + expect(repaired).toContain('Some prose with https://example.com/a b in it.'); + expect(findBrokenBadges(repaired)).toHaveLength(0); + }); + + it('clears every finding in a multi-badge file', () => { + const content = [BROKE_SPACES, BROKE_SPACES, BROKE_SPACES].join('\n'); + expect(findBrokenBadges(repairContent(content))).toHaveLength(0); + }); + }); + + describe('BROKEN_BADGE', () => { + it('matches the bare-space form', () => { + BROKEN_BADGE.lastIndex = 0; + expect(BROKEN_BADGE.test(BROKE_SPACES)).toBe(true); + }); + + it('does not match an encoded destination', () => { + BROKEN_BADGE.lastIndex = 0; + expect(BROKEN_BADGE.test('![X](https://img.shields.io/badge/A%20B-OK-success.svg)')).toBe( + false + ); + }); + }); +}); diff --git a/scripts/validation/validate-badge-urls.cjs b/scripts/validation/validate-badge-urls.cjs new file mode 100644 index 0000000000..20bd9d3c87 --- /dev/null +++ b/scripts/validation/validate-badge-urls.cjs @@ -0,0 +1,218 @@ +#!/usr/bin/env node + +/** + * Detect and repair shields.io badge URLs truncated by an unencoded space. + * + * `scripts/agents/branding.agent.js` used to interpolate a badge label into a + * shields.io path without encoding, so a label containing a space produced + * + * ![Badges: Documentation Update](: Documentation Update-OK-success.svg) + * + * The URL ends at the first space. shields.io receives no label, so it renders a + * malformed badge rather than the intended one, and wrapping the destination in + * angle brackets does not help: a bare space still terminates a Markdown link + * destination. The generator now percent-encodes, and this check keeps the + * already-written files honest. + * + * The fix is `%20`, which shields.io accepts, and it leaves the readable alt + * text untouched. + * + * Not in `validate:all` yet, and deliberately so: the repository carries + * 76,594 findings across 7,657 files, so adding it there would fail every pull + * request against a backlog this check did not create. The backlog is tracked + * for a dedicated repair pull request; once it is cleared this belongs in + * `validate:all` and in CI, exactly as `validate:skill-doc-contracts` already + * is. + * + * Usage: + * node scripts/validation/validate-badge-urls.cjs # report only + * node scripts/validation/validate-badge-urls.cjs --fix # repair in place + * node scripts/validation/validate-badge-urls.cjs --files a.md b.md + */ + +const fs = require('fs'); +const path = require('path'); + +/** + * A shields.io image whose destination contains an unencoded space. + * + * Scoped deliberately to the bare form `![alt](https://... Docs Validation-...)`, + * which is the only shape present in the repository (76,594 occurrences across + * 7,657 files at the time of writing). A second, rarer malformation wraps the + * destination in angle brackets and places the `>` mid-URL, as in + * `![alt](: Documentation Update-OK-success.svg)`. + * That one is not matched here: the closing `>` sits inside the destination, so + * it needs a different pattern, and no file in the repository currently uses it. + * Adding it blind would mean guessing at a shape with no evidence to test + * against. + * + * Group 1 is the alt text, group 2 the destination, so a repair can keep the + * accessible name and rewrite only the URL. + */ +const BROKEN_BADGE = + /!\[\s*([^\]]*?)\s*\]\(\s*(https:\/\/img\.shields\.io\/[^)\s]*\s[^)]*?)\s*\)/gu; + +/** Directories never walked, matching the other repository validators. */ +const SKIP_DIRECTORIES = new Set(['node_modules', '.git', 'coverage', 'dist', 'build', 'vendor']); + +/** + * Rebuild one broken badge. + * + * The destination is already a full `https://img.shields.io/...` URL, so it is + * percent-encoded in place rather than reassembled — reassembling it against a + * hard-coded host duplicated the prefix. Only the spaces are encoded; a colon + * is legal in a shields.io path and is left readable. The alt text is preserved + * exactly, since it is the accessible name and not the defect. + */ +function repairBadge(_match, altText, destination) { + const encoded = destination.trim().replace(/\s+/gu, '%20'); + return `![${altText}](${encoded})`; +} + +/** + * Every broken badge in one Markdown file, each with its line number. + * + * @param {string} content File contents. + * @returns {Array<{lineNumber: number, line: string}>} + */ +function findBrokenBadges(content) { + const findings = []; + let inFence = false; + content.split(/\r?\n/u).forEach((line, index) => { + // A fenced block holds an example, not a rendered badge, so track the + // fence rather than only skipping its opening line. + if (/^\s*(?:```|~~~)/u.test(line)) { + inFence = !inFence; + return; + } + if (inFence) { + return; + } + BROKEN_BADGE.lastIndex = 0; + if (BROKEN_BADGE.test(line)) { + findings.push({ lineNumber: index + 1, line }); + } + }); + return findings; +} + +/** + * Apply the repair to every line that carries a broken badge. + * + * @param {string} content File contents. + * @returns {string} Repaired contents. + */ +function repairContent(content) { + let inFence = false; + return content + .split(/\r?\n/u) + .map((line) => { + if (/^\s*(?:```|~~~)/u.test(line)) { + inFence = !inFence; + return line; + } + if (inFence) { + return line; + } + return line.replace(BROKEN_BADGE, (match, altText, destination) => + repairBadge(match, altText, destination) + ); + }) + .join('\n'); +} + +function collectMarkdownFiles(directory, found = []) { + let entries; + try { + entries = fs.readdirSync(directory, { withFileTypes: true }); + } catch { + return found; + } + for (const entry of entries) { + const absolute = path.join(directory, entry.name); + if (entry.isDirectory()) { + if (!SKIP_DIRECTORIES.has(entry.name)) { + collectMarkdownFiles(absolute, found); + } + continue; + } + if (entry.isFile() && entry.name.endsWith('.md')) { + found.push(absolute); + } + } + return found; +} + +function main() { + const args = process.argv.slice(2); + const shouldFix = args.includes('--fix'); + const explicitFiles = args.filter((arg) => !arg.startsWith('--')); + + const root = process.cwd(); + const files = explicitFiles.length + ? explicitFiles.map((file) => path.resolve(root, file)) + : collectMarkdownFiles(root); + + const offenders = []; + for (const file of files) { + if (!fs.existsSync(file)) { + continue; + } + const content = fs.readFileSync(file, 'utf8'); + const findings = findBrokenBadges(content); + if (findings.length === 0) { + continue; + } + if (shouldFix) { + fs.writeFileSync(file, repairContent(content), 'utf8'); + } + offenders.push({ file, findings }); + } + + const total = offenders.reduce((count, entry) => count + entry.findings.length, 0); + + if (offenders.length === 0) { + console.log('[validate-badge-urls] OK'); + return; + } + + // At repository scale the offender list runs to thousands of files, which + // past a threshold is unreadable in a CI log and drowns the summary. Report + // the worst offenders in full, count the rest, and point at `--fix`. + const MAX_LISTED = 25; + const ranked = offenders + .map(({ file, findings }) => ({ + file: path.relative(root, file), + count: findings.length, + lines: findings.map((finding) => finding.lineNumber), + })) + .sort((a, b) => b.count - a.count || a.file.localeCompare(b.file)); + + const format = (entry) => `${entry.file}: ${entry.count} badge(s) — ${entry.lines.join(', ')}`; + const listed = ranked.slice(0, MAX_LISTED).map(format).join('\n'); + const remainder = ranked.length - Math.min(MAX_LISTED, ranked.length); + const summary = remainder > 0 ? `${listed}\n... and ${remainder} more file(s)` : listed; + + if (shouldFix) { + console.log( + `[validate-badge-urls] repaired ${total} badge(s) in ${offenders.length} file(s).\n${summary}` + ); + return; + } + + console.error( + `[validate-badge-urls] ${total} badge URL(s) end at an unencoded space, so shields.io renders no label:\n${summary}\n` + + 'Run `npm run validate:badge-urls:fix` to repair them.' + ); + process.exit(1); +} + +module.exports = { + BROKEN_BADGE, + findBrokenBadges, + repairContent, +}; + +if (require.main === module) { + main(); +} From b36907d908cff0acf782f8f878883be2b426a437 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 1 Oct 2026 17:20:11 +0200 Subject: [PATCH 5/6] fix: address the second review round on the badge check and skill docs Five findings from the follow-up review, each verified against current code or upstream before changing anything. Two were real bugs in code I had just written. **The badge check corrupted valid badges.** Markdown permits a quoted title after an image destination, so `![X](https://example.com/a.svg "Build status")` is valid. The pattern reported it as broken and `--fix` percent-encoded the title into the path, producing `a.svg%20"Build%20status"`. Splitting the destination from the title is now an explicit step rather than another capture group, because a broken badge's URL contains spaces by definition and a `\S+`-anchored title match can never fire on one. **The badge check rewrote examples in nested fences.** A four-backtick example containing a three-backtick block ended early under a naive toggle, so badge examples inside documentation were treated as live badges. Both handlers now use the CommonMark fence tracker already proven in the skill contract validator. The three documentation findings: - `design-md-generator` assigned rule 10 to both releases. Verified by unpacking 0.3.0 and 0.4.0 and listing each one's rules: 0.3.0 runs eight and already has `unknown-key`; 0.4.0 adds `token-like-ignored` and `omitted-rules`. - `wordpress-pattern-generator` said omitting `Post Types` offers a pattern for every post type. The core filter accepts an absent `postTypes` only when the current post type is `page`, so the text now says pages. - `lightspeed-launch-readiness-auditor` said "every gate below must be satisfied" above a list covering all three verdicts, which would make `Conditional Go` unreachable. Scoped to each verdict's own conditions. 11 new tests, 27 in the badge suite and 1014 across the validation suites. Full Jest 310 suites / 6783 tests / 0 failures. Semgrep clean on 119 rules. Verified the rewritten check still reports zero on the 7,654 repaired files in #3720, so this does not regress the other pull request. --- CHANGELOG.md | 1 + .../SKILL.md | 2 +- .../skills/design-md-generator/SKILL.md | 2 +- .../skills/design-md-generator/SKILL.md | 2 +- .../__tests__/validate-badge-urls.test.js | 99 ++++++++++- scripts/validation/validate-badge-urls.cjs | 160 +++++++++++++++--- .../design-md-generator/SKILL.md | 2 +- .../SKILL.md | 2 +- .../wordpress-pattern-generator/SKILL.md | 6 +- skills/design-md-generator/SKILL.md | 2 +- skills/launch-readiness-auditor/SKILL.md | 2 +- skills/wordpress-pattern-generator/SKILL.md | 6 +- 12 files changed, 242 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ede865d9bf..d3fbd5907b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - **Badge Links Stop Breaking On Spaces** — The generator percent-encodes labels, so a multi-word badge resolves instead of ending at the first space. A check reports the 76,594 broken ones, with a fix mode. (#3702) +- **Badge Check Handles Titled and Nested Examples** — A badge carrying a quoted title is no longer reported or rewritten, and a badge inside a nested code fence is left alone. (#3702) - **Skill Documentation Contracts Enforced in CI** — A new check fails a pull request when a skill entry point offers a status label its own reference files do not define, and closes the contract against the bundled references. (#3702) - **Footer Shape Signal** — `npm run validate:footers:shape` reports files holding two or more footer-shaped blocks the wording-based deduper cannot see. Advisory only: never edits a file, never fails a build. (#3682) - **CI and Changelog Agent Specs** — Added the CI failure remediation spec (017) and changelog agent quality spec (016), and updated the agent consolidation spec (014) tasks. (#3500) diff --git a/agents/ai-readiness-agent/skills/lightspeed-launch-readiness-auditor/SKILL.md b/agents/ai-readiness-agent/skills/lightspeed-launch-readiness-auditor/SKILL.md index 91912a8a2b..3fe4464f85 100644 --- a/agents/ai-readiness-agent/skills/lightspeed-launch-readiness-auditor/SKILL.md +++ b/agents/ai-readiness-agent/skills/lightspeed-launch-readiness-auditor/SKILL.md @@ -95,7 +95,7 @@ Use: ## Go/no-go rules -`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Every gate below must be satisfied, and the verdict must name any gate that is unmet. +`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Read each verdict against its own conditions rather than as one shared list: the nine gates apply to `Go`, the `Conditional Go` conditions apply instead when they are met, and any `No-Go` trigger on its own forces `No-Go` regardless of the others. Every condition that applies to the chosen verdict must be satisfied, and the verdict must name any that is unmet. - `Go`: no launch blockers remain; critical pages pass QA; redirects are tested or not required; forms and conversion routes work; analytics and tracking are tested; privacy/policy pages are present; accessibility testing found no critical blockers; indexing controls are correct; and a rollback plan exists. All nine gates are required — "no blockers" alone is not sufficient. - `Conditional Go`: no blockers remain; high-risk issues are non-critical or explicitly accepted; every issue has a named owner and a target date; and post-launch monitoring is agreed. diff --git a/agents/design-partner-agent/skills/design-md-generator/SKILL.md b/agents/design-partner-agent/skills/design-md-generator/SKILL.md index 0609c4f7dd..f8500638df 100644 --- a/agents/design-partner-agent/skills/design-md-generator/SKILL.md +++ b/agents/design-partner-agent/skills/design-md-generator/SKILL.md @@ -221,7 +221,7 @@ The official CLI (`@google/design.md`) exposes these default lint rules. This li 10. `token-like-ignored` — warning when a top-level YAML key looks like a token map but is not part of the export schema, so it will be silently ignored. 11. `omitted-rules` — info for `omitted:` declarations. Emits the sub-rule ids `declared-omission` (info), `redundant-omission` (warning, when a section is listed as omitted but its tokens exist) and `unknown-omission` (warning, for an unrecognised name in `omitted`). -Rules 9 and 10 existed in 0.3.0; rules 10 and 11 arrived in 0.4.0. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. +`unknown-key` (rule 9) existed in 0.3.0, which ran eight rules. `token-like-ignored` (10) and `omitted-rules` (11) arrived in 0.4.0, which runs eleven. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. ## Companion CI Bundle diff --git a/agents/discovery-agent/skills/design-md-generator/SKILL.md b/agents/discovery-agent/skills/design-md-generator/SKILL.md index 0609c4f7dd..f8500638df 100644 --- a/agents/discovery-agent/skills/design-md-generator/SKILL.md +++ b/agents/discovery-agent/skills/design-md-generator/SKILL.md @@ -221,7 +221,7 @@ The official CLI (`@google/design.md`) exposes these default lint rules. This li 10. `token-like-ignored` — warning when a top-level YAML key looks like a token map but is not part of the export schema, so it will be silently ignored. 11. `omitted-rules` — info for `omitted:` declarations. Emits the sub-rule ids `declared-omission` (info), `redundant-omission` (warning, when a section is listed as omitted but its tokens exist) and `unknown-omission` (warning, for an unrecognised name in `omitted`). -Rules 9 and 10 existed in 0.3.0; rules 10 and 11 arrived in 0.4.0. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. +`unknown-key` (rule 9) existed in 0.3.0, which ran eight rules. `token-like-ignored` (10) and `omitted-rules` (11) arrived in 0.4.0, which runs eleven. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. ## Companion CI Bundle diff --git a/scripts/validation/__tests__/validate-badge-urls.test.js b/scripts/validation/__tests__/validate-badge-urls.test.js index 70521bb0f7..9cb7a4eb51 100644 --- a/scripts/validation/__tests__/validate-badge-urls.test.js +++ b/scripts/validation/__tests__/validate-badge-urls.test.js @@ -1,4 +1,10 @@ -const { BROKEN_BADGE, findBrokenBadges, repairContent } = require('../validate-badge-urls.cjs'); +const { + BROKEN_BADGE, + findBrokenBadges, + isBrokenBadgeDestination, + repairContent, + splitDestination, +} = require('../validate-badge-urls.cjs'); /** One badge exactly as the generator used to emit it, with a bare space. */ const BROKE_SPACES = @@ -95,17 +101,100 @@ describe('validate-badge-urls', () => { }); }); + describe('splitDestination', () => { + it('separates a quoted title from the destination', () => { + const parsed = splitDestination('https://img.shields.io/badge/X-OK-green.svg "Build status"'); + expect(parsed.destination).toBe('https://img.shields.io/badge/X-OK-green.svg'); + expect(parsed.title).toBe('"Build status"'); + }); + + it('separates a title from a destination that itself contains spaces', () => { + // A broken badge has spaces in its URL by definition, so a `\\S+` prefix + // would never match and the title would be swallowed into the path. + const parsed = splitDestination( + 'https://img.shields.io/badge/Docs Validation-OK-success.svg "Tip"' + ); + expect(parsed.destination).toBe( + 'https://img.shields.io/badge/Docs Validation-OK-success.svg' + ); + expect(parsed.title).toBe('"Tip"'); + }); + + it('returns no title when there is none', () => { + expect(splitDestination(BROKE_SPACES).title).toBe(''); + }); + }); + + describe('isBrokenBadgeDestination', () => { + it('treats a space inside the shields path as broken', () => { + expect( + isBrokenBadgeDestination('https://img.shields.io/badge/Docs Validation-OK-success.svg') + ).toBe(true); + }); + + it('treats a space-free shields URL as sound', () => { + expect(isBrokenBadgeDestination('https://img.shields.io/badge/Checks-OK-success.svg')).toBe( + false + ); + }); + + it('ignores a non-shields host', () => { + expect(isBrokenBadgeDestination('https://example.com/a b.svg')).toBe(false); + }); + }); + + describe('image titles', () => { + // Markdown permits a quoted title after the destination. Treating it as + // part of the URL made a valid badge report as broken, and `--fix` then + // percent-encoded the title into the path and corrupted it. + const withTitle = '![X](https://img.shields.io/badge/X-OK-green.svg "Build status")'; + + it('does not report a valid badge that carries a title', () => { + expect(findBrokenBadges(withTitle)).toHaveLength(0); + }); + + it('leaves a titled badge unchanged under repair', () => { + expect(repairContent(withTitle)).toBe(withTitle); + }); + + it('repairs the destination while keeping the title', () => { + const broken = '![Docs](https://img.shields.io/badge/Docs Validation-OK-success.svg "Tip")'; + expect(repairContent(broken)).toBe( + '![Docs](https://img.shields.io/badge/Docs%20Validation-OK-success.svg "Tip")' + ); + }); + }); + + describe('nested fences', () => { + // A four-backtick example may contain a three-backtick block. Toggling on + // every fence-like line ends the block early and rewrites badge examples + // inside documentation. + const nested = ['````markdown', '```', BROKE_SPACES, '```', '````', ''].join('\n'); + + it('ignores a badge inside a nested fence', () => { + expect(findBrokenBadges(nested)).toHaveLength(0); + }); + + it('leaves a nested fence unchanged under repair', () => { + expect(repairContent(nested)).toBe(nested); + }); + }); + describe('BROKEN_BADGE', () => { it('matches the bare-space form', () => { BROKEN_BADGE.lastIndex = 0; expect(BROKEN_BADGE.test(BROKE_SPACES)).toBe(true); }); - it('does not match an encoded destination', () => { + // The pattern deliberately matches any image; whether that image is a + // broken badge is decided by isBrokenBadgeDestination. Keeping the two + // apart is what lets a titled badge and an encoded URL be handled as steps + // rather than as nested capture groups. + it('matches an encoded badge, which the destination check then rejects', () => { + const encoded = '![X](https://img.shields.io/badge/A%20B-OK-success.svg)'; BROKEN_BADGE.lastIndex = 0; - expect(BROKEN_BADGE.test('![X](https://img.shields.io/badge/A%20B-OK-success.svg)')).toBe( - false - ); + expect(BROKEN_BADGE.test(encoded)).toBe(true); + expect(findBrokenBadges(encoded)).toHaveLength(0); }); }); }); diff --git a/scripts/validation/validate-badge-urls.cjs b/scripts/validation/validate-badge-urls.cjs index 20bd9d3c87..fb208a67f4 100644 --- a/scripts/validation/validate-badge-urls.cjs +++ b/scripts/validation/validate-badge-urls.cjs @@ -46,11 +46,63 @@ const path = require('path'); * Adding it blind would mean guessing at a shape with no evidence to test * against. * - * Group 1 is the alt text, group 2 the destination, so a repair can keep the - * accessible name and rewrite only the URL. + * Markdown permits an optional quoted title after the destination, as in + * `![X](https://example.com/a.svg "Build status")`. A title is not part of the + * URL, so it is excluded from the capture and from the repair; without that, + * `--fix` would percent-encode the title into the path and corrupt a valid + * badge. + * + * Group 1 is the alt text, group 2 is everything inside the parentheses. The + * destination and the optional title are separated explicitly by + * `splitDestination` rather than by one more regex, because the two cases that + * must not be reported — an already-encoded URL and a quoted title — are easier + * to get right as steps than as nested groups. + */ +const BROKEN_BADGE = /!\[([^\]]*)\]\(([^)]*)\)/gu; + +const SHIELDS_HOST = 'https://img.shields.io/'; + +/** + * Split the inside of an image into its destination and optional title. + * + * Markdown allows a quoted title after the destination, separated by + * whitespace. The title is not part of the URL, so a badge that carries one is + * not a broken-URL case, and encoding the title into the path would corrupt it. + * + * @param {string} inner Contents between the image's parentheses. + * @returns {{destination: string, title: string}|null} Null when unparseable. */ -const BROKEN_BADGE = - /!\[\s*([^\]]*?)\s*\]\(\s*(https:\/\/img\.shields\.io\/[^)\s]*\s[^)]*?)\s*\)/gu; +function splitDestination(inner) { + const text = inner.trim(); + if (text === '') { + return null; + } + + // Anchor on the shields host rather than on non-space characters: the + // destination of a *broken* badge contains spaces by definition, so a + // `\S+` prefix would never match it and the title would be swallowed. + const quoted = text.match(/^(https:\/\/img\.shields\.io\/.*?)\s+("[^"]*")$/u); + if (quoted) { + return { destination: quoted[1], title: quoted[2] }; + } + return { destination: text, title: '' }; +} + +/** + * Whether one image's destination is a shields.io URL broken by a space. + * + * A space is only a defect when it sits inside the shields.io path, since that + * is where the URL ends. A space between the destination and a title is not. + * + * @param {string} destination Image destination. + * @returns {boolean} + */ +function isBrokenBadgeDestination(destination) { + if (!destination.startsWith(SHIELDS_HOST)) { + return false; + } + return destination.slice(SHIELDS_HOST.length).includes(' '); +} /** Directories never walked, matching the other repository validators. */ const SKIP_DIRECTORIES = new Set(['node_modules', '.git', 'coverage', 'dist', 'build', 'vendor']); @@ -64,9 +116,58 @@ const SKIP_DIRECTORIES = new Set(['node_modules', '.git', 'coverage', 'dist', 'b * is legal in a shields.io path and is left readable. The alt text is preserved * exactly, since it is the accessible name and not the defect. */ -function repairBadge(_match, altText, destination) { - const encoded = destination.trim().replace(/\s+/gu, '%20'); - return `![${altText}](${encoded})`; +/** + * Tracks fenced code blocks using CommonMark's closing rules. + * + * A fence closes only on a marker of the same character that is at least as + * long as the opening run and carries nothing but whitespace after it. Toggling + * on any fence-like line misreads a four-backtick example that contains a + * three-backtick block, which is how badge examples inside documentation would + * be rewritten as if they were live badges. + */ +function createFenceTracker() { + let marker = null; + let length = 0; + + return { + consume(line) { + const match = line.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/u); + if (marker === null) { + if (match) { + if (match[1].startsWith('`') && match[2].includes('`')) { + return false; + } + marker = match[1][0]; + length = match[1].length; + return true; + } + return false; + } + if (match && match[1][0] === marker && match[1].length >= length && match[2].trim() === '') { + marker = null; + length = 0; + } + return true; + }, + }; +} + +/** + * Whether a line carries at least one image whose destination is broken. + * + * @param {string} line Single line of Markdown. + * @returns {boolean} + */ +function lineHasBrokenBadge(line) { + BROKEN_BADGE.lastIndex = 0; + let match; + while ((match = BROKEN_BADGE.exec(line)) !== null) { + const parsed = splitDestination(match[2]); + if (parsed && isBrokenBadgeDestination(parsed.destination)) { + return true; + } + } + return false; } /** @@ -77,25 +178,29 @@ function repairBadge(_match, altText, destination) { */ function findBrokenBadges(content) { const findings = []; - let inFence = false; + const fence = createFenceTracker(); content.split(/\r?\n/u).forEach((line, index) => { - // A fenced block holds an example, not a rendered badge, so track the - // fence rather than only skipping its opening line. - if (/^\s*(?:```|~~~)/u.test(line)) { - inFence = !inFence; + // A fenced block holds an example, not a rendered badge. + if (fence.consume(line)) { return; } - if (inFence) { - return; - } - BROKEN_BADGE.lastIndex = 0; - if (BROKEN_BADGE.test(line)) { + if (lineHasBrokenBadge(line)) { findings.push({ lineNumber: index + 1, line }); } }); return findings; } +function repairBadge(match, altText, inner) { + const parsed = splitDestination(inner); + if (!parsed) { + return match; + } + const encoded = parsed.destination.replace(/\s+/gu, '%20'); + const title = parsed.title ? ` ${parsed.title}` : ''; + return `![${altText}](${encoded}${title})`; +} + /** * Apply the repair to every line that carries a broken badge. * @@ -103,20 +208,19 @@ function findBrokenBadges(content) { * @returns {string} Repaired contents. */ function repairContent(content) { - let inFence = false; + const fence = createFenceTracker(); return content .split(/\r?\n/u) .map((line) => { - if (/^\s*(?:```|~~~)/u.test(line)) { - inFence = !inFence; - return line; - } - if (inFence) { + if (fence.consume(line)) { return line; } - return line.replace(BROKEN_BADGE, (match, altText, destination) => - repairBadge(match, altText, destination) - ); + return line.replace(BROKEN_BADGE, (match, altText, inner) => { + const parsed = splitDestination(inner); + return parsed && isBrokenBadgeDestination(parsed.destination) + ? repairBadge(match, altText, inner) + : match; + }); }) .join('\n'); } @@ -209,8 +313,12 @@ function main() { module.exports = { BROKEN_BADGE, + createFenceTracker, findBrokenBadges, + isBrokenBadgeDestination, + lineHasBrokenBadge, repairContent, + splitDestination, }; if (require.main === module) { diff --git a/skills/design-md-agent/design-md-generator/SKILL.md b/skills/design-md-agent/design-md-generator/SKILL.md index b4f51602ce..8f67dba53d 100644 --- a/skills/design-md-agent/design-md-generator/SKILL.md +++ b/skills/design-md-agent/design-md-generator/SKILL.md @@ -221,7 +221,7 @@ The official CLI (`@google/design.md`) exposes these default lint rules. This li 10. `token-like-ignored` — warning when a top-level YAML key looks like a token map but is not part of the export schema, so it will be silently ignored. 11. `omitted-rules` — info for `omitted:` declarations. Emits the sub-rule ids `declared-omission` (info), `redundant-omission` (warning, when a section is listed as omitted but its tokens exist) and `unknown-omission` (warning, for an unrecognised name in `omitted`). -Rules 9 and 10 existed in 0.3.0; rules 10 and 11 arrived in 0.4.0. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. +`unknown-key` (rule 9) existed in 0.3.0, which ran eight rules. `token-like-ignored` (10) and `omitted-rules` (11) arrived in 0.4.0, which runs eleven. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. ## Companion CI Bundle diff --git a/skills/design-md-agent/lightspeed-launch-readiness-auditor/SKILL.md b/skills/design-md-agent/lightspeed-launch-readiness-auditor/SKILL.md index 00a977c975..a141e15380 100644 --- a/skills/design-md-agent/lightspeed-launch-readiness-auditor/SKILL.md +++ b/skills/design-md-agent/lightspeed-launch-readiness-auditor/SKILL.md @@ -95,7 +95,7 @@ Use: ## Go/no-go rules -`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Every gate below must be satisfied, and the verdict must name any gate that is unmet. +`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Read each verdict against its own conditions rather than as one shared list: the nine gates apply to `Go`, the `Conditional Go` conditions apply instead when they are met, and any `No-Go` trigger on its own forces `No-Go` regardless of the others. Every condition that applies to the chosen verdict must be satisfied, and the verdict must name any that is unmet. - `Go`: no launch blockers remain; critical pages pass QA; redirects are tested or not required; forms and conversion routes work; analytics and tracking are tested; privacy/policy pages are present; accessibility testing found no critical blockers; indexing controls are correct; and a rollback plan exists. All nine gates are required — "no blockers" alone is not sufficient. - `Conditional Go`: no blockers remain; high-risk issues are non-critical or explicitly accepted; every issue has a named owner and a target date; and post-launch monitoring is agreed. diff --git a/skills/design-md-agent/wordpress-pattern-generator/SKILL.md b/skills/design-md-agent/wordpress-pattern-generator/SKILL.md index e6298e012b..1c031aa799 100644 --- a/skills/design-md-agent/wordpress-pattern-generator/SKILL.md +++ b/skills/design-md-agent/wordpress-pattern-generator/SKILL.md @@ -108,9 +108,9 @@ WordPress has two kinds of starter pattern, and they are registered differently. A page pattern appears in the new-post-type picker only when all of the following hold: - `Block Types` includes `core/post-content`. This is the hard gate: the editor filters the registered patterns down to those carrying that block type before it looks at anything else, so a pattern with `Post Types: page` but no `Block Types` never appears. -- `Post Types` includes the post type, or is omitted. With no `Post Types` the pattern is offered for pages. +- `Post Types` names the post types the pattern is offered for. Omitting the field does **not** mean every post type: the filter accepts an absent `postTypes` only when the current post type is `page`, so an omitted field offers the pattern for pages alone. -So a page starter pattern needs only `Block Types: core/post-content`. Add `Post Types: page` to restrict it to pages; omit the field and the pattern is offered for every post type that uses the block editor. The core filter is: +So a page starter pattern needs only `Block Types: core/post-content`. Omitting `Post Types` offers it for pages, which is the same outcome as `Post Types: page`; naming other post types as well widens it, for example `page, wp_template`. The core filter is: ```js ( postType === 'page' && ! pattern.postTypes ) || @@ -237,7 +237,7 @@ Expected behaviour: - output a complete pattern file - use a suitable core category where possible -- include `Block Types: core/post-content`; that alone makes it a starter page pattern. `Post Types: page` is optional and only scopes it to pages — without it the pattern is offered for every post type that uses the block editor +- include `Block Types: core/post-content`; that alone makes it a starter page pattern. `Post Types` is optional and names which post types see it — omit it, or use `page`, and the pattern is offered for pages - do not require `Template Types` here; this is a page starter, not a template starter - keep the output aligned with starter-pattern usage diff --git a/skills/design-md-generator/SKILL.md b/skills/design-md-generator/SKILL.md index 87d14055df..d63b2d2c10 100644 --- a/skills/design-md-generator/SKILL.md +++ b/skills/design-md-generator/SKILL.md @@ -221,7 +221,7 @@ The official CLI (`@google/design.md`) exposes these default lint rules. This li 10. `token-like-ignored` — warning when a top-level YAML key looks like a token map but is not part of the export schema, so it will be silently ignored. 11. `omitted-rules` — info for `omitted:` declarations. Emits the sub-rule ids `declared-omission` (info), `redundant-omission` (warning, when a section is listed as omitted but its tokens exist) and `unknown-omission` (warning, for an unrecognised name in `omitted`). -Rules 9 and 10 existed in 0.3.0; rules 10 and 11 arrived in 0.4.0. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. +`unknown-key` (rule 9) existed in 0.3.0, which ran eight rules. `token-like-ignored` (10) and `omitted-rules` (11) arrived in 0.4.0, which runs eleven. Treat a rule list from upstream prose as secondary: the bundled npm README lagged the code and listed a rule count that matched neither its own table nor the shipped binary. ## Companion CI Bundle diff --git a/skills/launch-readiness-auditor/SKILL.md b/skills/launch-readiness-auditor/SKILL.md index 4472f18432..22ca67f98f 100644 --- a/skills/launch-readiness-auditor/SKILL.md +++ b/skills/launch-readiness-auditor/SKILL.md @@ -95,7 +95,7 @@ Use: ## Go/no-go rules -`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Every gate below must be satisfied, and the verdict must name any gate that is unmet. +`references/go-no-go-rules.md` is the normative definition of these verdicts and is mandatory: the summary here is a reading aid, not a substitute. Read each verdict against its own conditions rather than as one shared list: the nine gates apply to `Go`, the `Conditional Go` conditions apply instead when they are met, and any `No-Go` trigger on its own forces `No-Go` regardless of the others. Every condition that applies to the chosen verdict must be satisfied, and the verdict must name any that is unmet. - `Go`: no launch blockers remain; critical pages pass QA; redirects are tested or not required; forms and conversion routes work; analytics and tracking are tested; privacy/policy pages are present; accessibility testing found no critical blockers; indexing controls are correct; and a rollback plan exists. All nine gates are required — "no blockers" alone is not sufficient. - `Conditional Go`: no blockers remain; high-risk issues are non-critical or explicitly accepted; every issue has a named owner and a target date; and post-launch monitoring is agreed. diff --git a/skills/wordpress-pattern-generator/SKILL.md b/skills/wordpress-pattern-generator/SKILL.md index 325c7b4e7f..5a6005c952 100644 --- a/skills/wordpress-pattern-generator/SKILL.md +++ b/skills/wordpress-pattern-generator/SKILL.md @@ -108,9 +108,9 @@ WordPress has two kinds of starter pattern, and they are registered differently. A page pattern appears in the new-post-type picker only when all of the following hold: - `Block Types` includes `core/post-content`. This is the hard gate: the editor filters the registered patterns down to those carrying that block type before it looks at anything else, so a pattern with `Post Types: page` but no `Block Types` never appears. -- `Post Types` includes the post type, or is omitted. With no `Post Types` the pattern is offered for pages. +- `Post Types` names the post types the pattern is offered for. Omitting the field does **not** mean every post type: the filter accepts an absent `postTypes` only when the current post type is `page`, so an omitted field offers the pattern for pages alone. -So a page starter pattern needs only `Block Types: core/post-content`. Add `Post Types: page` to restrict it to pages; omit the field and the pattern is offered for every post type that uses the block editor. The core filter is: +So a page starter pattern needs only `Block Types: core/post-content`. Omitting `Post Types` offers it for pages, which is the same outcome as `Post Types: page`; naming other post types as well widens it, for example `page, wp_template`. The core filter is: ```js ( postType === 'page' && ! pattern.postTypes ) || @@ -237,7 +237,7 @@ Expected behaviour: - output a complete pattern file - use a suitable core category where possible -- include `Block Types: core/post-content`; that alone makes it a starter page pattern. `Post Types: page` is optional and only scopes it to pages — without it the pattern is offered for every post type that uses the block editor +- include `Block Types: core/post-content`; that alone makes it a starter page pattern. `Post Types` is optional and names which post types see it — omit it, or use `page`, and the pattern is offered for pages - do not require `Template Types` here; this is a page starter, not a template starter - keep the output aligned with starter-pattern usage From 66f328b1903c58dff260867167dca37923322ccb Mon Sep 17 00:00:00 2001 From: Chris Vancoillie Date: Sun, 4 Oct 2026 13:11:37 +0200 Subject: [PATCH 6/6] Add the changelog entry for the skill documentation fixes --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4f05ed126..4e3936d662 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- **Skill Instructions Match Their References** — Twelve skill files no longer offer status labels, options or gates that their own reference files do not define, so agents follow instructions that exist. (#3716) - **Markdown Commit Check Works After A Stale Install** — Fixed the staged-Markdown commit check crashing on a working copy installed before a tooling upgrade. It now accepts the older version and lints as normal. (#3785) - **Bare Jest Uses the Intended Config** — The broken root Jest config is gone and a root `jest.config.cjs` now forwards to `.jest.config.cjs`, so bare `npx jest` no longer runs 76 suites this repository excludes. (#3711)