| name | ts-node-cli-maintainability |
| description | Apply maintainability guardrails for TypeScript Node CLI code: small modules, strict contracts, safe URL policy, and automation-safe errors. Use when refactoring or extending lib and command code. |
TS Node CLI Maintainability
Use this skill when making structural changes across src/lib and src/commands.
When to use
- Refactoring large files.
- Extracting shared logic to reduce duplication.
- Updating policy behavior (cache, URL validation, error semantics).
- 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
- URL policy is allowlist-based and
https-only.
--no-cache means no cache reads and no cache writes for search/detail paths.
- Batch fetch reports per-item failures and still exits non-zero on all-fail.
Refactor playbook
- Identify repeated blocks across commands/libs.
- Extract into focused utility module under
src/lib/.
- Keep exported API narrow and typed.
- Add/update tests before broadening scope.
- Validate with build, unit tests, and regression suite when scraper logic changes.
Checklist
References