Installable skillMIT

Module Scaffold

Scaffolds a complete Express module with Controller, Service, Repository, Routes, DTOs, Types. Trigger for: "create [name] module", "scaffold [name]", "add [name] CRUD".

BY raihansharifrimonUPDATED Oct 30, 2026
INTENDED FOR◈OpenClawInstall in a listed agent.

instructions.md

---
name: module-scaffold-9a44edeb7854
description: >
  Scaffolds a complete Express module with Controller, Service, Repository, Routes, DTOs, Types.
  Trigger for: "create [name] module", "scaffold [name]", "add [name] CRUD".
---

# Module Scaffold

Reads: `../../references/project.config.md` · `../../references/conventions.md` · `references/templates.md`

## Preflight

1. Extract resource name or ask if ambiguous
2. Ask: *"Prisma model name? (e.g. `Invoice`, `Bill`)"*
3. Language from config, else ask
4. Ask: *"Does `{PrismaModel}` already exist in your schema?"*
   - **Yes** → print confirmation → proceed to Output
   - **No** → run Schema Validation below → only print confirmation AFTER user approves schema

```
✅ {resource} | {resources} | prisma:{PrismaModel} | {lang} | {api_src_path}
```
⛔ Do not print this or generate any files until step 4 is fully resolved.

## Schema Validation (new models only)

Draft model based on resource name and context → show user → STOP and wait.
Do not print the preflight confirmation. Do not generate any files. Wait for explicit reply.

```
📋 Schema — {PrismaModel}
{drafted model block}
Suggestions: {domain-relevant fields / relations / indexes}

Does this look correct?
  ✅ looks good → will migrate then scaffold
  ✏️  change X → will revise and re-show
```

On approval:
1. Add model to `{prisma_schema_path}`
2. `pnpm db:migrate --name add_{model}_table`
3. Print preflight confirmation ✅
4. Proceed to generate files

## Output (9 files)
```
{api_src_path}/{resources}/
├── {resources}.routes.ts
├── {resources}.controller.ts
├── {resources}.service.ts
├── {resources}.repository.ts
├── dto/create-{resource}.dto.ts
├── dto/update-{resource}.dto.ts
├── types/{resource}.types.ts
├── types/index.ts
└── index.ts
```
Generation order: types → dto → repository → service → controller → routes → index.ts

## After Generation
```ts
import {resource}Routes from './{resources}';
app.use('/api/{resources}', {resource}Routes);
```

## Resume
"resume {resource} module" → check existing files → skip ✓ → create missing ✨

## Auto-trigger
After all 9 files → load `../../skills/testing/SKILL.md` → scaffold `__tests__/` skeleton.
COMPATIBILITY & REFERENCES

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.