Przejdź do treści
Biblioteka skilli
Programowanie · Analiza

index-code

/index-code

Buduje indeks kodu i najpierw przeszukuje go, by szybko znaleźć miejsca użycia, wywołania i zależności w repozytorium.

Repozytorium
Orbit-skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
09.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 09.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Buduje indeks kodu i najpierw przeszukuje go, by szybko znaleźć miejsca użycia, wywołania i zależności w repozytorium.

Oryginalny opis (EN)

[Orbit 1.2.2 Code recon] Working code index: index first, then targeted reading — fewer tokens and calls. Use when: «где это в коде», «кто вызывает», «найди все места», «где используется», «проиндексируй код»; where is, callers, find usages.

Jak działa

  1. When to use
  2. Inputs
  3. Procedure
  4. Output
  5. Check
  6. Pitfalls
  7. Portability
  8. What's improved vs the source
  9. Based on
Sekcje z nagłówków SKILL.md, w oryginale · 164 linii, 1 264 słów
Podgląd SKILL.md
---
name: index-code
description: '[Orbit 1.2.2 Code recon] Working code index: index first, then targeted reading — fewer tokens and calls. Use when: «где это в коде», «кто вызывает», «найди все места», «где используется», «проиндексируй код»; where is, callers, find usages.'
---

# index-code — index first, then read

> **Orbit · ① Understand · step 1.2.2 Code recon**
> **Input:** repository
> **Output:** `.orbit/knowledge/index/` → next `explain-code`
> **Works with:** `map-knowledge`, `trace-impact`, `explain-code`
> **Shared rules:** reply in the user's language per `speak-plain`; generated content defaults to English; act within `stay-in-scope`; artifacts go to `.orbit/` (contract: `ARTIFACTS.md`).

Method of Graft / Trail-code: ask a **code index** before reading sources — fewer tool calls
and tokens. Rewritten for built-in tools. If the `trail`/`graft` CLI is installed
(`npm i -g @trailhq/trail-code`), use it: `graft ask`, `graft grep`, `graft skeleton`,
`graft callers` do the same faster. Without it, the index is built from `grep` and short notes, as below.

## When to use

- Any question shaped as "where is X", "who calls Y", "every place Z is used".
- Before opening files in a repository you have not indexed yet — the first full-file
  read is what the index exists to avoid.
- A change is about to touch a symbol and you need its consumers before editing.
- An answer from a previous search was weak and the temptation is to search again in
  other words.
- After a significant change, to keep the index and its wiring current.

Skip for a repository of a few files, or when you already have the exact `file:line` —
read that range and answer.

## Inputs

- The repository and its file list: `git ls-files | head -200`, `wc -l <(git ls-files)`.
- The question in the user's words and the short symbol name behind it.
- An existing graph, if `map-knowledge` ran: `.orbit/knowledge/graph.json` — reuse its
  nodes instead of re-deriving them.
- Any previous index: `ls .orbit/knowledge/index/` (skeleton, nodes, wiring).
- The build/test entry points for context: `package.json`, `go.mod`, `pyproject.toml`,
  `Makefile`.

If no index exists, build the three parts below before answering; if only a graph
exists, skip the node inventory and generate skeleton and wiring from it.

## Procedure

1. **Take the question and reduce it to one symbol or one path.** "Where is the CSV
   export?" → `exportCsv` or `src/export/`. If the question contains several questions,
   answer them one at a time with the matching move.
2. **Build the file skeleton — signatures without bodies.** One command, saved to
   `.orbit/knowledge/index/skeleton.txt`:

   ```bash
   grep -rnE '^\s*(export\s+)?(async\s+)?(function|class|def|func|interface|type|public|private|internal)\b' src/ > .orbit/knowledge/index/skeleton.txt
   ```

   For a large codebase, run it per area (`src/api`, `src/domain`).
3. **Write node notes, one file per area.** `.orbit/knowledge/index/nodes/<area>.md`:
   3–8 lines of prose — "what's here and why" — plus exact `file:line` ranges. One node
   note is enough to answer most "where" questions without opening the code.
4. **Map the wiring for key symbols.** For each symbol that matters in this task:
   `grep -rn '\b<SymbolName>\b' src/` → add a line to
   `.orbit/knowledge/index/wiring.md` in the form `A → B (file:line)`. Wiring is the
   caller graph; it is what makes "what breaks if Z changes" answerable.
5. **Pick exactly one move per question.** Do not chain searches "just in case":

   | Question | Move |
   |---|---|
   | "How does X work / where is X?" | find the node, read the listed lines (offset + limit) |
   | "Every place Y is used" | one `grep -rn` on the short name, not a full signature; empty → loosen the pattern |
   | "API of a file" | skeleton or `grep -n` on signatures in that file |
   | "What breaks if Z changes" | wiring: all callers of Z and their callers (2 levels) |

6. **Don't re-ask the same question in other words.** If the first move is weak, change
   the move (skeleton → grep → wiring), not the wording. A second paraphrase of the same
   search returns the same noise.
