xerj-code
하는 일
정확한 구현이 들어 있는 오픈소스 코드를 찾아 로컬에 색인하고, 새 코드를 쓰기 전에 정확한 구절을 가져옵니다. 낯선 라이브러리를 다루거나 알고리즘을 옮기는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓잘 모르는 API로 작업을 시작할 때.
- ✓알고리즘을 옮기면서 참조 버전이 필요할 때.
- ✓같은 수정을 두 번 시도했는데 계속 실패할 때.
스킬 링크
https://github.com/xerj-org/xerj/blob/main/tools/xerj-code/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 라이브러리의 seal 함수를 쓰면 계속 오류가 납니다. 제대로 동작하는 참조 구현을 찾아서 그 정확한 방식을 써 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 올바른 구현을 이미 가진 저장소를 복제하고, 색인한 뒤 작업에 필요한 구절을 가져옵니다. 참조를 읽는 데는 입력 토큰이 쓰이며, 코드를 여러 번 고쳐 쓰는 시도는 줄어듭니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
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 for
the arithmetic and for the conditions under which this trade loses.
Status, stated plainly: measured, and the value is real but narrow. (Full case study with real tokens and dollars:
docs/case-studies/reference-coding/CASE_STUDY.md, 2026-08-05.)The comparison that matters is against native Claude Code — the same agent with tools that would grep the source itself — not a bare model. Measured across three regimes, same agent, one objective verdict (compiles + passes hidden tests):
- Unfamiliar code with a contract the model can't recall (a seal, a generational handle, a lazy refill, a specific hash scheme — measured across seven purpose-built libraries, 21 runs): native and xerj both solve 21/21; xerj uses 1.5× fewer output tokens and costs 1.3× less than native, because retrieval replaces the grep. Pure memory fails 1/21 and burns 6.5× the cost flailing. This is the win, and it is decisive. The compiler can leak an API name across a retry loop, but never a contract.
- Memorised code (any popular public crate — even a 256-value table, or a protobuf-style varint): retrieval is overhead. Pure memory is cheapest; injecting a big reference can be the worst arm, because the model re-emits what it was handed.
So: use this when the reference is code the model has not memorised — your own private/proprietary code, an internal API, a post-cutoff or niche library. On public library references the model already knows, it costs more than it saves. The native-vs-xerj gap grows with corpus size (grep pulls the whole tree into context; retrieval pulls one passage).
Since #977 the whole loop is
inside the xerj binary — xerj corpus add / xerj corpus index /
xerj code — plus the xerj_code_search MCP tool for agents without a shell.
The old wrapper scripts (xc-corpus.sh, xc-index.sh, xc.py) are gone; your
existing ~/.xerj-code corpora and indexes work unchanged (see
Migration below).
Standing corpora for this repository (MANDATORY since 2026-08-06)
In the xerj repo, retrieval-before-writing is required for non-trivial
engine work, not optional. Each corpus below has a pinned, licence-reviewed
definition in hub/ — xerj corpus add --from hub/<name>.json rebuilds
it at the same commits anyone else is using:
| corpus | projects | use it for |
|---|---|---|
xerj-search |
lucene, tantivy, meilisearch, quickwit, sonic, elasticsearch | FTS, BM25, postings, merge policy, typo tolerance, segment layout, ES wire semantics |
xerj-vector |
qdrant, usearch, instant-distance, hnswlib | HNSW build, neighbour heuristics, quantisation, filtered kNN |
xerj-storage |
sled, fjall, redb | WAL, flush epochs, crash recovery, compaction, page allocation |
xerj-columnar |
clickhouse | columnar storage, aggregation execution, compression codecs, vectorised scans |
Approach-only sources: elasticsearch (AGPL-3.0 / SSPL-1.0 / Elastic-2.0)
and sonic (MPL-2.0). Never copy their code into Apache-2.0 XERJ; for ES,
pasting source would also falsify the project's public "shares no code with
Elasticsearch" claim. meilisearch is MIT at the core but BUSL-1.1 for its
Enterprise Edition parts — check the header/path first. Read the design,
write our own implementation. Each manifest's review.use field says which
bucket a repo is in; hub/README.md explains the three.
Hub corpus or local corpus
Two kinds of corpus sit on the same local node. Each answers a different kind of question:
| hub corpus | local corpus | |
|---|---|---|
| what it holds | public material at a pinned commit: a library's source, a standard, a regulation, an advisory feed | files only this machine has: the project y |
자주 묻는 질문
항상 비용이 적게 드나요?
아니요. 사례 연구는 이 방식이 불리한 조건도 밝히므로, 이점은 실제지만 범위가 좁습니다.
무엇과 비교했나요?
기본 모델이 아니라, 자체 검색 도구를 가진 같은 코딩 에이전트와 비교했습니다.
코드를 대신 써 주나요?
코드는 에이전트가 쓰지만, 검색된 참조 구절을 바탕으로 구현합니다.
상세 정보
작성자의 원본 설명
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.
repo: xerj-org/xerj
인기도
- GitHub 스타
- 19k
- 순위
- #10506
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
xerj-security-audit
19k에이전트가 코드베이스의 화이트박스 보안 감사를 수행하도록 돕습니다. 위험한 호출을 모두 찾고, 검토가 전부 덮었다는 증거를 기록합니다.
xerj
19k에이전트가 폴더를 색인하거나 데이터를 검색하거나 에이전트 메모리를 설정하기 전에 최신 XERJ 문서와 인터페이스 사양을 찾도록 돕습니다.
xerj-knowledge
19k에이전트가 내 로컬 문서, 메모, PDF, 스프레드시트, 메일에서 검색하고, 각 답이 나온 파일과 페이지를 인용하도록 돕습니다.