| name | ts-node-cli-maintainability |
| description | Apply maintainability guardrails for TypeScript Node CLI code during the catalog reducer migration: small modules, explicit contracts, adapter boundaries, and automation-safe errors. Use when refactoring reducer logic into a plugin-oriented codebase. |
TS Node CLI Maintainability
Use this skill when making structural changes while moving reducer behavior from tmp/ into a plugin-oriented TypeScript or Node CLI codebase.
When to use
- Refactoring large files.
- Extracting shared logic to reduce duplication.
- Defining adapter boundaries between existing reducer logic and new plugin commands.
- Improving long-term readability and testability.
Core principles
- Single responsibility per module.
- Shared behavior in utilities, not copy/pasted blocks.
- Behavior contracts must be explicit and tested.
- Keep automation-facing surfaces stable.
Repo contracts to preserve
- Reducer behavior should stay grounded in the current implementation under
tmp/ until deliberately changed.
- Product selection order and deduplication behavior are part of the observable contract.
- Inventory and pricebook side outputs must remain explainable and testable when logic is moved.
Refactor playbook
- Identify which reducer behavior is being migrated versus merely wrapped.
- Extract focused utilities or adapters instead of copying large blocks wholesale.
- Keep exported APIs narrow and typed.
- Add or update tests before broadening scope.
- Validate against the current reducer behavior in
tmp/ before declaring the migration safe.
Checklist
References