create-module
Skill2 starsChanged 5 days agoMITView on GitHub
Scaffold a new DDD module as a Turborepo workspace package. USE THIS SKILL when user mentions: create module, add module, scaffold module, new module, register module, @sessioflow/xxx package, module boilerplate, or any request to create a new package under packages/modules/ as a buildable, wired Turborepo workspace. Creates package.json, tsconfig.json, .gitignore, and container.ts. Domain content (entities, value objects, CQRS handlers) is handled by create-entity-lifecycle and implement-flow skills.
- Installs packages
8 other projects use a version of this.
Adopted by
Most recently taken up by
- lecluse-net/galaristheir own version, first seen Oct 30, 2026
- mx-space/coretheir own version, first seen Oct 30, 2026
- VelimirMueller/ai-development-skillstheir own version, first seen Oct 25, 2026
- VelimirMueller/claude-skillstheir own version, first seen Oct 11, 2026
- castacks/AirStacktheir own version, first seen Oct 9, 2026
- cartography-cncf/cartographytheir own version, first seen Oct 8, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- OpenCTI-Platform/opencti★ 10ksame name
- cartography-cncf/cartography★ 4.2ksame name
- mx-space/core★ 567same name
- castacks/AirStack★ 93same name
- vobase/vobase★ 60same name
- VelimirMueller/ai-development-skills★ 7same name
- VelimirMueller/claude-skills★ 7same name
- lecluse-net/galaris★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adr-amendSkill
- adr-createSkill
- adr-review-alternativesSkill
- adr-validateSkill
- agents-maintainerSkill
- audit-docsSkill
- explore-domainSkill
- sdlc-guideSkill
- setup-sdlcSkill
- inception-workshopSkill
- prd-workshopSkill
- user-story-mappingSkill
- modify-flowSkill
- reverse-engineer-domainSkill
- implement-flowSkill
- create-entity-lifecycleSkill
- create-featuresSkill
- create-flow-documentationSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 6 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
NO OVERWRITE: Never overwrite an existing module under packages/modules/{context}/.
- Distinctive: line 44
No domain content — just the packaging and wiring infrastructure so the module can be built, tested, and imported by other packages …
- Very specific: line 47
Important: Follow AGENTS.md for all code conventions and quality standards.
- Distinctive: line 61
If unsure, ask the user.
- Distinctive: line 67
Follow AGENTS.md Karpathy principles:
- Distinctive: line 117
No domain types are imported — that's filled in later by the domain skills.
- Very specific: line 136
All templates use {context} placeholder (kebab-case module name).
- Distinctive: line 285
After this skill runs, the module is:
- Distinctive: line 327
Before ending your turn, verify every item below with concrete evidence (not just a checkmark).
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PROTOCOL: CREATE-MODULE (EXECUTION LEVEL 3)
<state_machine>
CURRENT_STEP -> REQUIRED_TOOL -> REQUIRED_OUTPUT -> MANDATORY_HALT
Step 1: Prerequisites -> read_file / ls (packages/modules/, AGENTS.md) -> Confirmed non-existent module & kebab-case {context} -> Continue to Step 2
Step 2-5: Scaffold -> write_file (4 exact files from embedded templates) -> package.json, tsconfig.json, .gitignore, container.ts -> Continue to Step 6
Step 6: Validate -> run_command (npm install, typecheck, build) -> Passing workspace typecheck & build -> 🛑 HALT TURN (Present module)
</state_machine>
<execution_invariants>
- WORKFLOW IMMUTABILITY: You may reason freely INSIDE each step to inspect the repository's workspace conventions, shared packages, and tsconfig references, but you must execute the scaffolding steps in order (
workflow structure = immutable | step reasoning = flexible). - EXACT 4-FILE SCOPE: Create only
package.json,tsconfig.json,.gitignore, andsrc/container.tsunderpackages/modules/{context}/using the exact templates in this skill. Do NOT add domain entities, value objects, or handlers in this skill. - NO OVERWRITE: Never overwrite an existing module under
packages/modules/{context}/. - ESCAPE HATCH: If the repository's workspace or module architecture does not fit the 4-file Turborepo contract, do not silently improvise and do not force-fit: declare the deviation in one line and ask. </execution_invariants>
<output_contract>
- TARGET_FILES:
packages/modules/{context}/package.jsonpackages/modules/{context}/tsconfig.jsonpackages/modules/{context}/.gitignorepackages/modules/{context}/src/container.ts
- SCHEMA_INVARIANCE: Match the 4 embedded templates in
## 📄 Templatesverbatim (substituting{context}and{Context}). - ESCAPE_HATCH: If the repository uses a different workspace scope or shared package prefix than
@sessioflow/*(discovered fromAGENTS.mdor existingpackages/modules/*/package.json), adapt the scope prefix to match the repository's real workspace naming and declare the adaptation in your response. </output_contract>
Scaffold a new DDD module as a buildable Turborepo workspace package.
This skill creates exactly four files in packages/modules/{context}/.
No domain content — just the packaging and wiring infrastructure so the
module can be built, tested, and imported by other packages immediately.
Important: Follow AGENTS.md for all code conventions and quality standards.
Domain content scaffolding (entities, value objects, CQRS, controllers) is
handled by create-entity-lifecycle and implement-flow skills.
📋 Prerequisites
Before running, confirm:
- Module name is decided (kebab-case for folder, e.g.
sessions) - The context doesn't already exist under
packages/modules/ - Shared packages exist (
@sessioflow/shared-*)
If unsure, ask the user.
🧠 Think Before Coding
Follow AGENTS.md Karpathy principles:
- Understand — what is the module's purpose?
- Plan — which files, what content
- Check — verify no existing module covers this context
- Execute — create the four files, run validation
📦 Output
| File | Path | Purpose |
| package.json | packages/modules/{context}/package.json | Workspace package manifest |
| tsconfig.json | packages/modules/{context}/tsconfig.json | TypeScript project config |
| .gitignore | packages/modules/{context}/.gitignore | Ignore build artifacts |
| container.ts | packages/modules/{context}/src/container.ts | Composition root (wiring scaffold) |
🛠️ Step-by-Step
Step 1: Create directory
mkdir -p packages/modules/{context}/srcStep 2: Create package.json
Generate from template. Replace {context} with the kebab-case context name.
Step 3: Create tsconfig.json
Generate from template. The references list must include all four shared
packages: bus, database, domain, logging.
Step 4: Create .gitignore
Generate from template (standard npm/node/gitignore).
Step 5: Create container.ts
Generate from template. This is the wiring scaffold:
- Imports shared bus/middleware types
- Defines factory methods for handlers with default repository injection
- Creates a mediator with command bus + query bus + logging middleware
- Creates HTTP controller wrappers with auth injection
- Supports dependency injection (pass a mock for testing)
No domain types are imported — that's filled in later by the domain skills.
Step 6: Validate
# Register workspace
npm install
# Type-check (should pass — no domain code yet)
npx turbo typecheck --filter=@sessioflow/{context}
# Build (should pass — container compiles fine)
npx turbo build --filter=@sessioflow/{context}📄 Templates
All templates use {context} placeholder (kebab-case module name).
package.json
{
"name": "@sessioflow/{context}",
"version": "0.1.0",
"private": true,
"type": "module",
"exports": {
"./container": "./dist/container.js",
"./domain/*": "./dist/domain/*.js",
"./application/*": "./dist/application/*.js",
"./infrastructure/*": "./dist/infrastructure/*.js",
"./interfaces/*": "./dist/interfaces/*.js"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@sessioflow/bus": "*",
"@sessioflow/shared-database": "*",
"@sessioflow/shared-domain": "*",
"@sessioflow/shared-logging": "*",
"drizzle-orm": "^0.45.2",
"zod": "^4.4.3"
},
"devDependencies": {
"@sessioflow/tsconfig": "*",
"typescript": "^5"
}
}Key fields:
"private": true— not published to npm registry"type": "module"— ESM output; all imports use.jsextension"exports"— granular subpath exports per DDD layer- Dependencies use
"*"— workspace resolution aligns versions automatically
tsconfig.json
{
"extends": "../../config/tsconfig/base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"composite": true
},
"include": ["src/**/*"],
"references": [
{ "path": "../../shared/bus" },
{ "path": "../../shared/database" },
{ "path": "../../shared/domain" },
{ "path": "../../shared/logging" }
]
}Key fields:
"extends"— shares compiler options with all other packages"composite": true— enables project references for incremental builds"references"— declares cross-package type dependencies; TypeScript compile order
.gitignore
# Build artifacts
dist/container.ts
import {
InMemoryCommandBus,
InMemoryQueryBus,
LoggingMiddleware,
Mediator,
} from '@sessioflow/bus';
import type { OutboxRepository } from '@sessioflow/shared-database/outbox-repository';
import { DrizzleOutboxRepository } from '@sessioflow/shared-database/outbox-repository';
// ──────────────────────────────────────────────────────────────
// TODO: Import domain types, handlers, repositories, and HTTP controllers.
//
// Example:
// import { type {Entity}Repository } from './domain/{entity}-repository.interface.js';
// import { Create{Entity}Handler } from './application/commands/create-{context}/create-{entity}.handler.js';
// import { create{Entity}Controller } from './interfaces/http/{entity}.controller.js';
// ──────────────────────────────────────────────────────────────
/**
* {Context} Module Container (Composition Root).
*
* Wires Application Use-Cases & HTTP Controllers with
* default Infrastructure Repositories.
*/
export const {context}Container = {
/**
* Create the CQRS mediator with command & query buses.
*/
createMediator(): Mediator {
const commandBus = new InMemoryCommandBus();
const queryBus = new InMemoryQueryBus();
const loggingMiddleware = new LoggingMiddleware();
commandBus.use(loggingMiddleware);
queryBus.use(loggingMiddleware);
// TODO: Register commands and queries.
// Example:
// commandBus.register(Create{Entity}Command, this.create{Entity}Handler());
return new Mediator(commandBus, queryBus);
},
/**
* Create the HTTP POST controller.
*/
createController(
getAuthUser: () => Promise<{ id: string } | undefined> = async () => ({ id: 'mock-user-id' }),
) {
// TODO: Wire mediator + handler + auth to controller.
// Example:
// const mediator = this.createMediator();
// const busHandler = {
// execute: (command) => mediator.send<Create{Entity}Command, Create{Entity}Response>(command),
// };
// return create{Entity}HttpController(request, busHandler, getAuthUser);
throw new Error('Not implemented — wire in the handler step');
},
};What this gives you:
- A factory function (
createMediator) that wires buses, middleware, and (later) handlers - A controller factory (
createController) for HTTP endpoints - Dependency injection support: pass mock repositories for testing
- TODO markers to guide domain integration
📐 What You Get
After this skill runs, the module is:
| Capability | Status |
| Workspace package | ✅ Discovered by npm workspaces |
| TypeScript compilable | ✅ Compiles to dist/ |
| Turbo buildable | ✅ npx turbo build --filter=@sessioflow/{context} |
| Importable by other packages | ✅ Via granular exports |
| Domain content | ❌ (not yet — add via create-entity-lifecycle / implement-flow) |
| Tests | ❌ (not yet — add when domain code exists) |
🚫 Anti-Patterns
| Anti-Pattern | Correct Approach |
Skip "private": true | Packages under packages/modules/ are internal only |
Use "main": "./dist/index.js" | Use granular exports subpaths, not a barrel export |
| Hardcode shared package versions | Use "*" — workspace resolution keeps versions aligned |
Omit "composite": true | Required for project references and incremental builds |
| Add domain code in this skill | Domain scaffolding is handled by create-entity-lifecycle and implement-flow |
Forget .js extension in imports | All internal imports MUST use .js (ESM rule) |
📚 Related Skills
| Skill | When to use |
create-entity-lifecycle | After this module is wired — create domain entities, value objects, state machines |
implement-flow | After domain exists — implement CQRS commands, queries, handlers, controllers |
modify-flow | To change existing module structure or behavior |
Last Updated: 2026-07-14
Version: 1.0
<self_validation_gate> Before ending your turn, verify every item below with concrete evidence (not just a checkmark). If any item cannot be cited with real evidence from this turn, DO NOT produce your final response — fix the violation first:
- 4-File Scope Evidence: List the exact 4 file paths written under
packages/modules/{context}/(confirming 0 domain files added prematurely):<4 paths> - Template Fidelity Evidence: Confirm
"private": true,"type": "module", granularexports, and"composite": trueare present:<confirmed> - Build & Typecheck Evidence: Exact
typecheckandbuildcommands executed and exit codes (0):<commands></self_validation_gate>
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

