/structure:setting-up-import-boundariesfrom structure
Use when the user wants to enforce which module may import which in a repo, add layer rules, keep sibling modules independent, forbid imports of internals, or set up import-linter (Python) or dependency-cruiser (TypeScript). Surveys the repo's modules, writes per-repo contracts with the user, and wires them into mise lint and CI with failure messages that say what to do.
Ships in structure. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A deep module hides its inside behind a small interface (John Ousterhout, "A Philosophy of Software Design"). Imports that reach past the interface, or run the wrong way between layers, undo that. This skill writes rules that fail lint when code breaks a boundary: import-linter contracts for Python, dependency-cruiser rules for TypeScript.
Rules belong to one repo. Write them from what this repo's modules are, with the user; never copy them from another repo or a shared config.
Platforms. Shell and file tools only, so it runs the same in Claude Code, Codex and Cursor.
setting-up-the-checks.Find the language and the top modules: pyproject.toml and the packages under src/ or the root for Python; package.json, tsconfig.json and the folders under src/ for TypeScript. For each top module, note what it is for and what it imports from the others (grep -rn '^from \|^import ' src/ or grep -rn "from '\.\.\?/" src/). Draw the graph for the user as a short list, a -> b.
From the graph, propose one rule per boundary, each with a one-line reason the user can check:
api -> service -> store).billing and search); shared code moves to a lower layer.Show the imports that already break a proposed rule. For each, the user picks: fix it now, or list it as an ignored import with a comment saying why, to fix later. Write only the rules the user agrees to.
[tool.importlinter] in pyproject.toml, run with lint-imports)..dependency-cruiser.cjs, run with dependency-cruiser).Add the run to the lint task (mise run lint or the repo's equivalent) and to the CI lint job, as the reference shows. If the repo has no lint task or CI, add a lint task to mise.toml and tell the user the one command to add to CI later.
Run the lint task and expect it to pass. Then break one rule on purpose (add an import a contract forbids), run it again, expect a failure that names the rule and its reason, and revert the import. Leave the changes for the user to review and commit, unless they asked you to commit.
lint-imports cannot find the package. The root package must be importable: run it through the project's environment (uv run lint-imports), and check root_package matches the import name, not the distribution name.tsConfig in options to resolve path aliases; see the reference.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub pgoell/pgoell-claude-tools --plugin structure2 skills in this plugin