Crate rskim_core

Crate rskim_core 

Source
Expand description

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 rskim_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) { /* ... */ }"

§Design Principles

  1. Zero-copy where possible - Use &str slices, avoid allocations
  2. Result types everywhere - NO panics (enforced by clippy)
  3. Dependency injection - NO global state
  4. Type-first - Complete type schema before implementation

Structs§

Parser
Wrapper around tree-sitter Parser with language context
TransformConfig
Configuration for transformation
TransformResult
Result of transformation with optional metadata

Enums§

Language
Supported programming languages and markup formats
Mode
Output transformation mode
SkimError
Error types for Skim operations

Functions§

detect_language
Detect language from file extension
detect_language_from_path
Detect language from file path
supported_languages
Get list of supported languages
transform
Transform source code based on mode
transform_auto
Transform source code with automatic language detection from file path
transform_detailed
Transform source code with full result metadata
transform_with_config
Transform source code with custom configuration
version
Get library version

Type Aliases§

Result
Result type alias for Skim operations