This document describes practical use cases for Skim and provides examples for each scenario.
Large codebases don't fit in LLM context windows. You need to give AI enough information to understand your code without overwhelming the token limit.
Use Skim to reduce token count by 60-90% while preserving structure.
Single file code review:
skim src/app.ts | llm "Review this architecture"Entire directory analysis:
skim src/ --no-header | llm "Analyze this codebase"Specific subdirectory:
skim src/components/ --mode signatures | llm "Review these components"Mixed-language codebase:
# Auto-detects TypeScript, Python, Rust, etc.
skim . --no-header | llm "Explain the architecture"- Use
--no-headerto reduce noise in LLM context - Choose mode based on how much detail you need:
- Structure (60% reduction): Good for architecture discussions
- Signatures (88% reduction): Focus on APIs
- Types (91% reduction): Focus on data structures
- Use
--show-statsto see token savings
On an 80-file TypeScript codebase:
- Original: 63,198 tokens (won't fit in many LLM contexts)
- With structure mode: 25,119 tokens (fits comfortably)
- With signatures mode: 7,328 tokens (fits with plenty of room)
Generating and maintaining API documentation is time-consuming and often out of sync with code.
Use Skim to automatically extract API surfaces from your entire codebase.
Generate API docs from directory:
skim src/ --mode signatures > api-docs.txtProcess specific file types:
skim 'lib/**/*.py' --mode signatures --jobs 8 > python-api.txtDocument mixed-language codebase:
skim . --no-header --mode signatures > full-api.txtGenerate type documentation:
skim src/ --mode types > types-reference.mdAdd to your CI pipeline to keep docs up-to-date:
# .github/workflows/docs.yml
- name: Generate API docs
run: |
skim src/ --mode signatures --no-cache > docs/api.txt
git add docs/api.txt- Use signatures mode for clean API reference
- Use types mode to document data structures
- Add
--no-headerfor cleaner output - Use
--jobsto speed up large codebases
Need to understand or analyze type definitions across a large codebase.
Use types mode to extract only type definitions.
Extract all types from directory:
skim src/ --mode types --no-headerExtract types from specific files:
skim 'src/**/*.ts' --mode types --no-headerAnalyze type dependencies:
skim src/models/ --mode types | grep "interface\|type"Generate type documentation:
skim src/ --mode types > type-reference.md- Schema extraction: Extract data models for documentation
- Type refactoring: Understand type dependencies before changes
- API contract review: Review interface definitions
- Type coverage analysis: See what's typed and what isn't
- Types mode gives 90-95% token reduction
- Perfect for understanding data flow
- Works great with TypeScript, Python (typing module), Rust
Need to quickly understand large files or modules without reading all implementation details.
Use Skim to get a high-level overview.
Quick overview of large file:
skim large-file.py | lessOverview of entire directory:
skim src/auth/ | lessOverview of specific module:
skim 'src/auth/*.ts' | lessSearch within structure:
skim src/ --no-header | grep "async function"- Pipe to
lessfor interactive browsing - Use with
grepto find specific patterns - Combine with
batfor syntax highlighting:skim src/app.ts | bat -l typescript
Pull requests with large changes are hard to review - too much implementation detail obscures the important changes.
Use Skim to focus on structural changes.
Review PR changes:
git diff main HEAD | skim - --language=typescriptCompare structure before/after:
git show main:src/app.ts | skim - -l typescript > before.txt
git show HEAD:src/app.ts | skim - -l typescript > after.txt
diff before.txt after.txtReview only signatures:
skim src/ --mode signatures --no-header > current-api.txt- Focus on what's changing, not how
- Use signatures mode for API changes
- Use types mode for schema changes
- Combine with diff tools for before/after comparison
New developers need to understand codebase structure without getting lost in implementation details.
Provide skimmed versions of the codebase for initial exploration.
Create onboarding documentation:
# High-level architecture
skim src/ --mode structure > docs/architecture.md
# API reference
skim src/ --mode signatures > docs/api.md
# Type system
skim src/ --mode types > docs/types.mdInteractive exploration:
# Let new developers explore structure
skim src/ | less
# Or with syntax highlighting
skim src/ | bat -l typescriptCreate a documentation kit:
mkdir onboarding
skim src/ --mode structure > onboarding/01-architecture.txt
skim src/ --mode signatures > onboarding/02-api-reference.txt
skim src/ --mode types > onboarding/03-type-system.txtDiscussing architecture changes requires shared understanding without drowning in implementation details.
Use Skim to create architecture diagrams from code.
Extract current architecture:
skim src/ --mode structure --no-header > current-architecture.txtCompare architectures:
skim feature-branch/src/ --mode structure > feature-arch.txt
skim main/src/ --mode structure > main-arch.txt
diff main-arch.txt feature-arch.txtFocus on specific layer:
skim src/services/ --mode signatures- Structure mode gives best overview
- Use with diff tools for comparisons
- Share output in architecture documents
- Use as basis for architecture decision records (ADRs)
Need to understand what's tested vs what's not.
Extract signatures and compare with test files.
Extract all functions:
skim src/ --mode signatures --no-header > all-functions.txtExtract tested functions:
skim tests/ --mode signatures --no-header | grep "test_" > tested-functions.txtFind untested code:
comm -23 <(sort all-functions.txt) <(sort tested-functions.txt)Large refactorings are risky - need to understand impact across codebase.
Use Skim to understand structure before refactoring.
Before refactoring:
skim src/ --mode structure > before-refactor.txtAfter refactoring:
skim src/ --mode structure > after-refactor.txt
diff before-refactor.txt after-refactor.txtCheck API compatibility:
skim src/ --mode signatures > v1-api.txt
# After changes
skim src/ --mode signatures > v2-api.txt
diff v1-api.txt v2-api.txt # Shows API changesProjects with multiple languages are hard to navigate and document.
Skim auto-detects all languages and processes them uniformly.
Process mixed codebase:
# Automatically handles .ts, .py, .rs, .go, etc.
skim src/Generate unified documentation:
skim . --no-header --mode signatures > full-api.txtLanguage-specific extraction:
# Still works - processes only Python files
skim 'src/**/*.py' --mode signaturesA project with TypeScript frontend, Python backend, and Rust utils:
$ tree src/
src/
├── frontend/ # TypeScript
├── backend/ # Python
└── utils/ # Rust
$ skim src/ # Processes all three languagesFor all use cases:
- Enable caching (default) for repeated operations
- Use
--jobsfor large codebases (speeds up by 4-8x) - Choose the right mode - more aggressive = faster processing
- Use
--no-headerwhen piping to other tools - Use
--show-statsto verify token reduction
- Start with structure mode - Good balance of information and reduction
- Use signatures for documentation - Clean API reference
- Use types for schema docs - Focus on data structures
- Pipe to other tools - Combine with grep, diff, bat, less
- Create documentation scripts - Automate doc generation
- Version your skims - Save structure at each release for comparison
skim src/app.ts | bat -l typescriptskim src/ --no-header | fzfskim src/ | grep "export function"# With llm (Simon Willison's tool)
skim src/ --no-header | llm "Explain this code"
# With aider
skim src/ --no-header | aider "Refactor this"#!/bin/bash
# Generate daily architecture snapshot
DATE=$(date +%Y-%m-%d)
skim src/ --mode structure > "snapshots/arch-$DATE.txt"See Performance for benchmarks showing token reduction on real codebases.