Install
npx skillscat add lis186/sourceatlas/flow Install via the SkillsCat registry.
SourceAtlas: Flow Analysis
Target: $ARGUMENTS
STEP 0: Mode Detection (EXECUTE IMMEDIATELY)
IMPORTANT: Check these patterns FIRST before doing anything else.
Check for Tier 2-3 Keywords (External Mode Required)
Scan $ARGUMENTS for these keywords. If ANY match, load external file and STOP reading this document:
| If arguments contain... | Then execute this action |
|---|---|
| "dead code" OR "unreachable" OR "unused" | Read scripts/atlas/flow-modes/mode-13-dead-code.md then follow its instructions |
| "async" OR "thread" OR "concurrent" OR "race" | Read scripts/atlas/flow-modes/mode-14-concurrency.md then follow its instructions |
| "taint" OR "injection" OR "untrusted" | Read scripts/atlas/flow-modes/mode-12-taint-analysis.md then follow its instructions |
| "state" OR "status" OR "lifecycle" | Read scripts/atlas/flow-modes/mode-04-state-machine.md then follow its instructions |
| "transaction" OR "rollback" OR "commit" | Read scripts/atlas/flow-modes/mode-09-transaction.md then follow its instructions |
| "log" OR "logging" OR "from logs" | Read scripts/atlas/flow-modes/mode-06-log-discovery.md then follow its instructions |
| "compare" OR "diff" OR "vs" | Read scripts/atlas/flow-modes/mode-05-flow-comparison.md then follow its instructions |
| "feature toggle" OR "feature flag" | Read scripts/atlas/flow-modes/mode-07-feature-toggle.md then follow its instructions |
| "cache" OR "redis" OR "TTL" | Read scripts/atlas/flow-modes/mode-11-cache-flow.md then follow its instructions |
If a keyword matched above: Load the file NOW, then execute ONLY that mode's instructions. Do NOT continue reading this document.
Check for Tier 1 Keywords (Built-in Modes)
If none of the above matched, check for these Tier 1 patterns:
| If arguments contain... | Mode to use |
|---|---|
| "who calls" OR "callers" OR "called by" | Mode 1: Reverse Tracing (see below) |
| "error" OR "failure" OR "exception" OR "fail" | Mode 2: Error Path (see below) |
| "data flow" OR "how is X calculated" OR "trace variable" | Mode 3: Data Flow (see below) |
| "event" OR "message" OR "pub/sub" OR "listener" | Mode 8: Event Tracing (see below) |
| "permission" OR "role" OR "auth" OR "access control" | Mode 10: Permission Flow (see below) |
| (none of the above) | Standard Flow Tracing (default) |
STEP 1: Cache Check
If --force NOT in arguments:
- Convert flow name to filename: lowercase, spacesโhyphens, max 50 chars
- Check:
ls .sourceatlas/flows/{name}.md 2>/dev/null - If exists: Load and output cache, then STOP
- If not exists: Continue
STEP 2: Find Entry Point
If explicit path given (e.g., "from OrderService.create()"):
โ Start tracing immediately
If flow description only (e.g., "checkout flow"):
โ Search for entry points:
grep -rn "{keyword}" --include="*.ts" --include="*.js" --include="*.py" src/ app/ lib/ 2>/dev/null | head -15โ Present options if multiple matches
STEP 3: Trace Flow
From entry point, trace each step:
- Read the function
- Identify what it calls
- Follow the chain (depth: 5 levels default)
- Stop at boundaries (DB, external API, third-party)
For each step capture:
- Function name
- File:line location
- Business meaning
- Notable patterns (๐ security, ๐พ DB, ๐ API, โก async, โ ๏ธ risk)
STEP 4: Output Format
{Flow Name}
===========
Entry Point: {file}:{line}
โโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step โ Operation โ Location โ
โโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโค
โ 1 โ {description} โ {file}:{line} โ
โ 2 โ {description} โ {file}:{line} โ
โโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโ
Flow Diagram:
{entry}() โ {step1}() โ {step2}() โ {step3}()
Notable Patterns:
โโโ ๐ {pattern1}
โโโ ๐พ {pattern2}
โโโ โ ๏ธ {pattern3}
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Mode: Standard | Confidence: ~85% | Depth: 5
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโTier 1 Mode: Reverse Tracing
Trigger: "who calls", "callers", "called by"
Find all callers of target function:
Who calls {function}?
=====================
Callers (N found):
โโโ {Caller1}() โ {description}
โ ๐ {file}:{line}
โโโ {Caller2}() โ {description}
โ ๐ {file}:{line}
โโโ {Caller3}() โ {description}
๐ {file}:{line}
๐ก Modifying {function} affects these {N} callersTier 1 Mode: Error Path
Trigger: "error", "failure", "exception", "fail"
Trace failure scenarios:
{Flow} Error Paths
==================
1. {Step}
๐ {file}:{line}
โ ๏ธ Failure โ {ErrorType}
โโโ {what happens}
๐ Risk: {identified risk}Tier 1 Mode: Data Flow
Trigger: "data flow", "how is X calculated", "trace variable"
Track data transformations:
Data Flow: {variable}
=====================
[Input] {source}
โ
1. {Transform} โ {result}
๐ {file}:{line}
โ
[Output] {final}Tier 1 Mode: Event Tracing
Trigger: "event", "message", "pub/sub", "listener"
{EVENT} Tracing
===============
๐ค Emission: {Publisher}() โ emit("{EVENT}")
๐ {file}:{line}
๐ฅ Listeners:
โโโ {Listener1}() โ {action}
โ ๐ {file}:{line}
โโโ {Listener2}() โ {action}
๐ {file}:{line}Tier 1 Mode: Permission Flow
Trigger: "permission", "role", "auth", "access control"
{Operation} by Role
===================
[ADMIN] โ Full access
โโโ {check} ๐ @RequireRole("ADMIN")
โโโ ๐ {file}:{line}
[USER] โ Limited access
โโโ {check} ๐ @CheckOwnership
โโโ ๐ {file}:{line}Self-Verification
Before output, verify:
- File paths exist:
test -f {path} - Methods exist:
grep -q "{method}" {file}
Add to footer: โ
Verified: [N] paths, [M] methods
Auto-Save (Default Behavior)
After analysis completes, automatically:
mkdir -p .sourceatlas/flows- Save to
.sourceatlas/flows/{name}.md - Append:
๐พ Saved to .sourceatlas/flows/{name}.md
Deprecated: --save flag
If --save is in arguments:
- Show:
โ ๏ธ --save is deprecated, auto-save is now default - Remove
--savefrom arguments - Continue normal execution (still auto-saves)
๐บ๏ธ SourceAtlas v3.0 โ Tiered Architecture