skills/smart-reading/SKILL.md
Behavioral protocol for reading files or command output of unknown size. Loaded automatically for all file reading operations. Also triggered by: 'this file is huge', 'output was cut off', 'large file', 'how should I read this', 'truncated output', 'missing data from file'.
npx skillsauth add axiomantic/spellbook smart-readingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
head, tail -n, arbitrary pipes) creates false confidence. Critical errors often appear at end of output.wc -l) before deciding read approach.$$ for collision-free naming.Claude often pipes output through head -100 to "save tokens." This causes:
Check size first, then act:
| Line Count | Need Exact Text? | Action | |------------|------------------|--------| | ≤200 | Yes (editing) | Read directly, full file | | ≤200 | No (understanding) | Read directly, full file | | >200 | Yes (editing specific section) | Read directly with offset/limit to target section | | >200 | No (understanding/analysis) | Delegate to Explore subagent with intent |
wc -l < "$FILE" # Get line count first
For commands with unpredictable output size, capture to temp file first using tee.
# Capture full output while still seeing it stream
# /tmp/cmd-$$-output.txt — use $$ (process ID) to avoid collisions
command 2>&1 | tee /tmp/cmd-$$-output.txt
# Check size
wc -l < /tmp/cmd-$$-output.txt
# Apply decision matrix (read directly or delegate)
# ...
# ALWAYS cleanup
rm /tmp/cmd-$$-output.txt
| Scenario | Approach |
|----------|----------|
| Need to see output streaming AND analyze after | tee to temp file |
| Pure analysis, don't need streaming | Delegate entire command to subagent |
| Interactive command or watching for specific event | Run directly, no capture |
rm /tmp/cmd-$$-output.txttrap 'rm -f /tmp/cmd-$$-output.txt' EXITTest run with capture:
pytest tests/ 2>&1 | tee /tmp/test-$$-output.txt
wc -l < /tmp/test-$$-output.txt # Check size
# If >200: delegate analysis of /tmp/test-$$-output.txt
# If ≤200: read directly
rm /tmp/test-$$-output.txt
Build with capture:
npm run build 2>&1 | tee /tmp/build-$$-output.txt
# Analyze...
rm /tmp/build-$$-output.txt
Pure delegation (no capture needed):
Task(Explore): Run `pytest tests/` and extract all failures with
stack traces. Return a summary of what failed and why.
When delegating to a subagent, specify WHY you need the file. The subagent reads ENTIRE content and returns a targeted summary.
| Intent | Subagent Behavior | Example Prompt | |--------|-------------------|----------------| | Error extraction | Find all errors, warnings, failures. Return with context. | "Read the test output and extract all failures with their stack traces" | | Technical summary | Comprehensive but condensed overview preserving structure | "Summarize this config file's structure and key settings" | | Presence check | Does concept X exist? Where? | "Does this file implement rate limiting? If so, where and how?" | | Diff-aware | What changed and why does it matter? | "Compare these two versions and explain the significant changes" | | Structure overview | What's in this file, how is it organized | "Outline the structure of this module - classes, functions, their purposes" |
Read [file/output] in full. [INTENT STATEMENT]
Return:
- [What you need back]
- [Any specific format requirements]
Do not truncate. Read the entire content before summarizing.
Forbidden:
pytest tests/ 2>&1 | head -100 # WRONG: errors often at end
cat src/large_module.py # WRONG: might be 2000 lines
Required:
wc -l < src/large_module.py # Returns: 1847
# Now delegate to subagent for summary, or read specific section
Task(Explore): Run pytest tests/ and analyze the output. Extract all
test failures with their full tracebacks and error messages. Summarize
the failure patterns.
| Situation | Use Direct Read | Use Delegation | |-----------|----------------|----------------| | File known small (configs, small scripts) | Yes | No | | Need exact text for editing | Yes (offset/limit for large) | No | | File already in context | Yes | No | | Quick verification of known lines | Yes | No | | Test output (failures cluster unpredictably) | No | Yes | | Build logs (errors often at end) | No | Yes | | Large source file, need understanding | No | Yes | | Multiple files to cross-reference | No | Yes | | Output where you don't know what you're looking for | No | Yes |
Before running command with unpredictable output:
6. Capture with tee for post-analysis? Or delegate entire command?
7. If capturing: cleanup plan exists?
8. If delegating: intent specified clearly?
</analysis>
Before completing:
If ANY unchecked: STOP and fix approach.
<BEFORE_RESPONDING> Before reading any file or command output:
wc -lhead, tail -n, or a truncating pipe? → STOP. Delegate instead.Before running a command with unpredictable output:
tee to analyze after? Or delegate the entire command?<FINAL_EMPHASIS> You are a Context Guardian. Your obligation: no important information is silently discarded. The critical error lives on line 247. Blind truncation destroys it before you ever see it. Check size. Delegate with intent. Clean up. Never truncate blind. </FINAL_EMPHASIS>
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment. Triggers: 'write a skill', 'new skill', 'create a skill', 'skill doesn't work', 'skill isn't firing', 'edit skill', 'skill quality'. NOT for: general prompt improvement (use instruction-engineering) or command creation (use writing-commands).
development
Use when you have a spec, design doc, or requirements and need a detailed implementation plan before coding. Triggers: 'write a plan', 'create implementation plan', 'plan this out', 'break this down into steps', 'convert design to tasks', 'implementation order'. Also invoked by develop during planning. NOT for: reviewing existing plans (use reviewing-impl-plans).
testing
Use when creating new commands, editing existing commands, or reviewing command quality. Triggers: 'write command', 'new command', 'create a command', 'review command', 'fix command', 'command doesn't work', 'add a slash command'. NOT for: skill creation (use writing-skills).
development
Use when about to claim discovery during debugging. Triggers: "I found", "this is the issue", "I think I see", "looks like the problem", "that's why", "the bug is", "root cause", "culprit", "smoking gun", "aha", "got it", "here's what's happening", "the reason is", "causing the", "explains why", "mystery solved", "figured it out", "the fix is", "should fix", "this will fix". Also invoked by debugging, scientific-debugging, systematic-debugging before any root cause claim.