Skip to content
Back to skills

Repo Knowledge

ASecurity

Bootstrap, update and lint a repo's knowledge graph (feature nodes in docs/features, a generated path index, glossary, ADRs, a drift lint in its CI).

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 13, 2026
ai-agentsnodegitapi

Works with

  • claude code
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add Gord1y/countersign-skills --skill repo-knowledge --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Repo Knowledge?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Repo Knowledge
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gord1y-repo-knowledge/badge)](https://www.skillsdirectory.com/skills/gord1y-repo-knowledge)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: repo-knowledge
description: Bootstrap, update and lint a repo's knowledge graph (feature nodes in docs/features, a generated path index, glossary, ADRs, a drift lint in its CI).
when_to_use: "Use after a change to paths the knowledge index maps, to refresh their nodes and run the lint, or when asked to set up or update a repo's knowledge graph."
---

# Repo knowledge

Agents miss facts that live only in people's heads: why a module is shaped this way, which table a
feature writes, what breaks when a field changes. This skill moves those facts into the repo as a
Markdown graph. Each feature is a node, a generated index maps code paths to nodes, and a lint that
the repo runs in its own CI fails when the graph drifts from the code. The graph works for a
developer who has never seen this skill set: nothing in it calls back into this folder.

## Repo facts

This skill needs the facts below. Look each one up in the repo's CLAUDE.md (or AGENTS.md) and
the files it imports or points to (of a repo-facts file, only this skill's section:
`sed -n '/^## repo-knowledge$/,/^## /p' <file>`), then in `local.md` next to this file. If neither has it, ask
the user once, then suggest the one line to add to CLAUDE.md so the next run finds it.

| Fact | Example |
| --- | --- |
| Source roots, the folders whose first-level subfolders are the areas | `src`, or `apps` and `packages` |
| The CI job that lints pull requests | the `lint` job in `.github/workflows/ci.yml` |
| The repo's local gate | `pnpm check`, which runs lint, typecheck and tests |
| How to run the app, and its standing test account | `pnpm dev` on port 3000; the QA account named in the repo's docs |

## The layout

```
docs/
  features/<name>.md          one node per feature, name in lowercase kebab-case
  knowledge/
    index.md                  generated by the lint, never edited
    GLOSSARY.md               the repo's terms
    source-roots.txt          optional: one source root per line, !<area> excludes an area
  adr/NNNN-<slug>.md          decision records
scripts/knowledge-lint.sh     the drift lint, copied from this skill's scripts/ folder
```

The index's Nodes table lists each node's size in bytes. Open a node over 4,000 bytes by its
headings first (`grep -n '^#' <node>`), then read only the sections that matter.

## A node

```
---
code:
  - src/invoices/**
skills: []
api:
  - POST /invoices
related:
  - billing
decisions:
  - docs/adr/0003-invoice-numbering.md
---

# Invoices

## What it is

One or two sentences. As of 3f2a9c1, 2026-11-12.

## Where it lives

The entry points and the files to read first, as paths. As of 3f2a9c1, 2026-11-12.

## Rules and traps

What a newcomer gets wrong, and why. As of 3f2a9c1, 2026-11-12.

## Feature map

- Reach: how to get to the feature in the running app (a route, a screen, a command).
- Drive: the steps and inputs that exercise it, and the account to use.
- Observe: what to see, which request fires, which row or log line proves it worked.
```

The five keys are all optional and each is `key: []` or `key:` followed by `  - value` lines.

- `code`: globs from the repo root. `**/` matches zero or more folders, `**` anything, `*` and `?`
  stay inside one folder, `{a,b}` lists alternatives (no nesting), a trailing `/` means the whole
  folder. No `./` or leading `/`, and none of `[`, `]`, `|` or a backtick.
- `related`: names of other nodes. `decisions`: an ADR as a path from the repo root, a path
  relative to `docs/features/`, or a bare slug under `docs/adr/` (`0001-numbering` for
  `docs/adr/0001-numbering.md`).
- `skills` (repo skills that cover the feature) and `api` (endpoints) are not checked, because a
  global skill is absent in CI.

Every node holds at least one claim ending `as of <short sha>, <date>`: the short sha from
`git rev-parse --short HEAD` and the date from `date +%F`, taken when the claim was checked, so
staleness is visible. Point to code, never copy it. `qa-tester` and a per-repo `verify-<app>`
skill drive QA from the feature map; a node with no running surface writes `none` under each of
its three lines.

## Glossary

`docs/knowledge/GLOSSARY.md` holds one section per term: `## Term`, a definition ending with the
stamp, and a last line `_Avoid_: bill, statement` listing synonyms nobody should use for it. Add a
term when two people used different words for one thing, or one word for two things.

## ADRs

Write a record in `docs/adr/NNNN-<slug>.md` only for a decision that is all three of: hard to
reverse, surprising without context, a real trade-off. Take the next 4-digit number from
`ls docs/adr`. Sections: Status, Context, Decision, Consequences. The user picks which decisions
get a record. A decision that fails one of the three belongs in the node's Rules and traps.

## Readers

Bootstrap and update read one area per reader, so the main context stays small. Each reader gets
this brief, with the area's absolute path filled in:

```
Read the area <absolute path> and report at most 30 lines: what the feature is; the files that
hold it, with line ranges; the rules and traps a newcomer would miss; how to reach and drive it
in the running app; the endpoints it exposes; the other areas it calls or is called by. Facts
only, each with a path and range. Never include secrets.
```

**Claude Code.** One `Agent` call per area, up to four in one message: `subagent_type:
"researcher"` when the `researcher` agent is installed and `"general-purpose"` otherwise,
`model: "haiku"`, `effort: "low"`, `run_in_background: false`.

**Under Codex** there is no `Agent` tool. Under T3 Code, dispatch each area as a `delegate_task`
child with `mode: "wait"`, `target: {providerInstanceId: "claudeAgent", model:
"claude-haiku-5-5", options: {effort: "low"}}`, the role `agents/researcher.md` and the same
brief, which starts by telling the child to begin with a fresh context. Without T3 Code, read one
area at a time yourself, holding only that area's report before the next.

## Bootstrap

Run it when `docs/features/` has no nodes. It adds a CI job, so it runs only when the user asks or
as a slice of an approved plan; an agent that finds no nodes mid-run proposes it as a `parked`
row in the run's decision log instead.

1. List the areas: the first-level folders under each source root, from `git ls-files`.
2. Read each area as in Readers.
3. Propose one plan: the nodes with their names, globs and related nodes, the glossary terms, the
   ADR candidates that pass all three tests, and a `source-roots.txt` when the roots are not
   `src`. In an interactive session, ask once, through the agent's question tool or in plain text,
   and wait. In a run, the approved plan slice is the answer.
4. Write the approved nodes, glossary and records, each claim stamped.
5. Copy the lint from the folder that holds this SKILL.md:
   `mkdir -p scripts && cp <this folder>/scripts/knowledge-lint.sh scripts/ && chmod +x scripts/knowledge-lint.sh`.
6. Run `scripts/knowledge-lint.sh --write`, then `scripts/knowledge-lint.sh` and fix every line it
   reports until it prints `ok`.
7. Add `sh scripts/knowledge-lint.sh` to the CI job that lints pull requests and to the local gate.
8. Add one line to the repo's CLAUDE.md and AGENTS.md: before changing code, read the nodes
   `docs/knowledge/index.md` maps to the paths you touch.
9. Commit twice: `docs(knowledge): map the features` for the nodes, glossary, records and the
   CLAUDE.md and AGENTS.md line, then `ci: run the knowledge lint` for the script and the gate
   and CI steps. Never push.

A release runs the script check: `cmp scripts/knowledge-lint.sh
<this folder>/scripts/knowledge-lint.sh`. When they differ, show the diff and offer to replace the
repo's copy; the user decides. In a run, put the diff in the closing summary instead.

## Update and lint

1. Run `scripts/knowledge-lint.sh` and fix what it reports.
2. Visit only the nodes with a `code` glob that matches a path in the changed path list, when one
   is given; with none, visit every node. For each node and each of its `code` globs, list what
   changed since the node's stamp:
   `git log --oneline <stamp sha>..HEAD -- ':(glob)<glob>'`. Git's glob does not read `{a,b}`;
   run one command per alternative. A sha that git does not know (`git cat-file -e <sha>` fails)
   marks the node stale.
3. Re-read each stale or uncovered area as in Readers. Refresh the claims that changed, add the
   nodes for new areas, retire the nodes for deleted ones, and restamp only what you checked.
4. Run `scripts/knowledge-lint.sh --write`, then `scripts/knowledge-lint.sh` until it prints
   `ok`. Make one commit, `docs(knowledge): refresh the nodes`.

## Rules

- The knowledge lives only in the repo. CI never calls into this skill's folder.
- Check a fact now before writing it. An unchecked claim does not get a stamp.
- Point to code with paths and ranges. Do not paste it.
- No secrets, tokens or personal data in a node, a term or a record.
- Commit locally. Never push.

If `local.md` exists next to this file, read it; where it disagrees with this file, it wins.

Files in this skill

  • SKILL.md8.6 KB
  • scripts/knowledge-lint.sh11.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.