agentleFS
aishwaryajayanth1820-gitaishwaryajayanth1820-git/code_graph_agentic_observable_coding/.claude/skills/code-graph/SKILL.md

code-graph

Skill1 starsChanged 32 days agoApache-2.0View on GitHub

Read and record the project's code dependency graph with the `cg` CLI - C4 nodes, function contracts (CALLS edges), tasks, ADRs, the utility registry and EVAL verdicts. Use whenever you plan, implement or review code in a project that has a code_graph/ folder, before writing any helper/utility, before adding or changing a function another class calls, and whenever a cg command exits with code 3.

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before writing a helper: cg util find <keywords>.

    line 22
  2. Distinctive:

    Every command, with examples: reference/cli.md

    line 36

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Code graph

The graph is the project ledger: C4 nodes (COMPONENT → SERVICE_CLASS → CLASS / INTERFACE / UTILITY_CLASS / CONFIG_CLASS), the function contracts between them, who is working on what, the ADRs behind changes, and review verdicts. Humans watch it live in the UI. Your job is to keep it true.

Run it

From the project root: python code_graph/cg.py <command> ... (prints JSON). Shell state does not persist between tool calls, so pass identity on every mutating command: --actor <your agent name> --task <task id> (add --adr <id> when an ADR authorises the change).

Exit codes

  • 0 ok · 2 bad input or not found: fix the command and retry.
  • 3 POLICY_VIOLATION: stop. Do not work around it. Follow details.next_step (usually: propose an ADR), then escalate to the orchestrator with the ADR id and details.impacted.

Coder loop

  1. cg task get <T> → cg task start <T> --actor <me>
  2. For each node in the task: cg node get <id> --brief (intent, extensibility, contract, calls in/out).
  3. Before writing a helper: cg util find <keywords>. Reuse any match. A new shared helper: cg util add.
  4. For every call you implement between classes: cg edge add CALLS <from> <to> --fn <name> --sig "<exact signature>" --purpose "<why>". For an existing contract, reuse its signature exactly. For a class realising an interface: cg edge add IMPLEMENTS <class> <interface>. For every shared type you import from another node without calling it (domain models, config classes): cg edge add USES <me> <type node>, so its blast radius is visible.
  5. cg node update <id> --path <file>::<Class> --loc <n> --complexity <1-10> --complexity-note "<why>", then cg node status <id> COMPLETED. Once its unit tests pass: TESTED.
  6. cg task done <T> --summary "<what changed>"

Reviewer loop

cg node get <id> · cg check · cg impact <id> → cg eval record <EVAL> --node <id> --verdict PASS|FAIL|WAIVED --notes "<evidence and fix>" --actor <me>

Never

  • Change a node outside your task, a signature another class depends on, or the design after lock, without an ACCEPTED ADR. The tool enforces this and exits with code 3.
  • Set a node to EVALUATED (orchestrator only; the tool blocks it while any EVAL is failing).
  • Edit code_graph.db directly.

More

  • Every command, with examples: reference/cli.md
  • Node fields, lifecycle, edge rules, governance policies, checks and metrics: reference/data-model.md
  • Seed JSON for bulk design import (orchestrator): reference/seed-format.md
  • UI for humans: cg serve --port 8770 → http://127.0.0.1:8770/ui/ (deep link #node=<id>)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.