The core of apcore is task orchestration and execution specifications. It provides a unified task orchestration framework that supports execution of multiple task types.
- Prioritize simplicity, readability, and maintainability above all.
- Avoid premature abstraction, optimization, or over-engineering.
- Code should be understandable in ≤10 seconds; favor straightforward over clever.
- Always follow: Understand → Plan → Implement minimally → Test/Validate → Commit.
- Use precise, full-word names (standard abbreviations only when conventional).
- Functions ≤50 lines, single responsibility, verb-named.
- Avoid obscure tricks, excessive generics, or unnecessary abstraction layers.
- Break complex logic into small, well-named helpers.
- Full type annotations on all public APIs and function signatures.
- Avoid
anyexcept for dynamic/external data; preferunknownwith narrowing. - Prefer
interfacefor object shapes,typefor unions/intersections. - Use
readonlyfor immutable data structures.
- Favor functional style + plain objects; minimize class inheritance.
- Composition > inheritance; use
interfaceonly for true contracts. - No circular imports.
- Dependency injection for config, logging, external services, etc.
- Explicit error handling; no bare
catch {}that swallows errors silently. - Use
try/finallyor equivalent cleanup patterns for resources. - Validate/sanitize all public inputs.
- Use
console.warnfor warnings in library code. - Prefix log messages with
[apcore:<subsystem>]for traceability. - No
console.login production code paths.
- Unit tests in
tests/, ≥90% coverage on core logic. - Test files named:
test-<unit>.test.ts. - Test cases named descriptively:
it('throws X when Y', ...). - Never change production code without updating tests.
- Use
vitestas test runner.
- After changes, always run:
npx tsc --noEmit(type checking)npx vitest run(tests)
- Zero errors before commit.
- ESM only (
"type": "module"in package.json). - All imports must use
.jsextension (NodeNext resolution). - Use
@sinclair/typeboxfor runtime schema definitions.
- Never hardcode secrets; use env/config.
- Validate/sanitize inputs at system boundaries.
- Avoid unjustified quadratic+ complexity in hot paths.
- English ONLY for comments, JSDoc, logs, errors, commit messages.
- Fully understand surrounding code before changes.
- Do not generate unnecessary documentation, examples, or stubs unless explicitly requested.