Skim Core - Smart code reading and transformation library
Overview
skim-core is a pure library for transforming source code by stripping
implementation details while preserving structure, signatures, and types.
Optimized for AI/LLM context windows.
Architecture
IMPORTANT: This is a LIBRARY with NO I/O.
- Accepts
&str(source code), not file paths - Returns
Result<String>, not stdout writes - Pure transformations, no side effects
CLI/SDK/MCP interfaces handle I/O separately.
Example
use skim_core::{transform, Language, Mode};
let source = "function add(a: number, b: number) { return a + b; }";
let result = transform(source, Language::TypeScript, Mode::Structure)?;
// Result: "function add(a: number, b: number) { /* ... */ }"
# Ok::<(), skim_core::SkimError>(())
Design Principles
- Zero-copy where possible - Use
&strslices, avoid allocations - Result types everywhere - NO panics (enforced by clippy)
- Dependency injection - NO global state
- Type-first - Complete type schema before implementation