devtools-import-boundary
Skill627 starsChanged 8 days agoMITView on GitHub
Enforce import boundaries inside the devtools scope. Use when doing any work in "devtools/**".
In this repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- analyticsSkill
- batch-feature-devSkill
- ci-runnersSkill
- ci-workflow-refsSkill
- cleanupSkill
- client-idsSkill
- cloud-sync-moduleSkill
- codeownershipSkill
- coin-families-contractSkill
- coin-modulesSkill
- commentsSkill
- configurationSkill
- console-logSkill
- create-changesetSkill
- create-prSkill
- data-layer-advancedSkill
- debug-rn-native-crashSkill
- dependency-patchesSkill
- detect-data-leaksSkill
- device-intent-executorSkill
- dialogs-sliceSkill
- docs-migrateSkill
- docs-update-or-createSkill
- domain-dataSkill
- e2e-desktop-add-or-updateSkill
- e2e-desktop-onboardSkill
- e2e-earnSkill
- e2e-mobile-add-or-updateSkill
- e2e-mobile-onboardSkill
- e2e-swapSkill
- errorsSkill
- feature-devSkill
- fix-ciSkill
- flow-packageSkill
- get-pr-commentsSkill
- git-conventionsSkill
- i18n-keysSkill
- impacting-prsSkill
- knip-migrationSkill
- ldls-nativeSkill
- ldls-webSkill
- ledger-wallet-cliSkill
- legacy-migrationSkill
- mvvm-architectureSkill
- new-packageSkill
- package-public-apiSkill
- pnpm-resolutionSkill
- prefer-set-hasSkill
- pre-reviewSkill
- react-generalSkill
- rebuild-to-fix-lib-import-errorsSkill
- remove-feature-flagSkill
- run-buildsSkill
- run-e2e-ciSkill
- runner-imagesSkill
- run-testsSkill
- slack-pr-messageSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Every @devtools/* package is self-contained.
- Very specific: line 40
If bindings or shell import a tool package's values directly (instead of through the registry):
- Very specific: line 61
When adding a new package under devtools/, its README.md must state:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DevTools import boundaries
Every @devtools/* package is self-contained. A @devtools/* package may import another one only where tools/nx-plugins/enforce-boundaries/constraints.js allows it, and pnpm lint:boundaries enforces it:
DEVTOOLS_ALLOWED_IMPORTSlists the imports each package may make.DEVTOOLS_TYPE_ONLY_IMPORTSlists the packages each one may reach underDEVTOOLS_TYPE_ONLY_RULE.DEVTOOLS_LAZY_IMPORTSlists the packages each one may reach only lazily, underDEVTOOLS_LAZY_RULE.DEVTOOLS_HOST_APPSlists the apps that host DevTools, the one folder of each that may import@devtools/*, and the files of that folder product code may import statically.
To change what a package may import, edit those tables.
Rules for the registry and the host apps
- The registry reaches tools lazily (
DEVTOOLS_LAZY_RULE). The shell loads@devtools/registryeagerly, so the registry may reach a tool only throughimport type,export type … from,typeof import("…")orloader: () => import("@devtools/<tool>"). A value import orrequire()bundles the tool with the shell. - App product code does not import
@devtools/*(DEVTOOLS_HOST_APP_RULE). In each app ofDEVTOOLS_HOST_APPS, only files underallowedUnder(src/mvvm/features/DevTools/) may import@devtools/*, type imports included. A product hook calling a bindings hook, or a product type derived fromDevToolsConfigor a bindings port type, belongs in that folder. - Product code enters the DevTools folder through its entries (
DEVTOOLS_HOST_FOLDER_RULE). A file outsideallowedUndermay statically import only the files listed inentries; any other file of the folder is reachable only throughimport()orlazy(() => import(...)). Otherwise one hop through the folder would bypass rule 2. The rule resolves relative paths and the aliases of the app'stsconfig.json(LLD/*,LLM/*,~/*). Test files (*.test.*,__tests__/,__integrations__/) are exempt.
What lint cannot catch
- Debug work on a product path. A debug screen, a mock or a dev-only branch written in a product file without importing
@devtools/*passes. Keep it under the DevTools folder by review. - Debug controls.
setOverrideand similar controls are used by many legitimate debug screens, so lint does not flag them. Whether product code drives them for debugging is a review question.
Why
The devtools architecture decouples tools from the shell through the registry. The shell lazy-loads tools via metadata.loader; tools never know the shell exists. If a tool imports the shell or another tool directly:
- The lazy-load boundary collapses — the tool is bundled eagerly.
- A circular dependency becomes likely (tool → shell → registry → tool).
- The tool can no longer be rendered standalone, outside the shell.
bindings builds each tool's props, so it needs a tool's props types without loading the tool. That is what DEVTOOLS_TYPE_ONLY_IMPORTS grants it.
If bindings or shell import a tool package's values directly (instead of through the registry):
- The registry's discriminated union is bypassed and TypeScript loses the narrowing guarantee on
DevToolsConfig. - The
import()split point disappears, defeating code-splitting.
Consequences of a violation
- Tool imports shell or registry: The tool becomes coupled to shell internals; standalone rendering and unit-testing break.
- Tool imports another tool: Cross-tool coupling; removing or renaming one tool requires editing the other.
- Shell or bindings import a tool directly: Eager bundle; code-split lost; registry union integrity broken.
- Registry imports a tool's values: The tool is bundled with the shell, which loads the registry eagerly.
- App product code imports
@devtools/*, directly or through a non-entry file of the DevTools folder: Product code depends on debug tooling and ships it eagerly.
Correct pattern
Cross-cutting concerns (shared types, utilities) must not live in a tool package. Extract them to a standalone library with no @devtools/* scope, then import that from whichever packages need it.
App state and wiring for a tool arrive as props, built in @devtools/bindings — the single sanctioned bridge to Ledger Live internals. A tool that needs more data from the app gets new props, not a new import.
Documentation
When adding a new package under devtools/, its README.md must state:
- Which
@devtools/*packages it may import, perDEVTOOLS_ALLOWED_IMPORTS. - That all other
@devtools/*imports are forbidden, with a pointer to this rule.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

