SKILL.md
Creating Modules
A module is a PascalCase namespace inside a package. Two common cases:
- Extend
@kitz/effect— add a new namespace (a concept) alongside
FileSystem and Path. The lightweight alternative to a whole new package (creating-packages).
- **Add a module to any
@kitz/*package** — the same mechanics anywhere.
Read packages/effect/src/_.ts (the root namespace bundle) and packages/effect/src/path/ (a submodule namespace) as the canonical examples.
Structure
# Single source file (__.ts elided):
src/<module>/
├── _.ts # root assembly: export * as <Name> from './<module>.js'
├── _.test.ts
└── <module>.ts # implementation
# Multiple source files:
src/<module>/
├── _.ts # root assembly: export * as <Name> from './__.js'
├── _.test.ts
├── __.ts # barrel: export * from './impl.js'
└── *.ts
- Directory: kebab-case. Namespace export: PascalCase. Functions: camelCase, no
namespace prefix (by, not groupBy).
- Prefer
export * fromin barrels; use named re-exports only to rename or exclude. - Elision: when
__.tswould re-export a single file, skip it and have_.ts
export the implementation directly.
_.tsexists only to assemble the namespace exported by the package root.
Explicit package subpaths target the module itself: .ts, or the implementation file when .ts is elided.
Wire the namespace into the package
- Re-export from the package root
src/_.ts:
``ts export { <Name> } from './<module>/_.js' ``
- Add the package.json exports entry — live-types, mirroring the existing
entries (dev → src, publish → build):
``jsonc // exports "./<Name>": "./src/<module>/.ts", // publishConfig.exports "./<Name>": "./build/<module>/.js" ``
- Verify:
pnpm exec vp run checkand (if exported)pnpm exec vp run check:package.
Imports
- No
#imports. That convention was removed; packages no longer declare an
imports map. Within a package, use relative imports (./other/_.js).
- Package root: import assembled namespaces by name —
import { FileSystem, Path } from '@kitz/effect'.
- Explicit subpath: import the direct module namespace —
import * as Path from '@kitz/effect/Path'.