understand
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", "ex
SKILL.mdskills/understand/SKILL.md
GitHubUnderstand — 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 (
Globon<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.