Agent skill

Ast Grep

by banteg in banteg/crimson

Use ast-grep for Python structural code exploration, mechanical codemods, and rule maintenance in this repo.

No licenceAuto-check passedDevelopment

Install Ast Grep

skills CLI
$ npx skills add banteg/crimson --skill ast-grep -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install banteg/crimson ast-grep --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/banteg/crimson.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.codex/skills/ast-grep .claude/skills/ast-grep && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ast-grep
GitHub stars
184
Token cost
~541 tokens
SKILL.md length
183 words
Files
2
Skills in repo
2
Repo updated
First seen
Licence
None found

At a glance

Use ast-grep for Python structural code exploration, mechanical codemods, and rule maintenance in this repo.

  • Works in 3 steps: Start narrow (single directory or file… → Prototype match/rewrite → Apply intentionally
  • Tasks that involve Code migrations
  • SKILL.md covers Quick Start, Structural Exploration, Mechanical Codemods and Repo Rule Layout, plus 2 more sections
  • Calls just and git

What it does

Ast Grep is an agent skill from banteg/crimson. Use ast-grep for Python structural code exploration, mechanical codemods, and rule maintenance in this repo. Use this when you need syntax-aware search/replace (instead of regex), to add/update ast-grep rules in tools/ast-grep/, or to verify rule behavior with ast-grep scan and ast-grep test.

Its SKILL.md is about 540 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `agents/openai.yaml`).

It sits in Development, covering Code migrations. It works with Python. The repository describes itself as: a faithful rewrite of crimsonland 1.9.93 from 2003.

When your agent uses it

  • Tasks that involve Code migrations

Example prompts

  • “/ast-grep”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Start narrow (single directory or file set).
  2. Prototype match/rewrite
  3. Apply intentionally

What it can do on your machine

Read from SKILL.md and the folder at commit 8bd33b5. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • just
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Ast Grep loads about 541 tokens when it runs. Until then it costs about 77 tokens; SKILL.md has 183 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~77
When it runs · the whole SKILL.md, loaded when a task matches
~541

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

Without a licence we can't republish the file, so here is its outline and opening line. It has 183 words (~541 tokens).

“Prefer ast-grep for structural exploration and mechanical rewrites in Python code.”

— opening of SKILL.md by banteg
name
ast-grep

Read the full SKILL.md on GitHub

Files

SKILL.md and 1 other file in .codex/skills/ast-grep of banteg/crimson.

  • SKILL.md
  • agents/openai.yaml

Open the folder on GitHubat commit 8bd33b5

Compare with similar skills

Ast Grep next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Ast Grep compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ast Grep this skillbanteg/crimson184—~541Automated safety check: PassNone
jscpd Code Migration Trackerkucherenko/jscpd6.4k—~5kAutomated safety check: PassMIT
RustPython Stdlib UpgradeRustPython/RustPython22k—~876Automated safety check: PassMIT
Code Migrationanthropics/code-migration-kit-with-claude-code743—~983Automated safety check: PassCustom licence
Saleor Port Changessaleor/saleor23k—~969Automated safety check: PassBSD-3-Clause
Frappe Ops UpgradesImpertio-Studio/Frappe_Claude_Skill_Package187—~3.3kAutomated safety check: NotesMIT

Similar skills

  • Measures a code port between languages or frameworks with jscpd's function-level comparison, porting tests before code and tracking what is left unmatched.

    6.4k GitHub stars~5k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • RustPython Stdlib Upgrade

    RustPython/RustPython

    Upgrades a Python standard library module from CPython into RustPython with update_lib, then triages and marks the tests that still fail.

    22k GitHub stars~876 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Code Migration

    anthropics/code-migration-kit-with-claude-code

    Official

    Run a large-scale language migration with the six-step process: create the map and the rules, stress-test the rules, translate everything, compile, run it, match behavior.

    743 GitHub stars~983 tokensUpdated 3 mo ago
    DevelopmentAuto-check passed
  • Saleor Port Changes

    saleor/saleor

    Forward-ports or backports a single PR or branch onto the currently checked-out Saleor branch, handling GraphQL version markers and migration numbering along the way.

    23k GitHub stars~969 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Frappe Ops Upgrades

    Impertio-Studio/Frappe_Claude_Skill_Package

    A skill your agent uses when upgrading Frappe/ERPNext between major versions (v14 to v15, v15 to v16), troubleshooting failed migrations, or planning rollback.

    187 GitHub stars~3.3k tokensUpdated 21 days ago
    DevelopmentAuto-check: notes
  • Documenso Upgrade Migration

    jeremylongshore/tons-of-skills-marketplace

    Manage Documenso API version upgrades and SDK migrations. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~1.8k tokensUpdated today
    DevelopmentAuto-check passed

More from banteg/crimson

  • Crimson Release

    banteg/crimson

    Prepare or publish a Crimson patch, minor, or development release with changelog notes, version and lock updates, validation, and tag-triggered publishing.

    184 GitHub stars~896 tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Ast Grep

What does Ast Grep do?

Use ast-grep for Python structural code exploration, mechanical codemods, and rule maintenance in this repo. Ast Grep is an agent skill from banteg/crimson. Use ast-grep for Python structural code exploration, mechanical codemods, and rule maintenance in this repo.

When should I use Ast Grep?

Ast Grep fits situations like: tasks that involve Code migrations.

How do I install Ast Grep in Claude Code?

Run `npx skills add banteg/crimson --skill ast-grep -a claude-code`. Or copy the skill folder (.codex/skills/ast-grep in banteg/crimson) into .claude/skills/ast-grep in your project. Claude Code loads it when a task matches its description.

How do I install Ast Grep in Codex?

Run `npx skills add banteg/crimson --skill ast-grep -a codex`. Or copy the skill folder (.codex/skills/ast-grep in banteg/crimson) into .agents/skills/ast-grep in your project. Codex loads it when a task matches its description.

Can I use Ast Grep in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add banteg/crimson --skill ast-grep -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ast-grep, .gemini/skills/ast-grep, .github/skills/ast-grep and .opencode/skills/ast-grep in your project.

What does Ast Grep need to run?

Going by SKILL.md and its folder, Ast Grep needs the command-line tools its instructions call (just and git). Our summary lists: Python 3.

Does Ast Grep access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Ast Grep safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Ast Grep use?

No licence was found for Ast Grep or its repository. Without one, default copyright applies: ask the author before reusing or redistributing it.

How many tokens does Ast Grep use?

About 541 tokens (SKILL.md is roughly 2.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Ast Grep?

Skills that share tags, products or a category with Ast Grep: jscpd Code Migration Tracker (kucherenko/jscpd, 6.4k stars), RustPython Stdlib Upgrade (RustPython/RustPython, 22k stars), Code Migration (anthropics/code-migration-kit-with-claude-code, 743 stars) and Saleor Port Changes (saleor/saleor, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ast Grep?

banteg (a GitHub user) maintains it in banteg/crimson, which has 184 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on October 8, 2026.

Source: banteg/crimson on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.