rskim-0.2.1 is not a library.
rskim
Smart code reader - streaming code transformation for AI agents.
Overview
rskim transforms source code by intelligently removing implementation details while preserving structure, signatures, and types - perfect for optimizing code for LLM context windows.
Think of it like cat, but smart about what code to show.
Installation
Via Cargo
Via npm (coming soon)
Quick Start
# Read TypeScript with structure mode
# Extract Python function signatures
# Pipe to syntax highlighter
|
# Read from stdin
|
Features
- 6 Languages: TypeScript, JavaScript, Python, Rust, Go, Java
- 4 Transformation Modes: Structure, Signatures, Types, Full
- Fast: <50ms for 1000-line files
- Streaming: Outputs to stdout for pipe workflows
- Safe: Built-in DoS protections
Usage
Basic Usage
Options
Transformation Modes
Structure Mode (Default)
Removes function bodies while preserving signatures (70-80% reduction).
Input:
function add(a: number, b: number): number {
const result = a + b;
console.log(`Adding ${a} + ${b} = ${result}`);
return result;
}
Output:
function add(a: number, b: number): number { /* ... */ }
Signatures Mode
Extracts only function and method signatures (85-92% reduction).
Input:
=
= *
return +
Output:
Types Mode
Extracts only type definitions (90-95% reduction).
Input:
interface User {
id: number;
name: string;
}
function getUser(id: number): User {
return db.users.find(id);
}
Output:
interface User {
id: number;
name: string;
}
Full Mode
Returns original code unchanged (0% reduction).
Examples
Explore a codebase
# Get overview of all TypeScript files
# Extract all Python function signatures
# Review Rust types
|
Prepare code for LLMs
# Reduce token count before sending to GPT
|
# Output: 150 (was 600)
# Get just the API surface
|
Pipe workflows
# Skim and highlight
|
# Skim and search
|
# Skim multiple files
|
Supported Languages
| Language | Extensions | Auto-detected |
|---|---|---|
| TypeScript | .ts, .tsx |
✅ |
| JavaScript | .js, .jsx, .mjs |
✅ |
| Python | .py |
✅ |
| Rust | .rs |
✅ |
| Go | .go |
✅ |
| Java | .java |
✅ |
Performance
- Parse + Transform: <50ms for 1000-line files
- Token Reduction: 60-95% depending on mode
- Streaming: Zero intermediate files
Security
Built-in protections against:
- Stack overflow attacks (max depth: 500)
- Memory exhaustion (max input: 50MB)
- UTF-8 boundary violations
- Path traversal attacks
Library
For programmatic usage, see the rskim-core library crate.
Links
- Repository
- Library Documentation
- npm Package (coming soon)
License
MIT