# Reference Code Retrieval

Clones libraries that solved a problem and retrieves exact implementations before coding.

- Repository: https://github.com/xerj-org/xerj (18655 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add xerj-org/xerj --skill xerj-code -g -a claude-code -y`
Codex: `npx skills add xerj-org/xerj --skill xerj-code -g -a codex -y`
Cursor: `npx skills add xerj-org/xerj --skill xerj-code -g -a cursor -y`
Gemini CLI: `npx skills add xerj-org/xerj --skill xerj-code -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add xerj-org/xerj`

## Description

Reference-coding with XERJ. Clone the libraries that already solved your problem, index them locally, and retrieve the exact implementation before writing code, so the agent reads passages instead of re-deriving algorithms across retry loops. Use when starting a task in an unfamiliar API, porting an algorithm, or when you have already looped twice on the same error.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# XERJ.code, reference coding

An agent that does not know an API guesses, runs, fails, and guesses again. Each
lap costs **output** tokens, which are the expensive kind. This skill replaces
laps with a lookup: clone the repositories that already contain a correct
implementation, index them with XERJ, and retrieve the passage before writing.

The trade is deliberate. Retrieval spends **input** tokens, which are cheaper per
token and cacheable; loops spend **output** tokens. See [`COSTS.md`](../../docs/case-studies/reference-coding/COSTS.md) for
the arithmetic and for the conditions under which this trade **loses**.

The rest: https://github.com/xerj-org/xerj/blob/HEAD/tools/xerj-code/SKILL.md
