Skip to content

fix(build): deduplicate skill trees and mark generated files - #2

Open
smestern wants to merge 1 commit into
mainfrom
fix/skill-tree-duplication
Open

fix(build): deduplicate skill trees and mark generated files#2
smestern wants to merge 1 commit into
mainfrom
fix/skill-tree-duplication

Conversation

@smestern

Copy link
Copy Markdown
Owner

Resolves #1.

Diagnosis. Three skill trees existed because they play different roles, but that wasn't documented and one was committed by mistake:

Path Role Tracked?
templates/skills/ Source of truth ✅ yes
build/plugin/sciagent/skills/ Local build cache (default build_plugin.py output) ❌ no — was tracked by accident
dist/sciagent/skills/ CI artifact (compact profile, sci- prefix; mirrored to smestern/sciagent-plugin) ✅ yes, regenerated by build-plugin.yml

The dist/ content legitimately differs from templates/ because CI builds it with --profile compact --name-prefix sci, which merges some skills (e.g. code-reviewer + rigor-reviewerreview) and prefixes agent names. The build/plugin/ copy had no business being in git — it was a stale local build that snuck into a commit.

Changes

  1. Drop the !build/plugin/** exception from .gitignore and untrack the 8 stray files (git rm --cached).
  2. Inject an AUTO-GENERATED … DO NOT EDIT banner into every generated .md so it's unambiguous which file is the source. The banner is YAML # comments placed inside the frontmatter, so line 1 is still --- and the file remains a valid SKILL.md / agent spec for Copilot, Claude Code, and _split_frontmatter. HTML-comment fallback for files without frontmatter. Banner ruler uses = to avoid colliding with the --- delimiter.
  3. _merge_skill_bodies() now synthesises a proper top-level YAML frontmatter block (name + description, argument-hint inherited from the first source). Previously, the merged review skill in dist/ had no top-level frontmatter and would not load as a real skill — pre-existing bug surfaced by the new E2E test below.
  4. Source-of-truth callout in templates/README.md.
  5. New regression tests (tests/test_build_plugin.py, 5 tests): banner injection edge cases + E2E assertion that every dist/sciagent/**/*.md parses as valid frontmatter with a name: field.

Out of this PR by design

  • dist/sciagent/ is left at origin/main here; build-plugin.yml will regenerate and commit it on merge (force-adds via git add -f), picking up the new banners and the merged-skill frontmatter fix automatically.

Testing

pytest tests/ -m "not live" → 57 passed.

Credit to @yarikoptic for spotting and reporting the duplication.

Resolves #1. Three skill trees existed because build/plugin/** was accidentally tracked alongside the true source (templates/) and the legitimate CI artifact (dist/sciagent/, compact profile, sci- prefix). This made it unclear which copy was canonical and invited drift from direct edits to generated files.

Changes:

* .gitignore: drop !build/plugin/** exception so the local build cache is no longer tracked.

* git rm --cached build/plugin/sciagent/** (8 files): untrack accidentally committed build output.

* scripts/build_plugin.py: every generated .md now carries an AUTO-GENERATED / DO NOT EDIT banner identifying its source template and regen command. Banner is injected as YAML # comments inside existing frontmatter (preserves line-1 ---, required by Copilot/Claude SKILL parsers and by _split_frontmatter); HTML-comment fallback for files without frontmatter. Banner ruler uses = to avoid colliding with the --- frontmatter delimiter.

* scripts/build_plugin.py: _merge_skill_bodies now synthesises a proper top-level YAML frontmatter block (name + description, with argument-hint inherited from first source if available). Previously, merged skills (e.g. compact-profile review) emitted no top-level frontmatter and were malformed/unloadable.

* templates/README.md: source-of-truth callout pointing readers at the build pipeline.

* tests/test_build_plugin.py: 5 regression tests covering banner injection and an E2E check that every generated dist/sciagent/**/*.md starts with parseable YAML frontmatter containing 'name:'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

remove/reduce duplication among skills

1 participant