foundry: Skill for Claude Code

.claude/skills/ast-grep/SKILL.md

ast-grep is a skill for Claude Code from ai-supervisor-foundry/foundry. It costs 28 tokens per session (241 once invoked), scanned A, original, MIT.

A code-analysis and refactoring workflow that searches programs by their structure, such as functions or syntax patterns, instead of only matching text.

In plain words
What is it for?
Use it to locate structural patterns, detect recurring code problems, run rule files, and perform syntax-aware refactors.
Why use it?
It finds code patterns more precisely and can preview or apply targeted changes across a codebase.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is ai-supervisor-foundry/foundry's own configuration. It tells Claude Code how to work on foundry itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything foundry configures →

Reuse

Borrowing it

Nothing to install: this file belongs to ai-supervisor-foundry/foundry. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ai-supervisor-foundry/foundry/main/.claude/skills/ast-grep/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ai-supervisor-foundry/foundry

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ast-grep

README.md
[![agentmods](https://agentmods.dev/badge/skills/ai-supervisor-foundry/foundry/ast-grep/github.svg)](https://agentmods.dev/skills/ai-supervisor-foundry/foundry/ast-grep)
Your own site
<a href="https://agentmods.dev/skills/ai-supervisor-foundry/foundry/ast-grep"><img src="https://agentmods.dev/badge/skills/ai-supervisor-foundry/foundry/ast-grep/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ast-grep

Your own site · 80×15
<a href="https://agentmods.dev/skills/ai-supervisor-foundry/foundry/ast-grep"><img src="https://agentmods.dev/badge/skills/ai-supervisor-foundry/foundry/ast-grep.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 241 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00241
Opus 5.5 $0.00011 $0.00096
Sonnet 5.5 $0.00006 $0.00048
Haiku 4.5 $0.00003 $0.00024

Measured 1mo ago against content hash 437c68e5ca15, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ast-grep scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/ast-grep/SKILL.md · 36 lines

What it actually says

ast-grep Code Query & Refactor

This skill enables Cursor to use ast-grep to analyze, query, and refactor code using structural patterns.
Cursor can call ast-grep to search for nodes, detect anti-patterns, or apply auto-fixes using SG rules.


Capabilities

  • Search code structurally using AST patterns (pattern, regex, meta).
  • Run full ast-grep rulesets (.yaml rule files).
  • Preview matches with context.
  • Apply safe transformations using fix blocks.
  • Generate new SG rules automatically when helpful.

Cursor may use this skill when:

  • The user asks for codebase-wide search/refactor.
  • Structural patterns or syntax-aware searches are required.
  • A transformation should be validated using AST rather than regex.

Commands

Search using a pattern

Use when the user wants to find all occurrences of a code pattern.

ast-grep -p "<pattern>" <path>
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 36 lines · 28 tokens per session scan A 437c68e5ca15

Subscribe to this mod's changes

ast-grep is a skill published in the GitHub repository ai-supervisor-foundry/foundry (12 stars, last pushed 3mo ago), licensed MIT. It adds 28 tokens to every session and 241 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-02.

Related

Other skills, from other repositories

triage-issues

Triage GitHub issues in the googleapis/mcp-toolbox repo: propose the correct labels (type / priority / product / status), check for duplicates, verify a bug has enough info to act on, and draft a triage comment. Use whenever a maintainer asks you to triage, label, categorize, prioritize, or "look at" an issue (or a…

googleapis/mcp-toolbox · 164 tokens

adk-debug

Diagnoses misbehaving ADK agents by inspecting sessions, events, tool calls, and the exact request that reached the model. Covers the adk run CLI and the adk web dev server with its session, trace, and debug HTTP endpoints. Use when an agent returns the wrong answer, ignores a tool or swallows a tool error, hangs…

google/adk-python · 191 tokens

cvm-ai-doctor

A health-diagnosis workflow for servers, computers, virtual machines, and containers on Linux, macOS, or Windows.

TencentCloud/Octop · 60 tokens

browser-edge-cases

SOP for debugging browser automation failures on complex websites. Use when browser tools fail on specific sites like LinkedIn, Twitter/X, SPAs, or sites with Shadow DOM.

aden-hive/hive · 40 tokens

rubber-duck

Adversarial "rubber duck" review that turns explaining-out-loud into a hallucination check. The main session is the PRESENTER (it did the work — a design doc, investigation, or analysis — and holds the real reasoning) and reconstructs the topic to a LISTENER — a spawned subagent pinned to a DIFFERENT-vendor model that…

kirodotdev/KiroCrew · 161 tokens

scanner-overview

Stage 1 broad-spectrum scanner playbook. Sharded sweep over very large codebases producing CANDIDATE nodes for the Detector to reason about. Load at scanner-agent startup.

PurpleAILAB/Decepticon · 40 tokens