Ripdoc
Ripdoc prints a syntactical outline of a crate's public API and documentation. The CLI provides on-demand access to these resources from any source (local filesystem or through crates.io), perfect for AI agent usage.
For AI Agents
Ripdoc is built to be the "eyes" of an AI agent in a Rust codebase.
printandlistsubcommands explores and prints crate API (local or from crates.io), searches/filters, and provides agent-consumable markdown-formatted context.readmesubcommand prints just the contents of a crate's README.skelebuildis a statefule, semi-interactive mode for constructing "source maps" for local crates that you or your agents are developing. The tool builds an output markdown file intelligently, inserting slices of contextual rust code in a correct, syntax-aware order and nesting. Agents can interleave API skeletons, implementation spans, and general markdown commentary to explain code and architecture for the next agent in the loop (or the user, if you care enough).
For a dense techincal guide specifically for agent consumption:
ripdoc agents(general usage)ripdoc skelebuild agents(skelebuild specific)
There is no MCP server for this tool. Long live skills!
Skelebuild ("Hand-off" Mode)
skelebuild is a stateful workflow for constructing a "source map" markdown file that interleaves:
- Rendered API skeletons (and optionally implementation spans)
- Full raw source for specific files when needed
- Commentary/instructions between sections
Minimal workflow:
# Start fresh and choose an output file
# Add a few key items (prefer paths from `ripdoc list ... --search ... --search-spec path`)
# Add instructions/notes near a specific target
# Rebuild explicitly (most commands rebuild automatically)
The state is stored at ~/.local/state/ripdoc/skelebuild.json so you can incrementally refine the source map across runs.
Search Mode
Use the --search|-s flag with the print command to query specific items instead of printing an entire crate. The query returns public API and their ancestors for context.
# Show methods and fields matching "status" within the reqwest crate
By default the query matches the name, doc, and signature domains, case-insensitively.
OR Searches
Use the pipe character | to search for multiple terms with OR logic:
# Find items matching "init" OR "clone" OR "fetch" OR "remote" OR "config"
# Search for multiple method names
The OR pattern works across all search domains (names, docs, paths, signatures).
Add --direct-match-only|-d when you want container matches (modules, structs, traits) to stay collapsed and show only the exact hits.
Listing Mode
Use the list subcommand to print a concise catalog of crate items instead of rendering Rust code. Each line reports the item kind and its fully qualified path, e.g.:
Filter listing output with --search. The listing honours --private and feature flags. Each row includes the source file and line.
Below is an example from the pandoc crate showing how Ripdoc prints the same snippet in Markdown (default) and in the raw Rust skeleton (--format rs):
Markdown preview (default):
```rust
impl Pandoc {
```
Get a new Pandoc object This function returns a builder object to configure the Pandoc execution.
```rust
pub fn new() -> Pandoc {}
```
Add a path hint to search for the LaTeX executable.
The supplied path is searched first for the latex executable, then the environment variable `PATH`, then some hard-coded location hints.
```rust
pub fn add_latex_path_hint<T: AsRef<Path> + ?Sized>(&mut self, path: &T) -> &mut Pandoc {}
```
Add a path hint to search for the Pandoc executable.
The supplied path is searched first for the Pandoc executable, then the environment variable `PATH`, then some hard-coded location hints.
```rust
pub fn add_pandoc_path_hint<T: AsRef<Path> + ?Sized>(&mut self, path: &T) -> &mut Pandoc {}
// Set or overwrite the document-class.
pub fn set_doc_class(&mut self, class: DocumentClass) -> &mut Pandoc {}
```
Rust preview (--format rs):
Ripdoc prints Markdown by default as it is more token efficient. The output is immediately usable for feeding to LLMs.
Print READMEs
In addition to printing crate API, Ripdoc can also fetch and print the README file for a crate.
Other Features
- Character highlighting for query hits
- Print raw JSON data for usage with
jqor similar - Cache rustdoc JSON on disk automatically (override location via
RIPDOC_CACHE_DIR)
Requirements
Ripdoc requires the Rust nightly toolchain for its operation:
- Nightly toolchain: Required for unstable rustdoc features used to generate JSON documentation
Install the nightly toolchain:
Usage
Basic usage:
# Prints the entire public API of the target crate
See the help output for all options:
Ripdoc has a flexible target specification that tries to do the right thing in a wide set of circumstances.
# Current project
# If we're in a workspace and we have a crate mypackage
# A dependency of the current project, else we fetch from crates.io
# A sub-path within a crate
# Path to a crate
# A module within that crate
# A crate from crates.io with a specific version
# Search for "status" across names, signatures and doc comments
# Search for "status" in only names and signatures
# Search for "status" in docs only
# List public API items
# Print Markdown output with stripped doc comment markers
Attribution
This crate is a forked and re-worked version of cortesi's ruskel. Much of its core code is still in use.
License
This project is licensed under the MIT License. See the LICENSE file for details.