xerj-code
O que ela faz
Encontra implementações de referência que funcionam em códigos de código aberto, as indexa localmente e recupera o trecho exato antes que um novo código seja escrito. Ela é para desenvolvedores que trabalham com uma biblioteca desconhecida ou que estão portando um algoritmo.
Quando usar
- ✓Quando você começa uma tarefa em uma API que não conhece bem.
- ✓Quando você está portando um algoritmo e precisa da versão de referência.
- ✓Quando já tentou a mesma correção duas vezes e ela continua falhando.
Link da skill
https://github.com/xerj-org/xerj/blob/main/tools/xerj-code/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Continuo recebendo erros ao usar a função seal desta biblioteca. Encontre uma implementação de referência que funcione e use exatamente a mesma abordagem.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A skill clona os repositórios que já contêm uma implementação correta, os indexa e recupera o trecho que a tarefa precisa. Ler a referência usa tokens de entrada, em vez de tentativas repetidas de escrever o código.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do 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 |
Perguntas frequentes
Isso é sempre mais barato?
Não. O estudo de caso observa as condições em que a abordagem perde, então o benefício é real, mas restrito.
Com o que ela é comparada?
Ela é medida contra o mesmo agente de programação com suas próprias ferramentas de busca, e não contra um modelo puro.
Ela escreve o código para mim?
O agente escreve o código, mas baseia a implementação no trecho de referência recuperado.
Detalhes
Descrição original do autor
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
Popularidade
- Estrelas no GitHub
- 19 mil
- Posição no ranking
- #10506
- Licença
- Apache-2.0
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
xerj-security-audit
19 milAjuda seu agente a executar uma auditoria de segurança de caixa branca em uma base de código, encontrando todas as chamadas arriscadas e registrando evidências de que a revisão as cobriu.
xerj
19 milAjuda seu agente a encontrar a documentação e os contratos atuais do XERJ antes de indexar pastas, pesquisar dados ou configurar a memória do agente.
xerj-knowledge
19 milAjuda seu agente a pesquisar seus próprios documentos locais, notas, PDFs, planilhas e e-mails, citando o arquivo e a página de onde veio cada resposta.
Skills parecidas
diffs
394 milPermite que seu agente gere um diff real e compartilhável das edições, como link de visualização ou arquivo de imagem, em vez de um resumo escrito à mão.
coding-agent
394 milAjuda seu agente a passar um trabalho grande de programação para o Codex, Claude Code ou OpenCode em segundo plano e acompanhar o andamento.
gh-issues
394 milAjuda seu agente a encontrar issues do GitHub, escolher quais resolver e abrir pull requests com correções, acompanhando os comentários de revisão.