MCPInstall

codegraph-ast-grep

Set up, update, or diagnose CodeGraph and ast-grep so coding agents can use semantic repository scope and structural syntax evidence automatically. Use when a repository needs an idempotent CodeGraph/ast-grep installation, stable tool and index migrations, MCP reconnection, persisted agent guidance, or a read-only setup diagnosis.

Installs
2.7K
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/stark-ai-de/agent-skills --skill codegraph-ast-grep
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads codegraph-ast-grep automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

CodeGraph + ast-grep

Goal

Make a repository's coding agents ready to use CodeGraph for semantic scope and ast-grep CLI for structural evidence. Public workflows manage that capability; repository exploration and refactoring are ordinary internal coding behaviors after setup.

When to use

  • Install or reconcile CodeGraph, ast-grep CLI, MCP exposure, indexing, and agent guidance.
  • Update the installed analysis stack and run required configuration, index, or schema migrations.
  • Diagnose a missing, stale, disconnected, or apparently broken setup without repairing it.

When not to use

Do not activate this skill merely because a coding task can benefit from an already-ready analysis stack. Follow the persisted repository guidance instead. Do not use it for general dependency audits, compiler/runtime proof, or an unreviewed broad rewrite.

Workflow selection

The complete finite workflow inventory, in plain, benefit-first language, is:

  • setup: supercharge the repository with Semantic Code Intelligence and structural code search, helping coding agents answer faster with fewer tool calls. Install missing pieces, connect the coding client, build the code index, add repository guidance, and safely reuse or repair any existing setup.
  • update: bring an existing setup to current stable versions without changing how it was installed. Migrate configuration or index data when needed, reconnect the coding client, and verify that everything still works.
  • doctor: diagnose setup health and report analytics without repairing anything.

Show the complete finite workflow inventory in its documented order for a bare or materially ambiguous invocation, or an explicit options request. An options request alone does not authorize execution or repository/tool inspection; answer from the documented inventory. For clear authorized intent, announce only the selected workflow and rationale, with material scope and evidence fields, and proceed.

There is no auto workflow. Select by intent:

  • An explicit setup or installation request selects setup.
  • An explicit stable-tool update, migration, or refresh request selects update.
  • “Something is broken,” a health check, or a request for setup analytics selects doctor.
  • A bare invocation or ambiguous intent requires showing all three workflows and asking the user to choose.

For clear direct intent, state only the selected workflow, rationale, root, expected writes/artifacts, and protected state, then proceed. Agent-initiated activation may select and announce only doctor; it must not infer setup or update authority. Selecting setup or update is allowed only when the user already requested that outcome for the stated root. Privileged/global installation, paid or external services, publication/deployment, destructive replacement, telemetry changes, and scope expansion retain separate approval.

Inputs to inspect

  • Exact repository root, nested repositories or monorepo packages, package/declarative policy, and protected Git state.
  • Effective CODEGRAPH_DIR (default .codegraph/), root codegraph.json when supported, sgconfig.yml/sgconfig.yaml, and repository instruction files.
  • Executable paths, installer channel and scope, version pins, installed help, configured client, and exposed MCP tools.
  • Approved scope for package/config/index writes and any exact-root project opening that may migrate generated metadata.

Workflow

setup

  1. Capture the exact root, protected state, runtime client, package/declarative policy, existing installer provenance, and offline/telemetry constraints.
  2. Inspect existing binaries, configuration, MCP exposure, state paths, and repository guidance before changing anything. Installed help and exposed tools are authoritative.
  3. Reconcile the stable CodeGraph release and stable ast-grep CLI through the repository's approved installer channel and scope. Do not install the experimental ast-grep MCP server during normal setup.
  4. Configure the selected runtime client and CodeGraph project root, then perform the help-confirmed initialization and any required configuration/index/schema migration within the approved root.
  5. Persist concise repository-native guidance for coding agents. It must say, in equivalent terms: use CodeGraph for semantic symbols, callers, call paths, and impact; use ast-grep CLI for structural syntax evidence; reconcile both before broad edits.
  6. Reconnect or restart the client when required, then verify one semantic query, one bounded structural query, state freshness, and guidance discovery.
  7. Report installed versions/provenance, writes, migration/reconnection evidence, readiness, and remaining limitations.

Setup is idempotent and agent-complete: rerunning it reconciles drift instead of duplicating config, instructions, indexes, or dependencies.

