Skip to content

docs: add community usage skill (codegraph-usage) — #1097#1117

Open
Badi21 wants to merge 2 commits into
colbymchenry:mainfrom
Badi21:skill/codegraph-usage
Open

docs: add community usage skill (codegraph-usage) — #1097#1117
Badi21 wants to merge 2 commits into
colbymchenry:mainfrom
Badi21:skill/codegraph-usage

Conversation

@Badi21

@Badi21 Badi21 commented Jul 1, 2026

Copy link
Copy Markdown

Summary

Adds skills/codegraph-usage/SKILL.md — the community field guide proposed in #1097: an agent-agnostic skill collecting real-world usage patterns, gotchas, and workarounds so agents (and humans) use CodeGraph well.

Covers:

  • When to reach for CodeGraph and when NOT to — structural search only, not semantic/conceptual; skip it for trivial single-file edits; correctness stays with compiler/tests (the "what it is NOT for" documentation the issue asks for).
  • Tool selection tableexplore / node / query / callers / callees / impact / affected / files, including the most common mixup: impact (transitive blast radius) vs callers (one hop).
  • Community-reported gotchas — over-calling explore on small tasks (Frequent codegraph_explore calls in v1.16 make Codex slow for small tasks #1080, Codegraph consume more tokens than just talk to claudecode. #975), per-file vs global staleness banner semantics, overloaded symbol disambiguation, projectPath in monorepos, CLI-without-MCP for containers/subagents (add CLI skills #676), index freshness when scripting (sync vs index).
  • A "Contributing" section so users can PR their own edge cases into the skill — the collect-user-experience loop the proposal describes.

Content is grounded in src/mcp/server-instructions.ts and site/src/content/docs/reference/cli.md — no invented commands or behavior.

Complements (doesn't overlap) #1019, which wraps the CLI surface itself; this one is usage guidance for the toolset.

Closes #1097

Testing

  • Every command and flag named in the skill checked against the current CLI reference and MCP tool definitions.
  • Front-matter follows the existing .claude/skills/*/SKILL.md format.

Field guide collecting community-reported usage patterns: tool selection
(impact vs callers), what CodeGraph is not for, staleness banner semantics,
monorepo projectPath, CLI-in-container workflow, and over-calling guidance.

Addresses colbymchenry#1097
Comment thread skills/codegraph-usage/SKILL.md Outdated
description: Community field guide for working with CodeGraph effectively — when to reach for it, which tool answers which question, known gotchas and workarounds, and what CodeGraph is NOT for. Use when working in a repo that has a .codegraph/ index, or when CodeGraph tool calls return confusing or incomplete results.
---

# CodeGraph usage — community field guide

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think agent should not know about community, I would remove all mentions

Comment thread skills/codegraph-usage/SKILL.md Outdated
@@ -0,0 +1,120 @@
---
name: codegraph-usage
description: Community field guide for working with CodeGraph effectively — when to reach for it, which tool answers which question, known gotchas and workarounds, and what CodeGraph is NOT for. Use when working in a repo that has a .codegraph/ index, or when CodeGraph tool calls return confusing or incomplete results.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make trigger work, agent should check for .codegraph existence. My experience is that agents go lazy especially for skill usage. Better - "Always use before any codegraph tool call. Also use when codegraph return confusing or incomplete results"

The best approach for modal monoliths with separate .codegraph dirs is explicitly tell in AGENTS.md what modules use codegraph and tell to use codegraph here for code exploration. This should be documented as skill usage for users.

My main idea - force reading the skill BEFORE tool call, when agent wants to use it. Skill contain prevent conditions that must be read by agent before it actually makes the call.

My AGENTS.md instruction btw: Before calling any codegraph tool, load and read the codegraph skill first. No exceptions.. It works

Comment thread skills/codegraph-usage/SKILL.md Outdated
grep + read loop with a single round-trip.

This skill collects usage patterns, gotchas, and workarounds reported by real
users. It complements (does not replace) the MCP server instructions.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think It complements (does not replace) the MCP server instructions. is enough

Comment thread skills/codegraph-usage/SKILL.md Outdated

The default MCP surface is `codegraph_explore` alone; the narrower tools below
are available via the CLI (`codegraph <command>`) and re-enablable over MCP
with `CODEGRAPH_MCP_TOOLS`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is MCP setting made by human. Agent see eithter only explore or other tools user configured. This is unnecessary info for agent

Comment thread skills/codegraph-usage/SKILL.md Outdated
| You want to know | Use | Not |
|---|---|---|
| Almost anything: how X works, where X is, survey an area | `explore` | grep + read loop |
| One symbol's source + direct callers | `node` | reading the whole file |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe "full source code?". Just to be more prescise. + should add that node is not replacement for read, maybe not here, as a separate statement

Comment thread skills/codegraph-usage/SKILL.md Outdated
before every minor edit). Rule of thumb: call when you have a genuine
structural question, not as a reflex before every change.

### Trust results — don't re-verify with grep

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think should focus on avoiding re-verifying results already provided by codegraph - reading the same but with grep. Why: this instruction looks like a strict rule to fully rely on codegraph's results. If there's a bug in codegraph that make result more poor (I faced, but already fixed), agent should fallback to grep for symbols codegraph didn't provide. + on large codebase blast radius is truncated with "+N more". Agent can trust what it see from codegraph but search for missing.

This is not critical, need to debate over this. Maybe I'm wrong

Comment thread skills/codegraph-usage/SKILL.md Outdated
Disambiguate by adding the file path or a neighboring symbol to the query
rather than picking the first result.

### Monorepos: pass projectPath

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed. Can be removed. Codegraph now force projectPath as required in schema if no .codegraph dir found. Works, confirmed: I use mcpjungle as mcp gateway, the place where server started obviously has no .codegraph dir, but agent always work as expected

Comment thread skills/codegraph-usage/SKILL.md Outdated
still work per project — pass `projectPath` pointing into any directory that
has an index. No restart needed after a new `codegraph init`.

### Containers & subagents: use the CLI, skip MCP

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does agent have knowledge about how it's subagents are run? Maybe that's separate skill for those who use same approach?

Comment thread skills/codegraph-usage/SKILL.md Outdated

### Index freshness outside agent sessions
The file watcher keeps the graph current (~1s lag) during normal sessions.
When scripting against the index (CI, hooks, containers), run

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't understand that, could you explain more detailed what conditions match sync problem?

Comment thread skills/codegraph-usage/SKILL.md Outdated
there for the rest of the session and use built-in tools. Indexing is the
user's call — suggest `codegraph init` if relevant, don't run it yourself.

## Contributing to this skill

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definetely not agent instruction. Instead, you can instruct agent to report tool misuse and offer to create issue. But I think this should be moved completely outside into user's reference for using the skill. This is context noise

- Reframe as an agent-facing playbook read before using CodeGraph; drop the
  community/contributing framing and meta.
- Remove the projectPath monorepo workaround (now enforced by the tool schema)
  and the container/subagent and offline-sync sections (user setup, not agent
  guidance).
- Note tool availability depends on MCP config; mark 'affected' as CLI-only.
- Clarify 'node' is not a substitute for 'read' on unindexed files.
- Soften 'trust results': don't re-verify what CodeGraph returned, but fall back
  to grep/read for a truncated blast radius or a symbol it didn't cover.
@Badi21

Badi21 commented Jul 2, 2026

Copy link
Copy Markdown
Author

Thanks for the detailed review. I pushed a rework that leans into the "agent-facing, read before use" framing you're pointing at. What I took directly:

  • Dropped the community and Contributing sections (L6, L114). You're right they're noise for the agent; that kind of "how to contribute / AGENTS.md setup" guidance fits a README, not the skill.
  • Removed the projectPath monorepo section (L89). Thanks for confirming the schema enforces it now.
  • Removed the container/subagent CLI section and the offline-sync section (L94). Agreed, those are user setup rather than per-call guidance.
  • Reworked the tool table: it now says availability depends on MCP config (default is explore only), and marks affected as CLI-only (L54). It's a real command, just a CLI subcommand rather than an MCP tool, so grouping it with the MCP tools was wrong.
  • Added that node isn't a substitute for read on unindexed files (L50).
  • Softened the "trust results" section per L72, which I think was your most important point: don't re-verify what CodeGraph already returned, but do fall back to grep/read when the blast radius is truncated (+N more) or a symbol is missing. A blanket "always rely on it" is wrong when the output is incomplete.

Two I want to check before hard-coding:

  • Trigger (L3). I strengthened the description toward "read before using CodeGraph tools" but stopped short of "before every call, no exceptions." The absolute version fights the "don't over-call on small tasks" guidance in the same skill, and the maintainer's own server-instructions approach. Your AGENTS.md line clearly works for your setup. Is baking that hard rule into the skill the direction you want here @colbymchenry, or keep it as "read before use" and let operators add the stricter AGENTS.md rule themselves?
  • Sync banner (L105). The condition is CodeGraph prepending "⚠️ Some files … edited since the last index sync" (per file) versus "auto-sync is DISABLED" (whole index frozen). Happy to reword if that's still unclear.

@colbymchenry, the trigger question is the one design call that shapes the rest, so I'd value your read on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Community skill

2 participants