agentleFS
awahidsawahids/noskill/skills/erp-domain-design/SKILL.md

erp-domain-design

Skill1 starsChanged 23 days agoMITView on GitHub

ERP/WMS domain design checklist before schema/ERD: core business, master data, stock ledger, workflow status, RBAC, audit trail, numbering, source of truth, MVP roadmap. Use for "desain ERD inventory", "modul mana dulu", or ERP/WMS PRD questions.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. hi-donwi/Donwi-Skills★ 0same 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 repository12 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    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
  1. Distinctive:

    Before building any module, answer: "how does this company make money?" Draw the big flow first (e.g.

    line 16
  2. Distinctive:

    Don't let each module keep its own item/customer table.

    line 20
  3. Very specific:

    Avoid if (user.role === 'ADMIN') ...

    line 48
  4. Very specific:

    Don't generate document numbers (PO/SO/GR/DO/INV) in the frontend.

    line 60
  5. Distinctive:

    Don't jump straight to "buat Prisma schema → buat CRUD → buat frontend" without mapping the business process and workflow first.

    line 76
  6. Distinctive:

    Start with one application (e.g.

    line 92
  7. Very specific:

    Follow the order: Business Capability → Bounded Context → Application Module → Technical Component.

    line 100
  8. Distinctive:

    If the user wants to design a new ERP/WMS module/ERD, go through this checklist item by item before writing the schema.

    line 113
  9. Distinctive:

    If the user asks "which module first", refer to the MVP roadmap (A.9).

    line 114

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

noskill docs folder: ${user_config.docs_dir} — written as <docs> below. If that value still appears literally (not substituted), use docs/noskill.

ERP Domain Design (Part A)

Design principles for ERP/WMS systems so all modules stay consistent and avoid data problems ("kok stock di Sales 100, Warehouse 87, Dashboard 92?"). Use as a checklist before creating the ERD/schema/API for a new module.

0. Define the core business first

Before building any module, answer: "how does this company make money?" Draw the big flow first (e.g. Purchasing → Receiving → Warehouse → Production → Sales Order → Delivery → Invoice → Payment). The ERP modules needed follow this flow, not the other way around.

1. Master Data is the foundation — one source, used by all modules

Don't let each module keep its own item/customer table. Minimum structure:

Organization → Company → Branch → Department → Warehouse
Product      → Item → Category / Unit / Brand / Variant / Batch-Lot / Serial Number
Business Partner → Customer / Vendor / Employee

One Item master is used by Purchasing, Inventory, Sales, Production, Finance — not a separate copy per module.

2. Stock Ledger, not a stock field

Don't store item.stock = 100 directly. Use stock movements / a ledger as the audit source:

StockMovement: id, item, warehouse, location, batch, type, reference, quantity, direction, created_at

Example entries: PURCHASE_RECEIVE +100, SALES_SHIP -20, TRANSFER_OUT -10, TRANSFER_IN +10, ADJUSTMENT +5. current_stock = SUM(semua stock movement) — or use stock_balances as a performance cache, but the ledger stays the source of truth when someone asks "why does item A only have 70 left?".

3. Every transaction has a workflow status, not just CRUD

Purchase Order example: DRAFT → SUBMITTED → APPROVED → PARTIALLY_RECEIVED → COMPLETED. Sales Order example: DRAFT → SUBMITTED → APPROVED → PICKING → PACKING → SHIPPED → COMPLETED. Each transaction document should ideally have: Header, Details, Status, Approval, History, Audit Log.

4. RBAC, not hardcoded roles

User → Role → Permission

Avoid if (user.role === 'ADMIN') ... scattered through the code. Define granular per-action permissions (e.g. inventory.goods_receipt.confirm, purchasing.po.approve).

5. Audit Trail is mandatory for serious systems

Store at least: Who, What, When, Before, After, Reason. Example:

User: budi.santoso | Action: UPDATE | Module: Purchase Order | Document: PO/260920/0012
Before: quantity=100 → After: quantity=120 | Reason: Vendor confirmation

6. Centralized document numbering

Don't generate document numbers (PO/SO/GR/DO/INV) in the frontend. Build a central document_sequence service. Common format: PO/2609/00001.

7. Define a source of truth per entity — avoid duplicate data

Item        → Item Master     → dipakai Purchasing, Inventory, Sales, Production, Finance
Customer    → Customer Master → dipakai Sales, Delivery, Invoice, Payment
Stock       → Stock Ledger    → dipakai Warehouse, Sales, Purchasing, Production, Reporting

Sales, Warehouse, and Production must not each hold their own stock numbers that can diverge.

8. Design order: business flow first, then ERD

Business Process → Requirement → Workflow → Document → Database Model → API → UI

Don't jump straight to "buat Prisma schema → buat CRUD → buat frontend" without mapping the business process and workflow first.

9. Phased MVP roadmap — don't build 15 modules at once

PhaseModules
1 — FoundationAuth, User, Role, Permission, Company, Branch, Warehouse, Audit Log, Document Number
2 — MasterItem, Category, Unit, Customer, Vendor, Warehouse, Location
3 — InventoryOpening Stock, Stock Receive/Issue/Transfer/Adjustment, Stock Ledger, Stock Balance, Batch/Lot
4 — PurchasingPurchase Request, Purchase Order, Goods Receipt, Supplier Invoice
5 — SalesSales Order, Picking, Delivery Order, Sales Invoice
6 — FinanceAccount, Journal, Invoice, Payment, AR, AP
LaterManufacturing, HR, Payroll, Asset, CRM, Project, Maintenance, BI

10. Architecture: modular monolith first, microservices later

Start with one application (e.g. NestJS) with clearly separated modules:

apps/erp-api/src/modules/
  ├── iam/  ├── master-data/  ├── purchasing/  ├── inventory/
  ├── sales/  ├── finance/  ├── manufacturing/  └── audit/

One PostgreSQL as the starting point. Microservices only become relevant when you need independent deployment/scaling, per-service team ownership, failure isolation, a mature domain, and clear integration boundaries — not "to be modern". If business boundaries are still unclear, microservices only add complexity (network, API gateway, message broker, distributed transactions, deployment, monitoring, retries, event consistency, service discovery) while the business itself isn't stable yet.

Follow the order: Business Capability → Bounded Context → Application Module → Technical Component. Example: Warehouse Management → Inventory Context → Inventory Module → StockService, StockMovementService, ReservationService, StockRepository.

11. Inventory must be the single owner of stock, not modified directly by other modules

Wrong: Sales → UPDATE stock directly, Purchasing → UPDATE stock directly. Right: Purchasing → Goods Receipt → Inventory → Stock Movement → Stock Balance and Sales → Shipment → Inventory → Stock Movement → Stock Balance.

12. Events for side-effects, not for core transactions

Events suit things like notifications/integrations after Goods Receipt Confirmed. But the core transaction (e.g. confirm GR + update stock) should stay within one clear transaction boundary — don't split it into a chain Service A → Event → Service B → Event → Service C if it can be done in one transaction.

How to use

  1. If the user wants to design a new ERP/WMS module/ERD, go through this checklist item by item before writing the schema.
  2. If the user asks "which module first", refer to the MVP roadmap (A.9).
  3. Code naming/folder structure conventions are in the coding-standards skill.
  4. For the formal requirement document (BR→UAT), use the erp-requirements skill after the PRD.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.