AGENT SKILL

codegraph-cli

Use when exploring unfamiliar code, tracing call flows, or assessing blast radius before refactors. Triggers on "how does X work", "who calls this", impact analysis, or when grep/Read sweeps are burning tokens. Requires a per-project CodeGraph index.

License 许可
MIT
最近更新
2026-11-12
Stars
★ 1
Forks
0

01 前言 Front Matter

name
codegraph-cli
description
Use when exploring unfamiliar code, tracing call flows, or assessing blast radius before refactors. Triggers on "how does X work", "who calls this", impact analysis, or when grep/Read sweeps are burning tokens. Requires a per-project CodeGraph index.

03 SKILL.md 正文

codegraph-cli

CodeGraph is a local semantic code-intelligence layer (symbol graph, callers/callees, impact). It exposes an MCP server to Claude Code, Cursor, Codex, OpenCode, and other agents. It complements Slopgate (edit-time guardrails) and overlaps partially with GitNexus — prefer CodeGraph MCP tools on the repo you are editing when .codegraph/ exists; use GitNexus when that index is already maintained for the workspace (see repo gitnexus-* skills).

Upstream: https://github.com/colbymchenry/codegraph · Docs: https://colbymchenry.github.io/codegraph/

Install

# macOS / Linux (bundled runtime, no Node required)
curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh

# Windows (PowerShell)
irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 | iex

# Or npm (any OS with Node)
npm i -g @colbymchenry/codegraph

Open a new terminal so codegraph is on PATH, then wire agents:

codegraph install                    # interactive; detects installed harnesses
codegraph install --yes              # non-interactive auto-detect
codegraph install --target=cursor,claude,codex,opencode --yes

Restart each harness after install. Remove from agents only: codegraph uninstall (project indexes under .codegraph/ stay until codegraph uninit).

The bundle does not write MCP config files — codegraph install does (or merge bundle/shared/mcp/codegraph.mcp.json manually).

Per-project setup

cd your-repo
codegraph init -i          # create .codegraph/ and build index
# later:
codegraph sync             # incremental update
codegraph status           # health / pending sync

Re-index from scratch: codegraph index --force.

MCP tools (prefer over grep archaeology)

Tool When
codegraph_explore Default — "how does X work", flows, survey an area (verbatim source + relationship map)
codegraph_search Find symbols by name
codegraph_callers / codegraph_callees Call graph direction
codegraph_impact Blast radius before changing a symbol
codegraph_node One symbol's details + source
codegraph_files Indexed file tree (faster than blind glob)
codegraph_status Stale/pending files, index stats

If a response shows a pending sync banner for a file you just edited, Read that file for live content, then continue.

CLI (without MCP)

codegraph query "UserService"
codegraph callers 'MyClass.method'
codegraph callees 'MyClass.method'
codegraph impact 'MyClass.method'
git diff --name-only | codegraph affected --stdin --quiet   # tests to run

Slopgate + CodeGraph + RTK

Layer Role
Slopgate Hook/lint enforcement (slopgate install, slopgate lint check)
CodeGraph Structural exploration via MCP (codegraph install + codegraph init -i)
RTK Compact shell output (rtk init; see rtk-cli skill)

Install order is flexible; restart harnesses after each MCP/hook installer. Slopgate hook wiring stays slopgate install … only.

Staleness

The MCP server watches source files (debounced). codegraph_status reports pending files. Edits made while the server was offline are reconciled on the next MCP connection.

When not to use

  • Repo has no index and you cannot run codegraph init -i (use sgt search / GitNexus / targeted rtk rg instead).
  • You need full file text for a file still pending sync — read it directly.
  • Replacing Slopgate quality gates — CodeGraph does not lint or block bad edits.

04 同仓库更多 Skills

vasceannie
vasceannie/slopgate

type-strictness

Enforce strict type compliance by eliminating `Any` types and `# type: ignore` comments. Use when: (1) Editing code that contains `Any` as a type annotation (2) Code has `# type: ignore` or `# pyright: ignore` comments (3) User requests type fixes or type strictness enforcement (4) Importing from untyped third-party libraries (5) User asks to "fix types", "remove Any", or "add proper typing" (6) Pyrefly or mypy reports type errors that need resolution (7) Code review reveals weak typing patterns Follows hierarchical resolution: codebase inference → type stubs → library inspection → type guards → casting (last resort).

