context-optimization — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited context-optimization (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Claude Code's context window is finite. Efficient use of context enables longer sessions, larger refactors, and deeper analysis without hitting limits or losing important earlier information.
Estimate context costs before reading files:
Small file (< 100 lines): ~500-1000 tokens -- Read freely
Medium file (100-500 lines): ~1000-5000 tokens -- Read if needed
Large file (500+ lines): ~5000+ tokens -- Use offset/limit or subagentFor large files, read only the relevant section:
Read:
file_path: "src/services/auth.ts"
offset: 150 # Start at line 150
limit: 50 # Read only 50 linesStart with structure, then drill into details:
# Step 1: Understand the project structure (cheap)
Glob: "src/**/*.ts"
# Step 2: Find the relevant area (cheap)
Grep: pattern "export function authenticate"
# Step 3: Read only the relevant file (targeted)
Read: "src/middleware/auth.ts"
# Step 4: Read related files only if needed
Read: "src/types/auth.ts"Do not read all source files upfront. Discover what you need, then read it.
When a file's contents have been read and discussed, refer to it by path and line number instead of quoting large blocks:
# EXPENSIVE: Quoting 30 lines of code in your response
"The function at lines 45-75 does X, here is the full code: ..."
# EFFICIENT: Reference by path and line
"The authenticate function at src/middleware/auth.ts:45 handles
token validation. The error branch at line 62 needs updating."Use subagents when exploration would consume too much main context:
# BAD: Reading 15 files directly into main context
Read: "src/db/users.ts"
Read: "src/db/posts.ts"
Read: "src/db/comments.ts"
... (12 more files)
# GOOD: Delegate to subagent, receive summary only
Agent (Explore):
prompt: "Read all files in src/db/. For each file, report:
1. Table/model name
2. Key query functions
3. Whether it uses parameterized queries
Return a concise table with these columns."The subagent reads all 15 files in its own context. The main context receives only the summary table.
Use Grep to locate exactly what you need before reading entire files:
# Step 1: Find where the function is defined
Grep:
pattern: "export function processPayment"
output_mode: "content"
-C: 3
# Step 2: Read only if you need more context around it
Read:
file_path: "src/services/billing.ts"
offset: 120
limit: 40Match task complexity to remaining context:
High context remaining (early in session):
Low context remaining (late in session):
Common context wasters to avoid:
# WASTE: Reading a file you will not modify
Read: "package.json" # Just to "check" — only read if you need specific info
# WASTE: Reading the same file twice
Read: "src/app.ts" # Read earlier in session
Read: "src/app.ts" # Reading again because you forgot — check conversation first
# WASTE: Large verbose tool output
Bash: "npm list --all" # Produces hundreds of lines
# Better: "npm list --depth=0" # Top-level only
# WASTE: Reading generated files
Read: "dist/bundle.js" # Generated, not useful
Read: "node_modules/..." # Never read node_modulesnpm list --all, find / -name "*.ts", or git log without limits dump large amounts of text. Always constrain output with flags or pipes.| Strategy | When | How |
|---|---|---|
| Progressive disclosure | Starting exploration | Glob -> Grep -> Read (targeted) |
| Offset/limit | Large files | offset: N, limit: M on Read |
| Subagent firewall | Many files to analyze | Agent (Explore) with summary prompt |
| Reference by path | Discussing code | file.ts:line instead of quoting |
| Targeted grep | Finding specific code | Grep with context before Read |
| Output constraints | Bash commands | Use --depth, head, tail, flags |
Rule: Read only what you need, when you need it. Summarize, do not quote.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.