Files
MyAiConfiguration/scripts/lib/skill-contracts.py
T
Julian LechnerandClaude Opus 5.5 b8b4438275 fix(install): handle 8.3 source paths, bound plugin delegation, check skill contracts
Sync-ManagedDestination and Copy-Directory cut relative paths by the
length of $Source. With an 8.3 short path such as JULIAN~1, Get-ChildItem
returned long paths, so files landed under a truncated directory name.
Both now expand $Source with Get-Item first.

PowerShell tests now pass -ExecutionPolicy Bypass, tolerate non-UTF-8
console output, and give the Git Bash quick update 300 seconds.

The orchestration rule now covers plugin workflows. A plugin default
alone never authorizes subagents, per-task reviews stay proportional,
parallel writers get disjoint files, and plugin agents keep to their
specialty inside the shared handoff format.

doctor warns when an installed Impeccable or Apple Design skill no
longer names the commands and sections plugin-workflow relies on.
Prompt budget baselines are refreshed to the current values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 09:31:00 +01:00

49 lines
2.1 KiB
Python

"""Doctor check: installed upstream skills still offer what plugin-workflow's UI section names."""
import argparse
from pathlib import Path
# Keep in sync with the Impeccable and Apple Design section of shared/skills/plugin-workflow/SKILL.md.
CONTRACTS = {
'impeccable': ('Impeccable', ['critique', 'audit', 'harden', 'adapt', 'clarify', 'layout', 'typeset', 'polish',
'shape', 'craft-floor', 'Operate', 'Persuade']),
'apple-design': ('Apple Design', ['Always load', 'Lens 1', 'Lens 5', 'Critical', 'Design improvement mode',
'cross-platform']),
}
def installed_skill_files(home, skill):
candidates = [home / '.claude/skills' / skill / 'SKILL.md', home / '.agents/skills' / skill / 'SKILL.md',
home / '.codex/skills' / skill / 'SKILL.md']
cache = home / '.claude/plugins/cache' / skill / skill
if cache.is_dir():
versions = sorted((p for p in cache.iterdir() if (p / 'skills' / skill / 'SKILL.md').is_file()),
key=lambda p: tuple(int(part) if part.isdigit() else 0 for part in p.name.split('.')))
if versions:
candidates.append(versions[-1] / 'skills' / skill / 'SKILL.md')
return [path for path in candidates if path.is_file()]
def check(home):
results = []
for skill, (name, tokens) in CONTRACTS.items():
for path in installed_skill_files(home, skill):
text = path.read_text(encoding='utf-8', errors='replace')
missing = [token for token in tokens if token not in text]
if missing:
results.append(('WARN', f'{name} at {path.parent} no longer mentions {", ".join(missing)}; '
'review the UI section of plugin-workflow'))
else:
results.append(('PASS', f'{name} at {path.parent} matches the plugin-workflow coordination'))
return results
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--home', required=True)
for status, message in check(Path(parser.parse_args().home)):
print(f'{status} {message}')
if __name__ == '__main__':
main()