Understand — Module Mental Model
You are building the mental model a veteran engineer forms before touching code. Read deeply, report compactly. No edits. No fix proposals. No plans.
Phase 1 — Locate Boundaries
Identify what "the module" is:
- If given a path, list its full tree (
Glob on <path>/**/*).
- Find its namespace root and every sub-folder (slices, sub-features).
- Note sibling modules it might touch — you will trace those edges in Phase 3.
Phase 2 — Read the Core
Read in this order; skip nothing that exists:
- Entry points — controllers, route registrations, scheduled jobs, webhook handlers, console commands. Grep route files and scheduler files for the module's class names.
- Models & schema — every model the module touches: fillable, casts, relations, scopes. Then the migrations that shaped those tables.
- Domain services — the classes doing the real work. Read them fully, not just signatures.
- Events & listeners — every event the module fires or consumes; read each listener's
handle().
- Jobs — what dispatches them (event, scheduler, chain, batch) and what they delegate to.
- UI surface — views/components rendering this module's data.
- Tests — scan test names for the behavior contract; note what is covered and what is not.
- Config — module config files, env variables, feature flags, kill-switches.
Phase 3 — Trace the Flow
Assemble the journey of one record through the module:
- Trigger → what starts the flow (user action, schedule, event, webhook).
- State machine → every status/stage field: which class writes each value, which class consumes it.
- Events out / events in → what other modules learn from this one, and vice versa.
- Schedule hooks → every scheduler entry with cadence and the job it fires.
- Failure paths → retries, circuit breakers, error states, idempotency guards.
Output Contract
Report exactly these sections, in this order, compact:
- Purpose — one sentence.
- File map — tree of slices/files with a half-line role each.
- State machine — table: status value → written by → consumed by.
- Flow — the trigger-to-completion journey as a short numbered list.
- Events & schedules — what fires, when, who listens.
- Test coverage — what the suite proves; visible gaps (facts only, no fix proposals).
- Open questions — anything ambiguous that a change request would need answered.
End with: "Mental model ready. What do you want to change?"
Hard Rules
- Read files fully before summarizing them — never infer behavior from a name.
- Never conclude behavior from a controller alone; read the service it delegates to.
- No edits, no refactor suggestions, no "improvements noticed" — this skill only maps what exists.
1---2name: understand3description: Build a complete mental model of a codebase, module, or feature before any change is discussed. Use whenever the user says "understand the codebase", "first understand", "first of all understand", "explore the code", "how does X work", "understand @path fully", or opens a session by pointing at a module or directory. Read-only: this skill never edits, never plans changes, never proposes fixes. It produces a compact mental model — purpose, file map, state machine, event flow, schedule hooks — and ends ready for change requests. Always run this before planning any modification.4---56# Understand — Module Mental Model78You are building the mental model a veteran engineer forms before touching code. Read deeply, report compactly. **No edits. No fix proposals. No plans.**910## Phase 1 — Locate Boundaries1112Identify what "the module" is:13141. If given a path, list its full tree (`Glob` on `<path>/**/*`).152. Find its namespace root and every sub-folder (slices, sub-features).163. Note sibling modules it might touch — you will trace those edges in Phase 3.1718## Phase 2 — Read the Core1920Read in this order; skip nothing that exists:21221. **Entry points** — controllers, route registrations, scheduled jobs, webhook handlers, console commands. Grep route files and scheduler files for the module's class names.232. **Models & schema** — every model the module touches: fillable, casts, relations, scopes. Then the migrations that shaped those tables.243. **Domain services** — the classes doing the real work. Read them fully, not just signatures.254. **Events & listeners** — every event the module fires or consumes; read each listener's `handle()`.265. **Jobs** — what dispatches them (event, scheduler, chain, batch) and what they delegate to.276. **UI surface** — views/components rendering this module's data.287. **Tests** — scan test names for the behavior contract; note what is covered and what is not.298. **Config** — module config files, env variables, feature flags, kill-switches.3031## Phase 3 — Trace the Flow3233Assemble the journey of one record through the module:3435- **Trigger** → what starts the flow (user action, schedule, event, webhook).36- **State machine** → every status/stage field: which class writes each value, which class consumes it.37- **Events out / events in** → what other modules learn from this one, and vice versa.38- **Schedule hooks** → every scheduler entry with cadence and the job it fires.39- **Failure paths** → retries, circuit breakers, error states, idempotency guards.4041## Output Contract4243Report exactly these sections, in this order, compact:44451. **Purpose** — one sentence.462. **File map** — tree of slices/files with a half-line role each.473. **State machine** — table: status value → written by → consumed by.484. **Flow** — the trigger-to-completion journey as a short numbered list.495. **Events & schedules** — what fires, when, who listens.506. **Test coverage** — what the suite proves; visible gaps (facts only, no fix proposals).517. **Open questions** — anything ambiguous that a change request would need answered.5253End with: **"Mental model ready. What do you want to change?"**5455## Hard Rules5657- Read files fully before summarizing them — never infer behavior from a name.58- Never conclude behavior from a controller alone; read the service it delegates to.59- No edits, no refactor suggestions, no "improvements noticed" — this skill only maps what exists.