Scaffold / maintain a src/core/ module
This skill applies the portable infrastructure layer pattern: code in src/core/ is treated like a shared library, kept in sync across @finografic CLI repos by convention.
Read first (repo — canonical for this repository)
.agents/instructions/project/core-module-patterns.instructions.md— folder layout, rules, imports, picocolors, header comment, current module table.
Deeper spec (canonical — in this repo)
docs/spec/CLI_CORE.md— full CLI Core Module Spec: whatcore/is, TypeScript rules, consuming from app code, Adding a Newcore/Module checklist, and Current Modules (core/flow/,core/render-help/).
Optional context: A monorepo may use a temporary bulk-task folder (e.g. ___REFACTORING___) for staging reports during large migrations. That folder is not canonical. If REPORT_CLI_NORMALIZATION.md (or similar) exists there, it can add historical “why we moved” notes — use it when present; do not treat it as the source of truth for the spec.
Use docs/spec/CLI_CORE.md when designing a new module or documenting exports; keep this skill as the procedure, not a duplicate of the spec.
Prerequisites
- The module is useful in more than one
@finograficCLI project (not app-specific logic). - No imports from repo aliases (
utils/*,config/*,commands/*,types/*). - No side effects on import (beyond
constinit). - Single clear responsibility.
Procedure — new module
Choose a kebab-case folder name under
src/core/{module-name}/.Create files (minimum pattern):
{module-name}.utils.ts— implementation (or types-only module if appropriate).index.ts— barrel only public API; named re-exports, no default exports.
Add
{module-name}.types.tsand tests if needed perdocs/spec/CLI_CORE.md.Implementation file header (required on
*.utils.ts):// ⚠️ AVOID EDITING THIS FILE DIRECTLY — changes must be propagated to all @finografic CLI reposTypeScript rules (core-only):
- Top-level functions:
functionkeyword, notconstarrow for exported module-level functions. - Explicit return types on exports (and internal helpers where practical).
- Named exports only through the barrel.
- Relative imports inside the module use
.jsextensions in import paths where the project uses that rule. - Picocolors:
import pc from 'picocolors'— neverutils/picocolorsfromcore/.
- Top-level functions:
tsconfig: ensure
"core/*": ["./src/core/*"]exists undercompilerOptions.paths.App code imports only from barrels:
import { createFlowContext } from 'core/flow'; import type { HelpConfig } from 'core/render-help';Cross-repo workflow (required for real
core/changes):- Update
docs/spec/CLI_CORE.mdin genx (Current Modules / new section). - Propagate the same files (or a reviewed diff) to every
@finograficCLI repo that ships that module. - Consider a genx template or feature so new scaffolds include the module if applicable.
- Update
Procedure — edit existing module
- Assume changes may need identical patches in
genx,gli, and any other consumer. - Do not pull app-layer code into
core/to “fix” a single repo.
Related skills
- scaffold-cli-help — consumer of
core/render-help; use when only changingcli.help.tsand not adding a new core package.
Checklist (copy from docs/spec/CLI_CORE.md)
Before considering a module “done”:
- Useful across multiple CLI projects
- No repo-specific alias imports
- No import side effects
- Single responsibility
- Barrel
index.tspresent - ⚠️ header on implementation files
-
core/*path alias intsconfig.json - Documented in
docs/spec/CLI_CORE.md(genx) - Propagated to other repos as needed