| name | mnemonica-core |
| description | Instance inheritance system for JavaScript/TypeScript using prototype chains.
Use when the user mentions mnemonica, define(), prototype inheritance,
TypeRegistry, lookup, tactica, instance inheritance, or when working
with the mnemonica core library. Covers: define() patterns, type-safe
lookup with tactica, Proxy-based architecture, hook system, async
constructors, strict chain validation, and 100% test coverage requirements.
|
| metadata | {"tags":["mnemonica","typescript","prototype-inheritance","type-system","nodejs"]} |
Mnemonica Core - AI Skill
When to use
Activate this skill when:
- User mentions
mnemonica, define(), lookup, TypeRegistry
- User asks about prototype chain inheritance in JavaScript/TypeScript
- User is modifying files in
core/src/ or core/test/
- User asks about tactica-generated types or
.tactica/ directory
- Task involves: type definitions, hooks, async constructors, error handling
Functional vs Class-Based — Both Are Equally Supported
define() and @decorate() are runtime equivalents. When working in a codebase, match the style already in use. See rules-skill/define-patterns.md for a side-by-side comparison.
High-priority checklist: Adding a new type
When the task involves adding or modifying a type definition:
-
Use type for data, interface for behavior contracts
- Instance data →
type MyTypeData = { ... }
- Constructor contract →
interface MyTypeConstructor { ... }
- See rules-skill/type-system.md
-
Check TypeRegistry augmentation (if using tactica)
-
Test both success and error paths
- Mocha test in
test/ for runtime behavior
- Jest test in
test-jest/ for type coverage
- Error path: test
ALREADY_DECLARED, WRONG_MODIFICATION_PATTERN
- See rules-skill/testing.md
-
Run coverage before completing
npm run test:cov (Mocha + build)
npm run test:jest:cov (Jest on TypeScript source)
Non-discoverable rules (must be in SKILL.md)
type vs interface rule — not enforced by lint, not in code
- 100% coverage requirement — not discoverable from jest.config.js alone
- Space before function parens — convention, not linted
- Error constructor names are String objects — runtime quirk
- Jest tests must mirror Mocha patterns from
test/environment.js — not in code
Build Commands
npm run build
npm run test:cov
npm run test:jest:cov
npm run watch
Rule Reference
Read individual rule files for detailed explanations and code examples:
Type System
Patterns
Architecture
Philosophy & Design
Quality
Contributing
Contributing
This file covers usage of mnemonica only. If you are modifying the library
itself, read AGENTS.md (or .ai/AGENTS.md
for framework-agnostic rules).
External Resources