agentleFS
patrick-fupatrick-fu/awesome-skills/log-driven-debugging/SKILL.md

log-driven-debugging

Skill66 starsChanged 2 months agoMITView on GitHub

Diagnose a rerunnable bug with targeted logs and the user's rerun. Use only when logging is requested, logs are provided, or static diagnosis has stalled.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 17 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the bug is slippery, stop guessing and build observability.

    line 9
  2. Distinctive:

    only then propose or implement the real fix

    line 21
  3. Distinctive:

    Use the log prefix supplied by the user or established by the repository.

    line 25
  4. Distinctive:

    If neither exists, choose a short, searchable prefix that is unique in the current codebase and tell the user which prefix to collect.

    line 26
  5. Distinctive:

    Ask only when the user's requirements or repository logging conventions leave a material ambiguity that cannot be resolved by inspection.

    line 30
  6. Distinctive:

    Do not scatter random prints everywhere.

    line 35
  7. Distinctive:

    Treat the timestamp as part of the standard format, not a nice-to-have.

    line 50
  8. Distinctive:

    Prefer logs that answer:

    line 52
  9. Distinctive:

    Prefer a consistent line shape such as:

    line 80
  10. Distinctive:

    When strings are important, escape newlines so one logical log stays on one physical line.

    line 86
  11. Distinctive:

    After instrumenting, tell the user exactly what to do next:

    line 90
  12. Distinctive:

    When the user sends logs back, do not jump straight to a fix.

    line 108
  13. Distinctive:

    Read the logs in order and answer:

    line 110
  14. Distinctive:

    Call out the precise transition where the bug begins, not just where it becomes visible.

    line 117
  15. Distinctive:

    If the logs prove the current instrumentation is insufficient, ask for one more round and specify the next smallest set of logs needed.

    line 119
  16. Distinctive:

    If proposing a fix, tie it directly to the observed divergence in logs.

    line 129
  17. Distinctive:

    Keep this skill general. It applies to:

    line 133

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

When the bug is slippery, stop guessing and build observability.

This skill is for situations where:

  • the visible symptom is known, but the actual failure layer is not
  • static code reading is no longer enough
  • one execution with good logs can collapse a large search space

The workflow is simple:

  1. decide where to instrument
  2. add high-signal logs
  3. have the user rerun the scenario
  4. analyze the returned logs
  5. only then propose or implement the real fix

First move

Use the log prefix supplied by the user or established by the repository. If neither exists, choose a short, searchable prefix that is unique in the current codebase and tell the user which prefix to collect. This routine choice does not need confirmation.

Ask only when the user's requirements or repository logging conventions leave a material ambiguity that cannot be resolved by inspection.

Logging strategy

Do not scatter random prints everywhere. Instrument the execution path deliberately.

Choose logs around:

  • entry points where the user action first enters the system
  • state transitions where data changes shape
  • serialization or conversion boundaries
  • async handoff points
  • final outbound effects such as send, save, render, request, or callback

For each log, include enough structure to reconstruct the flow:

  • the shared prefix
  • a timestamp
  • a short tag for the subsystem or phase
  • the minimum fields needed to compare expected vs actual behavior

Treat the timestamp as part of the standard format, not a nice-to-have. For tricky bugs, ordering is often as important as values.

Prefer logs that answer:

  • Did this code path run?
  • In what order did the steps happen?
  • What data existed at this point?
  • Where did duplication, loss, mutation, or branching first appear?

Avoid:

  • giant object dumps unless they are truly needed
  • vague messages like "here" or "called"
  • logging so much that the signal disappears

What to log

The exact fields depend on the bug, but in general log:

  • identifiers
  • counts
  • ranges or indexes
  • booleans for state
  • input and output summaries
  • boundary transformations

Examples:

  • count=4
  • state=editing
  • range={loc=12,len=3}
  • contentList=[0] mention | [1] text
  • requestID=...

Prefer a consistent line shape such as:

[<PREFIX>][2026-03-28T13:45:27.870+08:00][Serializer] contentList=[0] mention | [1] text

When strings are important, escape newlines so one logical log stays on one physical line.

Handoff to the user

After instrumenting, tell the user exactly what to do next:

  • rebuild or rerun the app/program
  • reproduce the issue once
  • collect the logs containing the chosen prefix
  • send those logs back

Be explicit that they should return only the lines with the prefix when possible.

Recommend a filter like:

rg "\\[<PREFIX>\\]" <log-file>

or an equivalent grep/search flow in their environment.

Analysis pass

When the user sends logs back, do not jump straight to a fix. Reconstruct the path first.

Read the logs in order and answer:

  1. What is the first confirmed event?
  2. What state is proven correct?
  3. What is the first line where reality diverges from expectation?
  4. Which layer owns that divergence?
  5. Is the bug caused by duplication, missing data, wrong boundary detection, stale state, or ordering/race?

Call out the precise transition where the bug begins, not just where it becomes visible.

If the logs prove the current instrumentation is insufficient, ask for one more round and specify the next smallest set of logs needed. Do not ask for a broad second pass if one or two extra logs will do.

Output expectations

Your response after log analysis should be crisp and causal:

  • what the logs prove
  • where the root cause starts
  • what is not the root cause
  • what code should change next

If proposing a fix, tie it directly to the observed divergence in logs.

Scope

Keep this skill general. It applies to:

  • app bugs
  • backend handlers
  • UI flows
  • serialization problems
  • async ordering issues
  • duplicated side effects
  • state machine bugs

It is not tied to any single language, framework, or repository.

Practical rule

The user runs the instrumented build. You analyze the prefixed logs.

That division of labor is the whole point of this skill.

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.