Repository navigation
feat(openehr-specs): add scaffold skill for the standard specification-repo file set - #6
Merged
Merged
Conversation
…n-repo file set /openehr-specs:scaffold initialises a specification repository, or brings an existing one up to the standard file set. It is a user-only skill, so it adds nothing to the always-on context. A stdlib-only script (scripts/scaffold.py) does the file work; the skill plans first, asks the user to confirm guessed variables, and applies only what was approved. Files and how each is kept up to date: - AGENTS.md: managed regions (plugin table, Docker build, Jira-key commit and branch conventions) between markers; the rest is the repo's own. - .claude/settings.json: merged; registers the openehr marketplace and enables openehr-specs. Items the user removed are not added back. - .gitignore, .asciidoctorconfig: missing lines appended. - manifest.json, LICENSE (CC BY-SA 3.0, or Apache 2.0 for ITS-*), README.md: written once, never changed. - .claude/CLAUDE.md: replaced only while unedited since it was scaffolded. The file set is versioned (assets/template-set.json: revision, variables, a strategy per file). Each scaffolded repo records its revision, variables and file hashes in .claude/scaffold.json, so a later run calculates the migration path to the latest revision and tells an edited file from an untouched one. Modes are init, upgrade (never scaffolded, or an older revision) and current. scripts/validate.py also checks the template set (templates render, revisions have migration files, the digest matches), and CI runs the 109 unit tests in scripts/test_scaffold.py. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
/openehr-specs:scaffold, a user-only skill that initialises a specification repository, or brings an existing one up to a standard file set. It adds nothing to the always-on context (disable-model-invocation: true).A stdlib-only script,
scripts/scaffold.py, does the file work. The skill plans first (nothing is written), asks the user to confirm any guessed variables, shows each file's action, and applies only what was approved.What it installs
AGENTS.mdopenehr-specs@openehrplugin table, the Docker build invocation, and the commit and branch conventions built around the Jira key (Changes for <KEY> - <what changed>). Text outside the markers is the repo's own and is never touched..claude/settings.jsonopenehrmarketplace and enablesopenehr-specs. Existing values win, and items the user removed are not added back..gitignore,.asciidoctorconfigmanifest.json,LICENSE,README.mdLICENSEis CC BY-SA 3.0, or Apache 2.0 forITS-*; an existingREADME.adoccounts as a README..claude/CLAUDE.mdVersioning and upgrades
assets/template-set.jsonis the schema: a revision number, the variables, and a strategy per file. Each scaffolded repo records its revision, variables and file hashes in.claude/scaffold.json. A later run compares the recorded revision with the latest, calculates the migration path (migrations/NNNN.json), and uses the hashes to tell an untouched file from a hand-edited one. A hand-edited file or region is reported as aconflictand is never overwritten without--overwrite. There are three modes:init,upgrade(some files exist, either never scaffolded or at an older revision) andcurrent.CI keeps this honest:
scripts/validate.pyruns the template-set check, which fails when a template, variable or file entry changes without a new revision and migration file.Other changes
scripts/validate.pychecks the template set (once per plugin) and reports an unimportable script as an error, not a traceback.scripts/test_scaffold.py, 109 tests)..gitignoreignores__pycache__/; READMEs,AGENTS.md,docs/testing.md,docs/skill-authoring.md,CONTRIBUTING.mdand the PR template are updated.For reviewers
specifications-*clones, recorded inreferences/maintaining.md. In BASE, RM and AM the leadingChanges for SPECXX-NN - …form dominates (154 commits against 24 with the key last), so it is primary. Across all nine key-heavy repos the trailing<text> (SPECXX-NN)form is more common (333 against 221), so the template says it is understood. The licence texts are byte-identical copies of BASE's and ITS-REST'sLICENSE.docs/*.html" comes from BASE's practice and itsAGENTS.md, not from every repo.README.md, as requested, but 15 of the 18 clones useREADME.adoc.exists-alternativestops a duplicate where one exists. Say if new repos should get.adoc.settings.jsongrants. The template mirrors BASE, RM and ITS-REST: three third-party plugins, pre-approvedgit add,git commitandgit diff, WebFetch onspecifications.openehr.org, and three read-only Atlassian MCP calls. The skill tells the user this before applying..claude/scaffold.jsonand notmanifest.json, which is human-owned and read by the publisher; a merge would reformat it and put hashes into every diff. I did not check every consumer ofmanifest.json.docs/versioning.md; no bump here, perCONTRIBUTING.md.plugin-dev:skill-reviewer,plugin-dev:plugin-validatorandfeature-dev:code-reviewereach read it. The findings that held up are fixed: CRLF and file-mode preservation, unpaired region markers, removed items staying removed, symlinks, atomic writes, clean JSON errors, and several documentation errors.scaffold.pytargets Python 3.8+.scripts/validate.py:26already usesdict | None, which fails on 3.8 and 3.9; CI runs 3.12, so I left it.Limits
specifications-ITS-RESTis OpenAPI built withmake, so itsAGENTS.mdneeds its own variant; until then pinagents,claude-mdandasciidoctorconfigthere.${CLAUDE_SKILL_DIR}(SKILL.md says what to do where it is not expanded).Checklist
python3 scripts/validate.pypasses (alsoclaude plugin validate plugins/openehr-specs --strict,scaffold.py check, andpython3 -m unittest discover -s scripts -p 'test_*.py', 109 tests)claude -p --plugin-dir …ran the skill twice (an empty directory, and a copy of BASE's root files), and followed the steps with no permission prompts. Those runs predate the final renames (adopttoupgrade, descriptor to.claude/scaffold.json), which are covered by the tests and a CLI run, not a live sessionUnreleased; no version bumpAGENTS.md; settings keys from the Claude Code docs; the licence texts are verbatim)🤖 Generated with Claude Code