7. **Verify the index.** Every `file:line` in a node note resolves (`sed -n '<line>p' <file>`);
   every wiring line has both ends and the evidence path; the skeleton has no duplicate
   areas. Fix what does not resolve — a stale index is worse than none.
8. **Keep it fresh.** After a significant change, update the affected nodes and wiring in
   the same loop as `run-spec-loop`. The index is derived: commit it only by agreement
   (`stay-in-scope`), otherwise keep it in the `.orbit/` work folder.

## Output

`.orbit/knowledge/index/` — a working index with three parts:

```text
.orbit/knowledge/index/
  skeleton.txt          signatures with file:line, no bodies
  nodes/<area>.md       3–8 lines per area + exact ranges
  wiring.md             A → B (file:line) caller edges
```

Node note example:

```markdown
# nodes/export
The CSV export path: HTTP handler → query → stream. No PDF, no scheduled mail.
- handler: src/export/router.ts:20-60
- query: src/reports/query.ts:88-140
- stream helper: src/http/files.ts:42-75
```

Wiring example:

```text
router.get('/reports/orders.csv') → exportOrders (src/export/router.ts:31)
exportOrders → buildOrdersQuery (src/reports/query.ts:90)
exportOrders → sendFile (src/http/files.ts:44)
```

## Check

Before answering, or before calling an index refresh done:

```bash
ls .orbit/knowledge/index/skeleton.txt .orbit/knowledge/index/wiring.md
grep -c ':' .orbit/knowledge/index/skeleton.txt        # skeleton lines carry file:line
grep -c '→' .orbit/knowledge/index/wiring.md           # edges exist
for f in .orbit/knowledge/index/nodes/*.md; do grep -Hn ':[0-9]' "$f"; done
git status --short .orbit/                             # index is not staged by accident
```

Pass rule: for every question the index answers, the answer cites a `file:line` that
resolves; the skeleton and wiring files exist and are non-empty; each node note has at
least one range; no answer required a full-file read outside the listed ranges; the
index is refreshed after the last significant change. If a `file:line` is stale, fix the
index before using it.

## Pitfalls

- **Reading full files "to be sure".** That is the cost the index exists to avoid. Read
  the listed range; widen only when the range does not answer the question.
- **Indexing everything before answering.** A full index of a huge repo takes longer than
  the question. Index the area the question touches first.
- **A skeleton that silently skips a language.** The regex covers common `function/class/
  def/func` forms; if a language is missing, add its keyword before trusting the file.
- **Wiring without evidence.** `A → B` with no `file:line` is a guess; it will be wrong
  in exactly the case that matters (a dynamic call, a re-export).
- **Stale index after a rename.** A moved symbol leaves a dead `file:line` and wrong answers. Refresh after changes.
- **Re-searching the same question in new words.** The second search returns the same
  results and burns context. Change the move, not the phrasing.
- **Committing the index without agreement.** It is a derived work folder, not source;
  decide with the team before it enters the repository.

## Portability

No Claude-only feature: `grep`/`rg`, `sed`, `git` and a text editor suffice; `npm i -g
@trailhq/trail-code` is optional and only an accelerator. On any CLI, the same three
files can be built with `grep` and written by the agent's file tools. Without subagents,
build one area at a time inline. If `graft` is available, its `ask`/`grep`/`skeleton`/
`callers` output maps one-to-one onto the "one move per question" table. The index stays
under `.orbit/knowledge/index/` in every agent, so `explain-code` and `trace-impact`
read the same artifact regardless of who built it.

## What's improved vs the source

- "Index first" works without the npm CLI: index from `grep` plus short node notes; the CLI is used when present.
- A "question type → one move" table instead of chains of searches.
- Index refresh is part of the same loop as spec and map.
- Every node and wiring line must resolve to a `file:line`, with a verification step.
- The index is explicitly a derived work folder: commit only by agreement.

## Based on

- [Graft / Trail-code](https://github.com/trailhq/Graft) — method «graft» (MIT). Rewritten in our own words and improved — see "What's improved".

Wersje

W bazie nie ma innych skilli o nazwie index-code.

Migawka bazy z 13.11.2026 · wersja paczki db7f1c621533 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100code-search
    Przeszukuje zawartość plików za pomocą ripgrep (rg), by znaleźć wzorce kodu, definicje funkcji i miejsca użycia.
  • 100codeindex
    Przeszukuje repozytorium przez indeks codeindex: definicje symboli, wywołania, testy i ostatnie commity bez czytania całych plików.
  • 100trace-impact
    Ocenia, na co wpływa zmiana w kodzie: moduły, konsumentów, zewnętrzne kontrakty i poziom ryzyka.
  • 100github-code-search
    Przeszukuje globalny indeks kodu GitHub przez wbudowane narzędzia MCP, aby znaleźć rzeczywiste przykłady implementacji i kontekst z wielu repozytoriów.
  • 100recall-history
    Przypomina dawne prace z pamięci projektu, ADR-ów, gita i sesji, gdy trzeba sprawdzić, czy rozwiązanie już istnieje.
  • 85unity-skills-index
    Zbiera indeks modułów Unity Skills z oznaczeniem trybu SA, FA lub Mixed, żeby szybko wskazać właściwy moduł.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.