data-object-conventions

Enforces consistent structure, formatting, and placement for static data objects in TypeScript codebases.

1|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/arndvs/ctrlshft --skill data-object-conventions-arndvs
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: data-object-conventions
Source: https://github.com/arndvs/ctrlshft/tree/main/skills/data-object-conventions
Command: npx skills add https://github.com/arndvs/ctrlshft --skill data-object-conventions-arndvs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Static data in TypeScript/JavaScript projects often ends up as dense one-liners, compact factory calls, or inline blobs inside logic files, making it unreadable, hard to diff, and prone to duplication drift. This Skill enforces a single consistent way to structure, format, and place static data objects so data files stay readable, greppable, and maintainable. ## Core Features & Use Cases - Formatting rules: Requires full object literals with one property per line, explicit fields, consistent property ordering, and trailing commas — banning compact factory calls and single-line objects. - Placement conventions: Directs data into a dedicated src/lib/data/ directory with one kebab-case file per domain, keeping data files as leaf modules that import nothing local. - Types and derived views: Co-locates exported types above the data, uses readonly/as const for immutability, derives views from canonical data, and prefers enums-as-data over TS enums. - Refactoring workflow: Provides a safe, atomic procedure for extracting data out of monolithic logic files while preserving the public API. - Use Case: When a 400-line inventory file mixes a product catalog with aggregation logic, use this Skill to extract the catalog into src/lib/data/inventory-catalog.ts, format each entry as a full object literal, and re-export the public surface so no consumer breaks. ## Quick Start Ask the AI to apply the data object conventions to reformat or extract a static data file, for example: "Extract the product catalog from inventory.ts into a dedicated data file following the data object conventions."

Frequently Asked Questions about data-object-conventions

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

FAQPage Schema
How do I format static data objects in TypeScript?▼

Write full object literals with one property per line, keep a consistent property order (identity, display, content, classification, optional), and use trailing commas. Avoid compact factory calls and single-line objects, which hide data and produce noisy diffs.

Where should static data files live in a TypeScript project?▼

Place static data in a dedicated directory such as src/lib/data/, with one kebab-case file per domain like inventory-catalog.ts or payment-methods.ts. Data files should be leaf modules that import nothing local, keeping the dependency arrow one-directional from logic to data.

Should I use a TypeScript enum or a const array for lookup data?▼

Prefer a const array with as const plus a derived union type over a TS enum. The array form is data-driven, greppable, and easy to extend, while TS enums are opaque and harder to search.

How do I extract data from a large logic file without breaking consumers?▼

Create a data module containing the types, canonical data, and lookup maps, then slim the original file to logic only and re-export the full public surface. Run the test suite and type-check to confirm no consumer changes and no behavior change.

When should I not use these data object conventions?▼

Do not apply them to runtime state, API responses, or database rows, since those are data-in-motion rather than static data. Also avoid extracting very small data blocks used in only one place, as over-fragmentation adds indirection without benefit.