Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

prepass-workflow-integrity.py: builder's own template fails it, any NN-name.md text is a 'missing stage', and fenced headings count as sections #149

Open

Description

@CloneOfAlex

Describe the bug

skills/bmad-workflow-builder/scripts/prepass-workflow-integrity.py feeds the Analyze lenses (references/scan-orchestration.md). It has three defects that make the integrity result wrong for most skills.

1. The builder's own template fails its own pre-pass. check_required_sections() requires ## Overview (high). But assets/SKILL-template.md, which init_skill.py scaffolds from, has no Overview section, only ## Resolution rules, ## On Activation and ## {Body}. So every freshly scaffolded skill starts at status: warning. Running the pre-pass over this repo flags 7 of 12 skills, including bmad-workflow-builder, bmad-agent-builder and every agent sample. bmad-eval-runner is also missing ## On Activation.

2. Any NN-name.md token is treated as a stage reference. The regex (?:prompts/)?(\d+-[^\s)]+.md)matches anywhere in SKILL.md:references/01-intro.md, URLs like https://example.com/docs/2-setup.md`, and dates in filenames. Each match that isn't a root-level stage file becomes a critical "Referenced stage file does not exist", so status: fail.

3. Headings inside fenced code blocks count as real sections. A SKILL.md whose only ## Overview / ## On Activation appear inside a fenced example passes the required-section check.

Steps to reproduce

P=skills/bmad-workflow-builder/scripts
uv run $P/init_skill.py --name fresh --dest /tmp/r2
uv run $P/prepass-workflow-integrity.py /tmp/r2/fresh        # warning: Missing ## Overview section
for d in skills/*/ samples/*/; do uv run $P/prepass-workflow-integrity.py $d | jq -r '.status'; done   # 7 x warning

mkdir -p /tmp/refs/references && cd /tmp/refs && echo intro > references/01-intro.md
printf -- '---\nname: refs\ndescription: Does x. Use when asked.\n---\n# refs\n\n## Overview\nx\n\n## On Activation\nLoad `references/01-intro.md` and see https://example.com/docs/2-setup.md\n' > SKILL.md
uv run $P/prepass-workflow-integrity.py /tmp/refs
# fail: critical "Referenced stage file does not exist: 01-intro.md" and "...: 2-setup.md"

mkdir -p /tmp/fence && printf -- '---\nname: fence\ndescription: Does x. Use when asked.\n---\n# fence\n\n```markdown\n## Overview\n## On Activation\n```\n\n## Usage\nRun it.\n' > /tmp/fence/SKILL.md
uv run $P/prepass-workflow-integrity.py /tmp/fence             # pass; sections: Overview, On Activation, Usage

Expected behavior

  1. The template and the pre-pass agree: either add ## Overview to SKILL-template.md (as references/standard-fields.md describes), or drop or relax the requirement in the pre-pass. Add a test that runs the pre-pass on a fresh init_skill.py skill.
  2. Only count references that resolve to the skill root (bare NN-name.md or prompts/NN-name.md, not preceded by another path segment or ://), and skip fenced code and URLs.
  3. Ignore headings inside fenced blocks (``` and ~~~, any indent) when building the section inventory.

Environment

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions