| Crates.io | rskim-core |
| lib.rs | rskim-core |
| version | 0.6.0 |
| created_at | 2025-10-15 23:07:55.456573+00 |
| updated_at | 2025-10-25 20:39:24.834721+00 |
| description | Core library for smart code reading and transformation |
| homepage | |
| repository | https://github.com/dean0x/skim |
| max_upload_size | |
| id | 1885094 |
| size | 101,918 |
Core library for smart code reading and transformation.
rskim-core is a Rust library that transforms source code by intelligently removing implementation details while preserving structure, signatures, and types. Perfect for optimizing code for LLM context windows.
&str, returns Result<String>[dependencies]
rskim-core = "0.3"
use rskim_core::{transform, Language, Mode};
fn main() {
let source = r#"
function add(a: number, b: number): number {
return a + b;
}
"#;
let result = transform(source, Language::TypeScript, Mode::Structure)
.expect("Transformation failed");
println!("{}", result);
// Output: function add(a: number, b: number): number { /* ... */ }
}
Removes function bodies while preserving signatures and structure.
let result = transform(code, Language::TypeScript, Mode::Structure)?;
Extracts only function and method signatures.
let result = transform(code, Language::Python, Mode::Signatures)?;
Extracts only type definitions (interfaces, enums, structs, etc.).
let result = transform(code, Language::Rust, Mode::Types)?;
Returns the original code unchanged.
let result = transform(code, Language::Java, Mode::Full)?;
Use transform_auto for automatic language detection from file paths:
use rskim_core::transform_auto;
use std::path::Path;
let result = transform_auto(
source,
Path::new("example.ts"),
Mode::Structure
)?;
| Language | Extensions | Node Types |
|---|---|---|
| TypeScript | .ts, .tsx |
Full support |
| JavaScript | .js, .jsx, .mjs |
Full support |
| Python | .py |
Full support |
| Rust | .rs |
Full support |
| Go | .go |
Full support |
| Java | .java |
Full support |
Built-in protections against:
.. in file paths&str slices where possibleAll functions return Result<String, SkimError>:
use rskim_core::{transform, SkimError};
match transform(source, Language::TypeScript, Mode::Structure) {
Ok(result) => println!("{}", result),
Err(SkimError::ParseError(msg)) => eprintln!("Parse error: {}", msg),
Err(SkimError::UnsupportedLanguage(ext)) => eprintln!("Unsupported: {}", ext),
Err(e) => eprintln!("Error: {}", e),
}
For command-line usage, see the rskim binary crate.
MIT