update

  1. Capture the same root, policy, protected-state, telemetry, and provenance evidence as setup.
  2. Compare installed core tools with their authoritative stable channels once. Respect offline intent, DO_NOT_TRACK, CODEGRAPH_NO_UPDATE_CHECK, registry restrictions, and repository pins.
  3. Preserve the existing installer channel and global/project/declarative scope. Update only the stable CodeGraph and ast-grep CLI components selected by repository policy; never run a blanket update-all operation.
  4. Run every version-required configuration, index, or schema migration in the approved root. Keep binary replacement, runtime-config changes, prompt hooks, telemetry, and graph operations visible in the execution receipt.
  5. Reconnect/restart the client, refresh the graph only as required, and verify versions/PATH, MCP exposure, graph readiness, a semantic query, a structural query, and persisted guidance.
  6. If an update fails, stop further mutation, preserve config/index state, report what still works, and use only a pre-disclosed safe rollback.

The user's explicit update request authorizes ordinary in-root update and required migration work. Ask separately for privilege escalation, installer-channel or scope changes, unrelated dependency changes, destructive rebuilds, or external-service actions.

doctor

  1. Inspect executable/provenance, versions/help, config presence, MCP registration, state paths, ignore policy, repository guidance, and non-opening connectivity evidence.
  2. Do not install, update, reconnect by writing config, initialize/rebuild/sync, repair, or rewrite source.
  3. Before codegraph status, an MCP graph query, or another diagnostic that opens a project and may migrate generated metadata, name the exact root and obtain affirmative approval, or use an approved disposable copy. Without that approval, report the skipped deep check.
  4. When approved, gather bounded graph health and useful analytics such as freshness, indexed languages, symbol/file coverage, and query readiness. Do not describe this as strictly read-only if metadata migration was possible.
  5. Return diagnosis, evidence, confidence, recommended setup or update follow-up, and any unverified boundary. Do not repair as part of doctor.

Internal coding behaviors

Once the setup is ready, coding agents use these behaviors without treating them as public skill modes:

Routine semantic exploration, structural search, impact analysis, rule authoring, and reviewed rewrites are internal coding behaviors.

  • Semantic exploration: prefer exposed codegraph_explore, then installed-help-confirmed codegraph explore, then narrower verified CodeGraph capabilities.
  • Structural search: use ast-grep CLI after the syntax shape is known; specify language when ambiguous and bound paths/output.
  • Impact analysis: reconcile semantic ownership/call paths with structural match inventory and targeted source reads.
  • Rule authoring: use tested YAML rules for reusable or relational patterns, including positive and negative fixtures.
  • Reviewed rewrites: inventory, test, preview, approve exact bounded scope, apply, inspect the diff, and run repository-native validation.

When semantic and structural evidence disagree, check graph freshness/root, parser/language, generated or dynamic code, ignore rules, and targeted source before claiming coverage. Runtime-native LSP and bounded text/file inspection are fallbacks; neither core tool is compiler, type, taint, or runtime proof.

Safety rules

  • Keep ast-grep CLI as the supported default; the experimental ast-grep MCP server is excluded from normal setup.
  • Suppress CodeGraph telemetry for skill-driven checks and approved setup/update commands with CODEGRAPH_TELEMETRY=0 unless the user separately consented to telemetry. Default-on telemetry is not consent.
  • Prefer exact packages or checksummed release assets. Do not default to pipe-to-shell or pipe-to-PowerShell installation.
  • Preserve installer channel and scope; do not bypass package-manager freshness, trust, lifecycle-script, checksum, or declarative policy.
  • Do not invent .codegraph/config.json. Treat effective CODEGRAPH_DIR as generated state and root codegraph.json as version/capability dependent.
  • Do not assume auto-sync without an active supported watcher or require manual sync when status proves freshness.
  • Do not apply an untested ast-grep rewrite or indiscriminately accept snapshots/update-all behavior.
  • Redact secrets, static headers, customer data, private service names, and internal hostnames from persisted or public artifacts.

References

