agentleFS
tr1v3rtr1v3r/code-flow/SKILL.md

code-flow

Skill0 starsChanged 3 months agoMITView on GitHub

Turn real code into a compact, code-level text flow that aligns calls, states, ownership, branches, and causal propagation inside one `text` code block. Use this skill whenever the user asks how code flows, requests a lifecycle or dependency/data/event propagation explanation, wants a call chain or state transition mapped, asks for a compact architecture/workflow summary grounded in a repository, or says the explanation is too fragmented and wants the key lines arranged vertically. Prefer it even when the user does not say “diagram.” Do not use it for branch diff summaries or graphical HTML/SVG diagrams.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. HeTPort/skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 14 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When a repository is available:

    line 26
  2. Distinctive:

    Verify important claims against code or discriminating tests.

    line 32
  3. Very specific:

    Use actual symbol names such as Load, refresh, epoch, or Dispose.

    line 34
  4. Very specific:

    If code is unavailable, say // inferred or // assumption on the uncertain line instead of presenting it as verified.

    line 36
  5. Distinctive:

    Do not create one section per function.

    line 52
  6. Distinctive:

    Put a consequence below its trigger.

    line 79
  7. Distinctive:

    Use this shape unless the user explicitly asks for another format:

    line 83
  8. Distinctive:

    Prefer concrete names over generic narration.

    line 142
  9. Distinctive:

    Keep one line to one important action or consequence.

    line 143
  10. Very specific:

    Use short inline comments only when timing is crucial: // notify after active.

    line 144
  11. Distinctive:

    Put paired contrasts together: active/inactive, owner/child, snapshot/live, success/error.

    line 145
  12. Distinctive:

    Keep branches shallow; split into another phase when indentation becomes hard to scan.

    line 147
  13. Distinctive:

    When code derives a child context, group, or scope, state explicitly whether that also changes service lookup or isolation.

    line 156
  14. Distinctive:

    Before finalizing, check every contrast named by the user and give each one an explicit line in the flow.

    line 158
  15. Distinctive:

    Call out synchronous versus queued/concurrent transitions.

    line 159
  16. Distinctive:

    When asked to persist the result:

    line 174
  17. Very specific:

    create a focused Markdown file such as docs/<topic>-flow.md.

    line 176
  18. Very specific:

    keep the title outside and the complete explanation in one text block.

    line 177
  19. Distinctive:

    add it to an existing documentation index if one exists.

    line 178
  20. Very specific:

    when the bundled script is available, run python scripts/validate_output.py <file>.

    line 181

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

Code Flow

Explain code as one compact causal map rather than scattered prose.

Goal

Make a reader able to trace, at a glance:

  • where the flow enters;
  • which concrete functions or modules run next;
  • which state or ownership changes occur;
  • what triggers each branch;
  • how effects propagate downstream;
  • how cleanup, failure, or concurrency changes the path.

The output is not merely an ASCII restatement of prose. It is a compressed model of the implementation.

Evidence first

When a repository is available:

  1. Locate the public entry point and the internal implementation it delegates to.
  2. Trace calls until the flow reaches a stable outcome, boundary, or cleanup path.
  3. Inspect the data structures carrying state, identity, ownership, or dependencies.
  4. Inspect error, disposal, retry, and concurrency paths when they affect semantics.
  5. Verify important claims against code or discriminating tests.

Use actual symbol names such as Load, refresh, epoch, or Dispose. Do not invent steps to make the diagram look complete.

If code is unavailable, say // inferred or // assumption on the uncertain line instead of presenting it as verified.

Choose the axes

Most requests need only two to five sections. Select the axes that explain causality:

  • entry and registration;
  • main execution path;
  • state machine;
  • ownership and lifetime;
  • dependency, event, or data propagation;
  • failure and retry;
  • concurrency and convergence;
  • cleanup and terminal state;
  • core invariants and implementation files.

Do not create one section per function. Combine adjacent calls that serve one phase.

Build the causal chain

Arrange the happy path vertically first:

entry()
  ↓
resolve()
  ↓
apply()
  ↓
stable state

Then add branches exactly where their conditions diverge:

resolve()
  ├─ dependency missing → pending
  └─ dependency ready
       └─ run()
            ├─ error   → cleanup → failed
            └─ success → active

Put a consequence below its trigger. Avoid placing related facts in separate paragraphs where the reader must reconnect them.

Output contract

Use this shape unless the user explicitly asks for another format:

  1. An optional short Markdown title.
  2. Exactly one fenced text code block containing all substantive explanation.
  3. Phase headings written as 【阶段名称】.
  4. Aligned │, ├─, └─, ↓, and → connectors.
  5. Important calls, states, identities, and consequences on their own vertical lines.
  6. A final 【核心关系】 or 【核心不变量】 section when it clarifies the model.
  7. A compact 核心实现 list when repository files were inspected.

Example skeleton:

【入口与装配】

PublicEntry()
  └─ internalEntry()
       ├─ 建立 state
       ├─ 固定 owner
       └─ start()
            ↓

【主流程】

start()
  └─ resolve()
       ├─ 条件 A → pending
       └─ 条件 B
            └─ apply()
                 ├─ error   → rollback
                 └─ success → active

【传播与回收】

state change
  └─ notify()
       └─ dependent.refresh()
            └─ re-resolve → reload

owner.Dispose()
  └─ effects newest-first
       └─ child.Dispose()

【核心不变量】

identity
  └─ 决定是否复用

generation
  └─ 决定是否重载

核心实现
  ├─ entry.go    → 入口与装配
  ├─ runtime.go  → 状态与迁移
  └─ cleanup.go  → 所有权与回收

Compression rules

  • Prefer concrete names over generic narration.
  • Keep one line to one important action or consequence.
  • Use short inline comments only when timing is crucial: // notify after active.
  • Put paired contrasts together: active/inactive, owner/child, snapshot/live, success/error.
  • State what does not happen when it prevents a common misunderstanding.
  • Keep branches shallow; split into another phase when indentation becomes hard to scan.
  • End after the reader can reconstruct the lifecycle. Do not repeat the whole diagram in prose.

Accuracy rules

  • Distinguish notification from the state change that actually drives propagation.
  • Distinguish structural parent/child ownership from dependency edges.
  • Distinguish registration identity from the mutable value stored in a registration.
  • Distinguish per-instance state from shared runtime/module state.
  • When code derives a child context, group, or scope, state explicitly whether that also changes service lookup or isolation; never infer isolation from structural nesting.
  • Preserve exact ordering when it changes visibility or cleanup behavior.
  • Before finalizing, check every contrast named by the user and give each one an explicit line in the flow.
  • Call out synchronous versus queued/concurrent transitions.
  • Show rollback before failure when partial effects are cleaned up.

Avoid

  • Multiple small code blocks separated by prose.
  • Mermaid or graphical artifacts unless the user asks for them.
  • A flat bullet list pretending to be a flow.
  • Exhaustive function catalogs without causal structure.
  • Unsupported claims based only on names or comments.
  • Stable ordering claims when the implementation iterates maps or concurrent tasks.
  • Large paragraphs outside the diagram that duplicate it.

Saving as documentation

When asked to persist the result:

  • create a focused Markdown file such as docs/<topic>-flow.md;
  • keep the title outside and the complete explanation in one text block;
  • add it to an existing documentation index if one exists;
  • preserve the repository's language and documentation conventions;
  • validate balanced fences and git diff --check;
  • when the bundled script is available, run python scripts/validate_output.py <file>.

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.