internal-types

Organizes internal TypeScript types into features, shared, utility, and ambient directories.

10|3|Updated Oct 23, 2023
One-click install
npx skills add https://github.com/Layer-Fi/layer-react --skill internal-types-layer-fi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: internal-types
Source: https://github.com/Layer-Fi/layer-react/tree/main/src/types
Command: npx skills add https://github.com/Layer-Fi/layer-react --skill internal-types-layer-fi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It prevents type sprawl and layering violations in a large React component library by defining exactly where each internal TypeScript type belongs and keeping runtime code out of the types directory. ## Core Features & Use Cases - Placement rules: Routes new types to features/<domain>/, shared/, utility/, or ambient/ based on ownership and scope, with API payloads directed to Effect schemas in src/schemas instead. - Naming conventions: Enforces naming a module after its single export and reserving broader names for multi-type modules, with no barrel file. - Runtime-code boundary: Explains why classes, type guards, data tables, and functions belong with their owning code in src/utils or src/hooks rather than in the types layer. - Use Case: When adding a new type for the bank transactions feature, follow the decision flow to place it in features/bankTransactions/ or inline in the consuming file, keeping the directory erasable at build time. ## Quick Start Ask the AI to decide where a new TypeScript type should live in src/types and whether any runtime code needs to move out of the directory.

Frequently Asked Questions about internal-types

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Where should I put a new TypeScript type in a large codebase?▼

Place it based on ownership: type-level helpers go in utility/, single-domain types go in features/<domain>/, and cross-domain types go in shared/<capability>.ts. If only one file uses the type, declare it in that file instead.

How do I separate API types from internal TypeScript types?▼

Anything the API sends or receives should be an Effect schema in src/schemas, not an internal type. The internal types directory holds only client-side contracts like DateRange, MoneyFormat, and view configuration types.

Should TypeScript type files contain runtime code like classes or enums?▼

Generally no — classes, type guards, and data tables belong with the code that owns them, such as src/utils. A few plain enums that are part of a type's public contract are an accepted exception.

How should I name a TypeScript module that exports one type?▼

Name the module after its single export, such as dateRange.ts exporting DateRange. Only modules holding several related types get broader names like money.ts or layerContext.ts.

Why avoid a barrel file in a types directory?▼

Omitting a barrel file forces consumers to import the specific module directly, keeping dependencies explicit and avoiding a central index that couples unrelated domains together.