"""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()