Audit type ownership

From compartmentdev/compartment · View interactive version

Audit type ownership is an AI agent skill from the GitHub repository compartmentdev/compartment. Audit type ownership and boundary placement in the compartment repo: misplaced or duplicated types, query/service leaks, root export surface, and phased move plans.

How to use this skill

Skill file

Audit Type Ownership

Use this skill for non-mutating type ownership audits in the compartment repo.

Source of truth

Workflow

  1. Run node .codex/skills/audit-type-ownership/scripts/audit_type_ownership.mjs from the repo root.
  2. Narrow with --package <api|contracts|sdk|cli|edge|worker|docker|kube-runtime|utils|test-support> when the request is scoped. Use --format json only when a structured artifact is more useful than Markdown.
  3. Read the script output before making claims. It is a heuristic inventory, not proof.
  4. Treat declared workspace dependencies as package context, not automatic findings. A non-contracts import matters only when it is undeclared in the owning package or it conflicts with the relevant layer doc.
  5. Treat duplicate names as move candidates only when they imply a shared serialized or cross-package owner. Package-local families such as *Input, *Context, *Plan, *Result, *Options, *State, *Config, and *App can legitimately exist in multiple packages.
  6. Classify findings with this matrix:
  1. Treat cross-process or cross-package payloads as contract-owned, even when the current consumer is internal.
  2. Treat query/service boundary leakage and placement violations from docs/specs/type-placement.md as ownership bugs, including generic src/types/, routes/shared/, and route DTO mappers outside *.presenter.ts.
  3. If the audit turns into implementation, run the narrowest relevant package checks first and then add any required special checks for the diff.

Default scope

Output

Script

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.