# Code Flow Analysis

> Traces a code execution path with file:line references and an execution diagram before any change. Use this skill when about to fix a bug, implement a feature, refactor, or start a TDD cycle on non-trivial code. Do not use when/for pure design discussion without code (use design-exploration) or after a fix is already validated.

- Skill: `jagreehal/code-flow-analysis` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add jagreehal/code-flow-analysis`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jagreehal/code-flow-analysis/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jagreehal (https://skillmd.com/u/jagreehal)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/jagreehal/code-flow-analysis

---


# Code Flow Analysis

## Critical rules

- Trace before implementing non-trivial changes. No abstractions like "the handler" — use `file:line`.
- Diagrams stay short (5-15 lines). Show `fn(args, deps)`, Result `ok`/`err`, workflow steps, error mark.
- Confirm understanding with the user before changing code.
- Red flags: fix without file:line; adding retry/validation/cache without checking upstream; changing internals without callers; assuming Result is ok.
- Before drawing examples or pattern-specific traces, read [references/examples.md](references/examples.md).

## Workflow

1. Trace: entry point, `fn(args, deps)` chain, error/change location, workflow steps, Result propagation — all with `file:line`.
2. Draw a concise execution diagram (see examples).
3. Verify: "Here's the flow: [diagram]. Error/change at [file:line] when [condition]. Correct?" Wait for confirmation.
4. Only then implement (feeds `debugging-methodology` / `tdd-workflow`).

## Resources

- [references/examples.md](references/examples.md) — diagram shape, Result/workflow traces, bug/feature examples, rationalizations. Read before tracing non-trivial flows.

## Validation

- [ ] Entry and full call chain with `file:line`
- [ ] Result propagation and error/change location marked
- [ ] Diagram concise (5-15 lines)
- [ ] User confirmed understanding before code changes

## Constraints

- Skip for typos, formatting, docs-only.
- Related: `debugging-methodology`, `tdd-workflow`, `result-types`, `fn-args-deps`, `resilience`, `validation-boundary`, `confidence-levels`.