代码审查
★ 1
vasceannie
vasceannie/slopgate

slopgate-test-extender

Extend Python test suites with parametrization, fixture reuse, and quality enforcement. Use when asked to add tests, extend existing tests, improve test coverage, consolidate duplicate tests, fix test quality issues, or when Slopgate reports untested-production-code, missing test references, or coverage gaps. Triggers on requests like "add tests for X", "extend these tests", "parametrize tests", "consolidate tests", "fix test quality", "improve test coverage", "write tests for this function", "test this module", "behavior tests", "integration tests", "missing tests", "coverage holes", "untested code", or when a hook denies with test-related findings.

代码审查测试与质量
★ 1
vasceannie
vasceannie/slopgate

slopgate-intelligent-coding-patterns

Pattern-selection playbook for agents editing code with complex branching, stateful parsers/workflows, duplicated skeletons, policy checks, or ordered transforms. Load before refactoring if/elif dispatch chains, boolean-flag state machines, repeated validation predicates, parallel provider/language implementations, or regex/content transformation pipelines. Also load when asked to "apply a design pattern", "which pattern should I use here", "refactor this switch statement", "replace if-elif chain", "state machine pattern", "strategy pattern", "template method", "pipeline pattern", "specification pattern", "dispatch table", "guard clause refactor", "reduce cyclomatic complexity", or when Slopgate fires PY-CODE-014, PY-CODE-017, PY-CODE-018, QUALITY-LINT-001, or PY-QUALITY-010. Use with behavior-locking tests and avoid pattern theater for simple one-off code.

开发工程师设计师代码审查视觉设计
★ 1
vasceannie
vasceannie/slopgate

slopgate-hygiene-orchestrator

Orchestrate systematic elimination of linter warnings and errors across Python, TypeScript, and Rust codebases. Use when asked to "clean up lints", "fix all warnings", "run hygiene", "eliminate type errors", "orchestrate code quality fixes", "fix lint errors", "resolve quality gate failures", "pass CI checks", "reduce tech debt", "refactor to pass hooks", or when a Slopgate hook denies with QUALITY-LINT-001, PY-CODE-017, PY-CODE-018, or any collector finding. This skill coordinates multiple code-hygiene-enforcer agents working in parallel on non-conflicting file groupings, tracks progress persistently via JSON exports, and loops until all issues are resolved. CRITICAL: Never run linters directly—always use `slopgate lint check` as the primary gate, discover project-specific tools from config files, and export findings to JSON for tracking.

代码审查Skill与智能体开发
★ 1
vasceannie
vasceannie/slopgate

slopgate-code-smell-utility-locator

Autoactivate when code-smell hooks or reviews mention feature envy, thin wrappers, duplicate helpers, duplicate code, scattered helpers, builders/factories/config/constants/dataclass reuse, PY-CODE-012, PY-CODE-013, QUALITY-LINT-001, or repeated slopgate code-quality denials. Also load when asked to "find existing helpers", "consolidate utilities", "search for duplicate code", "where is this already implemented", "reuse existing logic", "don't duplicate this", "find similar functions", "utility inventory", "code smell radar", or before adding new helpers/wrappers so agents can find existing shared utilities and consolidate instead of duplicating.

开发工程师代码审查
★ 1
vasceannie
vasceannie/slopgate

slopgate-code-hygiene-refactor

Recovery playbook for Slopgate and project quality failures. Load after hook/lint denials such as PY-CODE-017 flat sibling modules, PY-CODE-018 oversized modules, QUALITY-LINT-001 post-edit quality backstops, PY-QUALITY-010 magic numbers / repeated literals, PY-CODE-012/PY-CODE-013 smell findings, type-suppression bans, duplicate helpers, or repeated hygiene retry loops. Also load when asked to "refactor this module", "split this file", "extract a class", "reduce complexity", "fix god class", "flatten module hierarchy", "move code to a package", "extract helpers", "consolidate duplicates", "replace magic numbers with constants", or when a hook blocks an edit with structural complaints. Focuses on preserving public APIs while refactoring toward packages, cohesive modules, typed seams, and focused tests.

开发工程师代码审查
★ 1