- Runtime: TypeScript packages targeting Node.js, browser-capable code, and Fetch-compatible runtimes where package boundaries allow it.
- Package manager: pnpm workspace.
- Build tool: tsdown for publishable packages.
- Test runner: Vitest for packages with behavior tests.
- Release workflow: Changesets with a generated root changelog and documentation changelog page.
apps/document: Documentation content workspace, including the published changelog page.packages/utils: Shared utility package with runtime-neutral root helpers and explicitweb/nodesubpaths.packages/canon: Shared contract primitives for HTTP status, response, error, and pagination shapes.packages/oh-my-fetch: Fetch client built onky, with explicit client, error, validation, JSON, dedupe, status, and plugin subpaths.packages/monorepo-tsconfig-paths: Runtime resolver and wrapper CLI for monorepo-aware TypeScriptcompilerOptions.pathsresolution.scripts/changesets: Root tooling for changelog generation.
- Put durable project rules in
AGENTS.mdfiles. Put one-off constraints in the prompt. - Add closer
AGENTS.mdfiles when a package or subpath needs stricter local rules. Closer files override or refine this root file. - Keep package-level guidance in the package that owns the behavior.
- Prefer existing workspace packages, helpers, types, and patterns before introducing new logic.
- Keep dependency direction clear: low-level shared packages must not import app workspaces or higher-level package behavior.
- Follow the referenced folder's architecture, naming, file layout, export shape, tests, and documentation style when the user asks to reference or borrow from a folder.
- Use structured parsers and typed APIs instead of ad hoc string manipulation when practical.
- Avoid duplicating behavior that already exists in
packages/*; extract shared logic only when the ownership boundary is clear.
- Treat workspace package names as ownership boundaries.
- Use
@unimolecule/utilsfor reusable runtime-neutral helpers, JSON helpers, type guards, trees, timers, random values, dates, strings, and explicit browser or Node helpers. - Use
@unimolecule/canonfor shared HTTP contract primitives such as status constants, response envelopes, error envelopes, and pagination response shapes. - Use
@unimolecule/oh-my-fetchfor outbound HTTP client behavior, request/response parsing, validation adapters, normalized request errors, JSON security, dedupe, and optional plugins. - Use
@unimolecule/monorepo-tsconfig-pathsfor monorepo-aware runtime TypeScript path alias resolution, wrapper commands, Node register/loader integration, and resolver diagnostics. - Keep schema factories, OpenAPI metadata, route handlers, business query parsing, and app-specific pagination policies in business packages or applications, not in
canon. - When adding a package-owned concept, update package entrypoints, README examples, and nearby package guidance when needed.
- Put reusable public types near their subsystem, following existing
types.tsor focused module patterns. - Put stable constants in
constants.tsor focused constant modules when they are part of a package API. - Keep one-off helpers close to their caller.
- Export through package or folder
index.tsfiles according to the existing package style.
- When a package has TypeScript tests, add test
tsconfig.jsonfiles close to the owningtestsboundary instead of widening publish/build tsconfigs to include tests. - Mirror the package's test layout: use
tests/tsconfig.jsonfor root/basic tests and add closer files such astests/node/tsconfig.jsonortests/web/tsconfig.jsonwhen Vitest projects or runtime-specific test folders exist. - Test tsconfigs should extend the matching package tsconfig (
tsconfig.basic.json,tsconfig.node.json,tsconfig.web.json, or the package root tsconfig), setnoEmit: true, disable declaration output, include the relevant tests and config files, and override inherited excludes that removetests. - Keep test type projects out of publish declaration graphs; build tsconfigs should continue to describe source and public entrypoints, not test helpers.
- Keep the root README navigational and architectural.
- Package READMEs must follow library documentation style: purpose, import paths, public API, usage examples, gotchas, and runtime notes.
- Use
README.mdfor English andREADME.zh-CN.mdfor Chinese when both are present. - Keep localized README variants structurally aligned with the English README.
- Do not document schema-library or framework behavior in
canonunless that behavior is actually owned bycanon. - Do not fix lint or type diagnostics that only come from code blocks in
*.mdfiles unless explicitly requested; treat them as documentation examples and report any remaining warnings.
- Do not commit secrets or print secret values in final answers.
- Treat
.env.*, tokens, registry credentials, private keys, and release credentials as sensitive. - Do not hand-edit generated changelog output unless the user is intentionally debugging generated content.
scripts/changesetsowns changelog synchronization betweenCHANGELOG.mdandapps/document/content/changelog.md.
- Install:
pnpm install - Workspace build:
pnpm build - Workspace test:
pnpm test - Workspace lint:
pnpm lint - Workspace format:
pnpm format - Generate changeset:
pnpm changeset:generate - Regenerate changelog:
pnpm changeset:changelog - Version packages:
pnpm changeset:version - Publish packages:
pnpm changeset:publish
Prefer package-scoped commands for focused work, for example:
pnpm -F @unimolecule/utils test
pnpm -F @unimolecule/canon build
pnpm -F @unimolecule/oh-my-fetch test- Run the narrowest relevant lint, test, type, or build command before claiming work is complete.
- For package code changes, run that package's test or build script when present.
- For export or package metadata changes, run that package's build.
- For documentation-only changes, run Prettier on the touched Markdown files.
- If a full workspace command is noisy or unrelated, state the narrower command that was run and why.