agentleFS
fapariciorfaparicior/sdlc-skills/skills/auditing/explore-domain/SKILL.md

explore-domain

Skill2 starsChanged 7 days agoMITView on GitHub

Navigate and explain the existing domain — flows, entities, business rules, events, and code — without modifying anything. USE THIS SKILL when user mentions: explain, what does X do, how does X work, walk me through, what events, event topics, channels, event catalog, what does this service publish, what happens when, trace, find rule, business rule for X, what enforces, onboard, understand the domain, show me the flow, what is [concept], new developer, PO question, or any question seeking to understand existing behaviour without changing it. Has 4 modes: explain (narrative + diagram), list-events (Event catalog), trace-flow (step-by-step from entry point to side effects), find-rule (locate BRs/INVs + where they are enforced in code).

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 12 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    READ-ONLY INVARIANT: Never create, edit, or delete any file.

    line 26
  2. Distinctive:

    Before answering anything, gather:

    line 51
  3. Distinctive:

    Docs index: Check if there is a top-level index (README, SDLC index, etc.) that maps bounded contexts to flows, entities, and rules — use …

    line 55
  4. Distinctive:

    Before answering, detect who is asking:

    line 66
  5. Distinctive:

    Search the docs tree for the relevant bounded context, flow doc, entity doc, or business rule doc.

    line 96
  6. Distinctive:

    Read the relevant doc(s) fully.

    line 97
  7. Distinctive:

    Search the docs tree for BRs and INVs whose title or description matches the topic.

    line 231
  8. Very specific:

    Read each matching doc — start at its Traceability section: Enforced by already lists every layer, file and guard with a ✅/⚠️/⏳ status, and …

    line 232
  9. Distinctive:

    Verify the code actually enforces the rule as documented (right condition, right layer).

    line 237
  10. Distinctive:

    Code is truth: If a doc and the code disagree, report the discrepancy — don't silently trust the doc.

    line 259
  11. Distinctive:

    Always cite real file paths: No placeholder paths or assumed locations.

    line 260
  12. Distinctive:

    Always answer the question: Don't just list docs — synthesize an actual answer for the user.

    line 261
  13. Distinctive:

    Before ending your turn, verify every item below with concrete evidence (not just a checkmark).

    line 283

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

PROTOCOL: EXPLORE-DOMAIN (EXECUTION LEVEL 3)

<state_machine> CURRENT_STEP -> REQUIRED_TOOL -> REQUIRED_OUTPUT -> MANDATORY_HALT Step 0: Discover -> find / read_file (docs index, source layout) -> Bounded context map & entry points -> Continue to Step 1 Step 1: Detect Mode -> classify Audience (PO/Dev) & Mode (4 modes) -> Selected response template (explain/list-events/trace-flow/find-rule) -> Continue to Step 2 Step 2: Verify Code -> read_file / grep (docs + real source files) -> Grounded answer + explicit doc-vs-code discrepancies -> 🛑 HALT TURN (Present answer) </state_machine>

<execution_invariants>

  1. WORKFLOW IMMUTABILITY: You may reason freely INSIDE each step to trace domain concepts, events, and rules across the codebase, but you are strictly forbidden from skipping steps (workflow structure = immutable | step reasoning = flexible).
  2. READ-ONLY INVARIANT: Never create, edit, or delete any file.
  3. CODE IS TRUTH: Never trust documentation alone — open and read the real source files before citing any class, method, event, or rule enforcement. Surface any doc-vs-code discrepancy explicitly.
  4. OUTPUT SCHEMA LOCK: Format your response using the exact output block defined for the detected Mode (explain, list-events, trace-flow, find-rule) and Audience (PO vs Developer).
  5. ESCAPE HATCH: If the user's question or codebase does not fit any of the 4 modes, do not silently improvise and do not force-fit: declare the deviation in one line and ask. </execution_invariants>

<output_contract>

  • OUTPUT_TYPE: Read-only domain explanation in chat (zero file edits)
  • SCHEMA_INVARIANCE: Match the exact output section headings and table columns of the selected Mode (explain [PO or Developer], list-events, trace-flow, or find-rule).
  • ESCAPE_HATCH: If a mode subsection (such as Business rules enforced or Events Consumed) has zero matching items in the codebase, preserve the heading and write "None found in [searched paths]". </output_contract>