Read only what the selected workflow or later coding task needs:

  • references/setup-and-mcp-config.md for installation scopes, runtime configuration, state paths, and initialization.
  • references/update-and-provenance.md for stable channels, provenance-preserving updates, migrations, verification, and rollback.
  • references/troubleshooting.md for the read-only doctor ladder and follow-up routing.
  • references/codegraph-capability-guide.md for current/legacy capability discovery, graph freshness, and exact-root project opening.
  • references/usage-playbook.md for the persisted agent guidance and internal semantic/structural/impact behaviors.
  • references/ast-grep-rule-recipes.md for bounded CLI patterns, rules/tests, and reviewed rewrites.
  • references/extensions-and-escalation.md only when the core stack cannot safely express the task.

Scripts

No runtime scripts. Use installed tools and repository-native validation commands; the catalog's deterministic contract validator is maintainer-only and is not installed with the skill.

Output format

Report the selected workflow and rationale, exact root, protected state, installer provenance, versions/capabilities, writes or skipped writes, migrations/reconnect state, verification evidence, and remaining limitations. For doctor, separate non-opening evidence from exact-root deep analytics and provide diagnosis plus a recommended follow-up without repair.

Completion criteria

  • The selected setup, update, or doctor workflow and intent rationale are explicit.
  • Setup/update preserve provenance and protected state, and required migrations/reconnection are verified.
  • Target-repository guidance makes semantic plus structural evidence the default for broad coding work.
  • Doctor performs no repair and labels exact-root graph-opening approval and possible metadata mutation accurately.
  • Readiness is proven with verified capabilities and representative semantic/structural checks, or limitations are explicit.

Failure modes

  • If intent or root is ambiguous, expose all three workflows and ask before inspection or mutation.
  • If stable metadata is blocked, report not checked; do not bypass offline, opt-out, registry, or pinning policy.
  • If setup/update needs an unauthorized privilege, channel, scope, destructive rebuild, or external action, preserve current state and request that specific authority.
  • If a tool or client remains unavailable, retain verified intermediates/configuration, report incomplete readiness, and give the narrowest next action.
  • If evidence conflicts, report the disagreement and confidence rather than claiming complete semantic or structural coverage.

FAQ

What does the codegraph-ast-grep skill do?

Set up, update, or diagnose CodeGraph and ast-grep so coding agents can use semantic repository scope and structural syntax evidence automatically. Use when a repository needs an idempotent CodeGraph/ast-grep installation, stable tool and index migrations, MCP reconnection, persisted agent guidance, or a read-only setup diagnosis.

How do I install codegraph-ast-grep?

Run npx skills add https://github.com/stark-ai-de/agent-skills --skill codegraph-ast-grep in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/codegraph-ast-grep/ (personal) or .claude/skills/codegraph-ast-grep/ (project).

Which AI agents can use codegraph-ast-grep?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is codegraph-ast-grep safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains codegraph-ast-grep?

It is published by stark-ai-de in stark-ai-de/agent-skills. It has 2,692 recorded installs.

More from stark-ai-de/agent-skills

View all →

codex-memory-curator

stark-ai-de/agent-skills

Audit and safely curate Codex memory, including stale claims, cross-repo leakage, sensitive entries, and memory configuration. Use when reviewing or cleaning Codex memory, not generic repository docs.

AI & Agents2.7K installs

cursor-memory-curator

stark-ai-de/agent-skills

Audit and safely curate Cursor rules and provided memory-bank context. Use when reviewing stale, conflicting, sensitive, or misplaced Cursor instructions, not generic repository docs.

AI & Agents2.7K installs

drawio-diagrams

stark-ai-de/agent-skills

Create, edit, review, or export editable draw.io diagrams. Use when the user needs .drawio architecture, flow, sequence, network, or other technical diagrams; not data plots or artistic images.

animated-readme-logo

stark-ai-de/agent-skills

Create, transform, animate, or audit GitHub README logos and their verified SVG/PNG/GIF delivery. Use when a repository needs branding assets, not ordinary README prose or app/site motion.

Docs & Writing2.7K installs

architecture-compass

stark-ai-de/agent-skills

Set up ADR governance, audit architecture and drift, or plan and execute bounded refactors and code simplification. Use when work needs binding architecture decisions, library reuse, shared-code ownership, provider-to-local mapping, or architecture PR review.

jev-capability-advisor

stark-ai-de/agent-skills

Recommend available skills or MCP tools using TypeSafe Jev, or explicitly choose one next skill. Use when the user requests capability advice, candidate inspection, selection evaluation, or reusable host integration. Native client selection remains the default and fallback.

AI & Agents2.6K installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs