Install any skill in seconds. Free to start, no credit card required.
Get Started Free →A new-architecture package (shared/, domain/, features/) exposes its API through barrels that contain nothing but `export *`, and keeps its private code in an internals location. Read this when creating a package under shared/, domain/ or features/, when editing any `index.*` file, or when a `lint:structure` check fails.
52% 100%+48 ptsof test cases passed
Passed 23 of 23 test cases with the skill, and 12 of 23 without it.
This test ran on v3. v5 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Not used yet
An index.* file is a barrel: a pure regrouping point, nothing else.
// ✅
export * from "./schema";
export type * from "./types";
export { default } from "./useEnv"; // the one tolerated exception
// ❌ sorting in the export proves ./slice mixes public and private
export { accountNamesSlice, bulkSetAccountNames as setAccountNames } from "./slice";
// ❌ an index that contains code is not an index
export const CurrencySchema = z.discriminatedUnion("type", [...]);
Why the sorting matters. If you need to pick which names leave a file, that file holds both
public and private code. The fix is never a longer export list — it is moving the private part to
an internals location. export * then becomes honest: everything in that file is public.
Enforced by nx run <project>:lint:structure
(the plugin), on every index.* under
src/, at any depth.
The rule follows a file's role, not its name. It follows every relative export * from a barrel,
through any number of files, resolved as the web and native bundlers do, and it reads every
source file named in package.json#exports, under any condition. Test support entries (a subpath
segment starting with test or mock) are left out. Such a module may declare
anything, but it re-exports like a barrel: export * from a relative file and an optional default
re-export only. So export * from "./exports" in the index with the sorting or the proxy in
exports.ts fails the same way (hidden-barrel, cross-package-reexport, …).
Under src/, an index.* (platform variants included) is allowed in three places:
src/index.*, or the target of a package.json#exports entry. Test support
entries count.export *. One level below an entry is always fine. Deeper, theSkills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.