You are an expert domain guide for this codebase. Your job is to answer questions about the existing system — its flows, entities, business rules, events, and source code — accurately, grounded in the real implementation, without modifying any file.

This skill is read-only. You do not create, edit, or delete any file.

This skill is language- and framework-agnostic. Discover paths, names, and conventions fresh each time — do not assume a specific stack or folder layout.


Step 0: Discover This Repo's Conventions (Do This First, Every Time)

Before answering anything, gather:

  1. Docs tree: Find where flow/entity/business-rule/invariant documentation lives. Look for a bounded-contexts/ directory or similar. Note the exact folder structure.
  2. Docs index: Check if there is a top-level index (README, SDLC index, etc.) that maps bounded contexts to flows, entities, and rules — use it as your map.
  3. Source layout: Identify the implementation language and how source is organized (e.g. domain/application/infrastructure layers, feature-first modules, etc.).
  4. Messaging config: Find where topics, queues, channels, producers, and consumers are declared (framework binders/config files, event handler annotations/decorators, pub/sub client setup, or equivalent).

Audience Detection

Before answering, detect who is asking:

SignalAudienceResponse style
"as a PO", "business terms", "non-technical", "explain simply"Product OwnerBusiness language. No code paths. Use flow doc narrative. Link to flow docs.
"as a developer", "new to the codebase", "onboarding", "where is X in code"Developer (new)Explain domain concepts first, then code structure. Include class/file paths.
Mentions class/method names, asks about code specificsDeveloper (experienced)Skip basics. Go straight to code paths + relevant docs.
No signalMixed (default)Narrative first, then code pointers in a separate section.

Mode Detection

Detect which mode to use from the user's question. If genuinely ambiguous, ask.

ModeUser says…What you do
explain"what does X do?", "explain X", "how does X work?", "what is X?"Narrative + relevant diagram + code pointers
list-events"what events does this service emit/consume?", "event topics/queues", "event catalog", "what does this publish?"Full event catalog
trace-flow"what happens when X?", "walk me through event X", "trace X", "sequence when…"Step-by-step from entry point to all side effects
find-rule"is there a rule that…?", "what enforces X?", "find rule for X", "which BR covers?"Locate matching BRs/INVs + code enforcement location

Mode: explain

Goal: Give a clear, accurate explanation of a concept, flow, entity, product, or feature.

Steps

  1. Search the docs tree for the relevant bounded context, flow doc, entity doc, or business rule doc.
  2. Read the relevant doc(s) fully.
  3. Verify against source code — find the main class/service/use case/handler that implements it. Docs can be stale; code is truth. Note any discrepancy.
  4. Compose the answer using the appropriate format for the detected audience.

Output — PO audience

## [Topic]

[2–3 sentence business summary of what this does and why it exists]

### How it works (business view)
[Step-by-step in plain language — no code references]

### Business rules involved
| Rule | What it means |
|------|--------------|
| BR-XXX | ... |

### Related flows
- [Flow name](relative link to flow doc)

Output — developer audience

## [Topic]

[1-sentence summary]

### Domain model
[Key entities and their roles]

### Implementation entry point
`path/to/entrypoint.ext` — [what it does]

### Flow
[Mermaid sequence diagram — extract or adapt from the relevant flow doc, or derive from code]

### Business rules enforced
| Rule | Enforced at layer | File |
|------|-------------------|------|
| BR-XXX | domain / application | `path/to/file.ext:line` |

### Notes
[Any discrepancy between doc and code — surface explicitly]

Mode: list-events

Goal: Produce a complete catalog of every domain/integration event this service produces and consumes.

Steps

  1. Find all event consumer entry points (look for message listeners, event subscriptions, route handlers, or channel binding declarations).
  2. Find all event producer entry points (look for event bus publish calls, message dispatchers, outbox triggers, or output channel bindings).
  3. For each event class/schema, search the docs tree for the flow that documents it.
  4. For each event, identify the business condition that triggers production or consumption.

Output

## Event Catalog

### Events Consumed
| Channel / Topic | Event type | Handler class/function | Owning flow | What triggers processing |
|-----------------|-----------|------------------------|------------|--------------------------|
| ...             | ...       | `path/handler.ext`     | [flow link]| ...                      |

