audit-encapsulation
Why this skill exists
Skills have a public API and a private body — the contract is context/public-surface-contract.md (bundled with this skill). External consumers — rules, agents, other skills, prose docs — must cite the public surface only. Editing the private body must not break external consumers because no external consumer is allowed to depend on it.
Without enforcement, private bodies leak. A rule file cites a path inside <skill>/<some-subdir>/ because the content is convenient. The skill author refactors that subdir and the citation breaks silently — nothing fails the build, nothing greps red. The skill cannot evolve without coordinating with every leaker.
This skill provides the detection + classification + remediation discipline that closes that gap. Distinct concern from /extract-ssot (which detects content duplication via Rule of Three). Encapsulation violations are single-violation matters — Rule of Three does not gate them.
Public surface matrix
The Skill surface — public = frontmatter + documented actions + args/flags + /skill-name slash invocation + the scripts/ entry surface; private = everything else inside .claude/skills/<X>/ (any OTHER subdirectory, all *.schema.json at any depth, all heading anchors) — is defined by context/public-surface-contract.md, including the data-file and scripts/ entry-surface carve-outs and the rip-and-paste-portability rationale. This skill audits cites against two more authoring surfaces the contract file does not enumerate:
| Surface | Public (cite externally) | Private |
|---|---|---|
Rule file (.claude/rules/*.md) |
All H2/H3 headings (entire file is shared vocabulary) | n/a |
Scheduled-automation prompt (e.g. .claude/routines/*.md, if the consumer repo keeps them) |
Top-of-file orchestration prompt | Internal exclusion lists, escape conditions |