skills/module-boundary-governance/SKILL.md
Define, audit, and migrate module boundary manifests for codebases that need explicit ownership and dependency rules. Use when Codex is creating a new module, adding a new nested layer, moving code across layers, changing a module's public entrypoints, checking an existing repo's boundary health, or replacing weaker boundary docs and conventions with a canonical manifest-based system.
npx skillsauth add grepug/skills module-boundary-governanceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill to keep module boundaries explicit before code changes make them fuzzy. Treat the boundary manifest as a small control surface: it should describe module ownership, public surface, internal layers, dependency direction, and review questions without becoming a second architecture codebase.
This skill works best alongside a planning workflow such as plan-driven-change. Use it to decide the owning module, choose whether a new nested layer is warranted, update or create the manifest, and run a boundary audit after implementation.
Prefer one manifest per major module root with nested layers inside the same file.
Use a separate manifest file only when a submodule is independently owned or reused and has meaningfully different boundary rules.
Keep automation strict for dependency direction and public entrypoints. Keep semantic placement review human-readable via purpose, allowed contents, forbidden contents, and audit questions.
Adopt manifests incrementally. Prefer small structural corrections over broad redesign.
Load this skill when any of these are true:
Skip this skill for one-line changes, isolated bug fixes that clearly stay within one layer, or edits that do not affect module ownership or public surface.
Inspect the repo's existing package, workspace, and feature seams before inventing new ones.
Answer these questions in order:
Prefer the existing major root over creating a new manifest. Only split out a new manifest when the submodule has distinct ownership and long-term independence.
Add a nested layer only if at least one of these is true:
Do not create a layer just because a folder exists.
If multiple new exceptions would be needed to make the current structure work, prefer redesigning the layer or module boundary instead of piling on exceptions.
Place the manifest at the major module root with a predictable name such as boundary.manifest.yml.
Use this schema shape:
version: 1
module:
name: app
root: clients/apple/Packages/App
owners:
- apple
purpose: >
App-owned product shell, canonical models, and feature workflow logic.
public:
- Sources/App/**
- Sources/Shared/Models/**
forbidden:
- reusable cache infrastructure
- generic UI-only component library code
layers:
- id: shared-models
paths:
- Sources/Shared/Models/**
purpose: Canonical app-owned model shapes.
may_depend_on: []
may_be_depended_on_by:
- feature-stores
- app-shell
contains:
- canonical entities
- stable read shapes
must_not_contain:
- transport orchestration
- feature-specific workflow policy
- id: feature-stores
paths:
- Sources/Shared/Features/*/Stores/**
purpose: Feature-owned business workflow and optimistic mutation logic.
may_depend_on:
- shared-models
- graphql-models
may_be_depended_on_by:
- feature-ui
- app-shell
contains:
- stores
- workflow coordinators
must_not_contain:
- reusable cache primitives
- general-purpose visual components
review:
checklist:
- Does every changed file map to a declared layer?
- Did any internal file become a de facto public API?
- Did business logic leak into an adapter or generic layer?
exceptions:
policy: explicit
require:
- reason
- owner
- expiry_or_followup
Keep the schema small. The most important machine-checkable fields are:
module.rootmodule.publiclayers[].pathslayers[].may_depend_onlayers[].may_be_depended_on_byKeep the semantics human-readable:
purposecontainsmust_not_containreview.checklistWhen the repo does not yet use manifests consistently, perform an adoption audit before introducing new files.
Inspect all existing boundary signals:
Produce these outputs:
Use this audit structure:
## Existing Boundary Audit
Current boundary artifacts:
- `AGENTS.md`
- `docs/rules/feature-placement.md`
- package-level folder conventions
Observed module seams:
- `servers/main`
- `shared/graphql-schema`
- `clients/apple/Packages/App`
Weaknesses:
- ownership rules live in prose only
- public entrypoints are not explicit
- some rules are duplicated across docs
Proposed canonical manifests:
- `servers/main/boundary.manifest.yml`
- `clients/apple/Packages/App/boundary.manifest.yml`
Migration risks:
- contributors may keep editing the old rules docs unless they are marked as superseded
Focus on the biggest seams first. Do not try to model every subfolder in the first pass.
Classify the repo before recommending manifest adoption:
ready
partially-ready
not-ready
Use this readiness structure:
## Boundary Readiness
Status: `partially-ready`
Signals:
- backend feature seams are mostly stable
- shared utilities and app-specific workflow code still mix in several folders
- current docs describe ownership, but code does not follow it consistently
Recommendation:
- adopt manifests for `servers/main` and `clients/apple/Packages/UIComponents`
- defer `clients/apple/Packages/App` broad layering until one small cleanup lands
Immediate next step:
- extract one mixed feature-policy helper out of the shared utility layer
If the repo is not-ready, say so directly. Do not pretend the manifest system will fix architectural chaos by itself.
Treat existing docs and conventions as source material, not as untouchable truth.
For each existing boundary artifact, classify it as one of:
keep as supporting guidancefold into manifestsupersede and removeUse this migration table shape:
## Boundary Migration
| Existing artifact | Decision | Replacement | Reason |
| --- | --- | --- | --- |
| `docs/rules/feature-placement.md` | keep as supporting guidance | `servers/main/boundary.manifest.yml`, `clients/apple/Packages/App/boundary.manifest.yml` | Good teaching document, but ownership rules should move to manifests |
| `docs/architecture/old-layers.md` | supersede and remove | `servers/main/boundary.manifest.yml` | Duplicates layer rules and will drift |
Migration rules:
Make the migration actionable. Do not stop at "this area should be cleaner." Spell out the concrete reorganization steps.
For any migration that changes structure, produce a file move map in this form:
## Boundary Migration Execution
Canonical target:
- `servers/main/boundary.manifest.yml`
File moves:
- move `servers/main/src/graphql/files/file-policy.ts` -> `servers/main/src/features/files/file-policy.ts`
- move `clients/apple/Packages/Utils/Sources/Utils/AgentSessionStore.swift` -> `clients/apple/Packages/App/Sources/Shared/Features/Agent/Stores/AgentSessionStore.swift`
- keep `clients/apple/Packages/UIComponents/Sources/UIComponents/ChatBubble.swift` in place
Folder reorganization:
- create `servers/main/src/features/files/storage/` for storage-driver implementations
- create `servers/main/src/features/files/persistence/` for repository implementations
- collapse `docs/rules/old-boundaries.md` into a short pointer to `servers/main/boundary.manifest.yml`
Follow-up cleanup:
- update imports after moving `file-policy.ts`
- update tests to point at the new package path
- remove the old empty folder once references are gone
Use imperative wording such as move, keep, create, rename, collapse, and remove.
When deciding whether to move a file, answer:
If the correct destination is clear, name the exact target path. Prefer move A -> B over vague advice like "put this in the feature layer."
If the correct destination is not safe to change now, say so explicitly:
defer moving \A` to `B` until <reason>`Use deferral sparingly. A deferred move must include a reason and the smallest follow-up step that would unblock it.
For messy repos, prefer a small migration slice with high value:
Do not propose broad folder churn without naming the concrete files or folders that move.
Default to the smallest structural change that makes the next boundary decision clearer.
Prefer:
Avoid:
When the repo is messy, this skill should usually propose a small restructuring slice, not a significant redesign.
If a planning document exists, require a dedicated ## Boundary section.
Use this shape:
## Boundary
Owning manifest: `servers/main/boundary.manifest.yml`
Affected layers:
- `graphql`
- `features`
- `files-storage`
Manifest changes:
- [ ] none
- [x] add nested `files-storage` layer
- [ ] public surface changed
Boundary risk:
- resolver logic may absorb storage policy unless the service seam stays explicit
Require the plan to answer:
If the task is an adoption or migration task, also include:
Run a boundary audit after the implementation checklist is done.
Use this audit shape:
## Boundary Audit
Owning manifest: `servers/main/boundary.manifest.yml`
Touched layers:
- `graphql`
- `features`
Results:
- [x] Every changed file maps to a declared layer
- [x] No new undeclared public entrypoints
- [x] Dependency direction remains valid
- [ ] Manifest unchanged
Risks:
- resolver mappers are still adjacent to service logic; watch for drift in follow-up changes
Check all of the following:
must_not_contain ruleAny audit gap becomes a new work item before the task is considered done.
When this skill is paired with plan-driven-change, require it before finalizing the plan if the change:
The expected handoff back to plan-driven-change is:
## Boundary contentdevelopment
Measure and safely clean reclaimable macOS developer storage, including Xcode, simulator, CoreDevice, rebuildable project artifacts, Docker or OrbStack, VS Code, app cache, WeChat media, and Time Machine local snapshots.
development
Govern inline documentation coverage and comment quality in repo-owned source files. Use when Codex needs to audit or fix file headers, type docs, function or method contract docs, non-obvious inline comments, generated-file exclusions, or repo documentation rules for TypeScript, JavaScript, and Swift projects, including setting up a reusable docs/rules policy in a project-agnostic way.
tools
产品无关的 Linear 工作流,用于创建、更新、检查和讨论产品 issue、元数据、状态、范围、确认事项和长期产品文档同步。
data-ai
One-sentence summary of what this skill helps an agent do and when it should be used.