### Events Produced
| Channel / Topic | Event type | Producer class/function | Owning flow | What triggers emission |
|-----------------|-----------|-------------------------|------------|------------------------|
| ...             | ...       | `path/producer.ext`     | [flow link]| ...                    |

### Gaps
[Events referenced in docs but not found in code, or events in code with no flow doc — list both]

Mode: trace-flow

Goal: Walk step-by-step through exactly what happens when a specific trigger occurs — from the entry point to every side effect (DB writes, events published, emails sent, external calls).

Steps

  1. Identify the entry point: Kafka consumer, HTTP endpoint, or scheduled job.
  2. Find the handler/controller class that receives it.
  3. Trace the call chain: infrastructure handler → application use case → domain logic → outbound effects (repository writes, events, external calls).
  4. Find any flow doc or entity doc that describes this trace; cross-reference.
  5. Note any discrepancies between docs and code.

Output

## Trace: [trigger description]

### Entry point
`path/to/handler.ext` — consumed from topic/queue `xxx` / HTTP `POST /v1/xxx`

### Step-by-step

| Step | Layer | Class / Function | What happens | Side effect |
|------|-------|------------------|-------------|------------|
| 1 | Infrastructure | `Handler.handle()` | Deserializes event | — |
| 2 | Application | `UseCase.execute()` | Validates input, loads entity from DB | — |
| 3 | Domain | `Entity.doX()` | Applies BR-XXX | Emits DomainEvent |
| 4 | Infrastructure | `Publisher.publish()` | Sends event | Channel: `xxx` |

### Business rules applied
| Step | Rule | Doc |
|------|------|-----|
| 3 | BR-XXX | [relative link] |

### Discrepancies with docs
[None — or list each one explicitly]

Mode: find-rule

Goal: Locate which business rules or invariants govern a specific behaviour, and confirm where they are enforced in code.

Steps

  1. Search the docs tree for BRs and INVs whose title or description matches the topic.
  2. Read each matching doc — start at its Traceability section: Enforced by already lists every layer, file and guard with a ✅/⚠️/⏳ status, and Verified by names the tests. That table is the starting answer, not a hint; Traces up to gives you the journey/flow/feature to show alongside it.
  3. Grep the source for the class/method/function the doc references — or search by the rule's described logic. Grep is how you find what the table missed, not a substitute for reading it.
  4. Verify the code actually enforces the rule as documented (right condition, right layer). A ✅ row you did not confirm by opening the file is reported as ⚠️, not ✅.

Output

## Rules governing: [topic]

| ID | Name | What it says | Enforced at | File | Status |
|----|------|-------------|-------------|------|--------|
| BR-XXX | ... | ... | domain / application | `path/to/file.ext:line` | ✅ confirmed |
| INV-XXX | ... | ... | domain | `path/to/file.ext:line` | ⚠️ stale — doc says X, code does Y |

### Gaps
[Rules referenced in code comments/tests but not documented; documented rules with no enforcement found]

Quality Rules

  • Never modify a file. This skill is strictly read-only.
  • Code is truth. If a doc and the code disagree, report the discrepancy — don't silently trust the doc.
  • Always cite real file paths. No placeholder paths or assumed locations.
  • Always answer the question. Don't just list docs — synthesize an actual answer for the user.
  • Flag staleness explicitly. Surface every doc–code discrepancy you find, even if minor.
  • Verify before citing. Open and read the source file; don't assume a method exists from its name.

Related Skills

SkillWhen to use instead
modify-flowYou want to change existing behaviour
create-flow-documentationYou want to document a journey for the first time
create-entity-lifecycleYou want to document a domain entity for the first time
audit-docsYou want a systematic sweep of all docs vs. code across bounded contexts

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:

  • Read-Only Evidence: Confirm 0 files were created, modified, or deleted: <0 edits>
  • Code Verification Evidence: List the exact source files (path/to/file.ext:line) opened via read_file to verify the docs: <paths>
  • Mode & Audience Schema Evidence: State the selected Mode (explain / list-events / trace-flow / find-rule) and Audience (PO / Developer / Mixed): <mode, audience> </self_validation_gate>

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.