Coupling Recommended
Keep internals private
Each module exports only what its callers need. Everything else stays private, so it can change without breaking anyone.
How to do it
Mark helpers private or keep them out of the module's public entry file. Give each package one public entry point. Callers never import from another module's internal folders.
Example
// Bad: callers reach into the module's internals
import { formatLine } from '../invoices/internal/format.js';
// Good: one public entry point, internals stay hidden
import { renderInvoice } from '../invoices/index.js';
How to check
A tool fails on unused exports and on imports of another module's internals. Examples are knip for unused exports, and dependency-cruiser, Deptrac or import-linter for internal imports.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers architecture playbook: https://agentwranglers.se/playbook/architecture/coupling/private-internals.