log-extract
Skill0 starsChanged 7 months agoMITView on GitHub
Extract relevant lines from a large log file: error / warning / panic / traceback patterns plus N lines of surrounding context, with deduplicated stack traces. Returns a compact summary instead of streaming the whole log into Claude's context. Use for production logs, Sentry exports, test output captured to disk, debug traces, etc.
In this repository9 other files it gives its agents.
- answer-cacheSkill
- api-contractSkill
- codemapSkill
- diff-summarySkill
- file-summarySkill
- git-digestSkill
- run-quietSkill
- session-handoffSkill
- test-failures-onlySkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Do NOT invoke when:
- Very specific: line 46
Run these in a single parallel Bash batch against the log path <LOG>:
- Very specific: line 78
If nodedup=true, skip step 4-5 above and treat every hit as its own group.
- Very specific: line 114
If a group has only one occurrence, use [×1 at <time>] (or just [×1] if no timestamp could be parsed).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
log-extract
A Markdown-only skill — no Python, no scripts. You (Claude) extract the
relevant lines from a log file using grep -nC, head, tail, and wc
via the Bash tool, then deduplicate and render.
When to invoke
Invoke log-extract when ANY of these apply:
- The user points you at a log file and asks "what's wrong?" or "find the error".
- You're about to
cat/Reada log file larger than ~500 lines. - You need to find specific events in a log without paying for the whole file.
Do NOT invoke when:
- The log is small (<200 lines) — just read it.
- The user wants a specific exact section (use
Readwith line offsets). - The file is structured data (JSON / CSV) — use the right parser instead.
Defaults
| Setting | Default | Override with |
| Context lines around each match | 2 | context=N |
| Max hit groups shown | 30 | max=N |
| Head lines | 0 | head=N |
| Tail lines | 5 | tail=N |
| Deduplicate | on | nodedup=true |
| Pattern (extended regex, case-insensitive) | (error|errno|exception|traceback|failed|failure|panic|fatal|warn(ing)?) | pattern="<regex>" |
How to run
Run these in a single parallel Bash batch against the log path <LOG>:
| Command | Yields |
wc -l "<LOG>" | Total line count. |
head -n <head_n> "<LOG>" | Head lines (skip if head_n is 0). |
tail -n <tail_n> "<LOG>" | Tail lines. |
grep -niE -C <context> "<pattern>" "<LOG>" | head -n <(max+10)*(2*context+1)> | Candidate hits with context. |
The grep -C output uses -- as a group separator and lines like
123:<line text> for matched lines, 124-<line text> for context. Parse
the output into groups split on --.
Deduplication
For each hit group, build a normalized signature by collapsing the matched lines only (ignore context lines for the signature):
- Strip leading timestamps. Common formats to drop:
YYYY-MM-DD HH:MM:SS(.fff)?[YYYY/MM/DD HH:MM:SS]- ISO 8601 with timezone
- Bare
HH:MM:SS
- Strip ANSI escapes:
s/\x1B\[[0-9;]*[a-zA-Z]//g - Replace numbers with
N(matches PIDs, ports, addresses, line numbers). - Lowercase.
Group hits whose normalized signature is identical. Record:
count(number of occurrences),first_timeandlast_time(parsed timestamps if any),- one representative hit group (the first occurrence, with its full context).
If nodedup=true, skip step 4-5 above and treat every hit as its own group.
Cap the visible groups at max (default 30). Sum the rest into a
… (+N more hit groups) line.
Output format
log-extract: <path> (<total_lines> lines, <hits> hits → <unique_groups> unique)
head (<N>):
<line>
…
hits:
[×<count> — first at <first_time>, last at <last_time>]
<context line>
<matched line>
<context line>
[×<count> at <single_time>]
<context>
<matched>
<context>
… (+<extra> more hit groups)
tail (<N>):
<line>
…- Omit
headifhead_n=0or no lines. - Omit
hits:body entirely if there are no matches; instead print a single lineno matches for pattern "<pattern>". - If a group has only one occurrence, use
[×1 at <time>](or just[×1]if no timestamp could be parsed).
Notes
- The default pattern is broad on purpose. Pass a tighter
pattern=when the user knows what they're looking for (e.g.pattern="TimeoutError"). - For very large logs (multi-GB),
grepstreams the file — no memory concerns. The Bash tool may truncate stdout, so use the\| head -n <K>cap shown above to keep output bounded. - For non-UTF-8 logs, add
LC_ALL=Cbeforegrepto avoid locale-related slowdowns and decoding errors. - This skill never modifies the log file.
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
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.

