eko24ive/pi-config/pi-ast-grep

Claude Code and agent skill by eko24ive/pi-config

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use for structural code work with pi-ast-grep: finding calls/imports/declarations/classes/methods/blocks, outlining large source files, scanning ast-grep rules, reviewing changed symbols, fetching exact code ranges, or previewing safe structural rewrites. Prefer plain-text alternatives only for literal strings, comments, logs, prose, or config keys.

Install

npx vskill@latest install eko24ive/pi-config/pi-ast-grep

SKILL.md

pi-ast-grep workflow

Use these tools to avoid reading huge files when a structural query can find the relevant code.

Prefer AST tools over grep-like tools when the user asks for code shape: calls to a function, imports from a module, declarations, classes, methods, control blocks, exports, or JSX-like elements. Use an available plain-text alternative for literal strings, comments, logs, config keys, prose, or when you cannot form a syntax-shaped query.

Preferred flow:

txt
ast_outline / ast_change_index -> ast_search / ast_scan -> ast_fetch -> edit

For vague exploration, first locate candidate files if needed, then switch to ast_outline / ast_search once the target is structural.

Tool roles

  • ast_outline: compact structure map for files/scoped paths; use before reading large source files when symbols matter.
  • ast_search: structural search using ast-grep patterns or node kinds; prefer over text grep for calls/imports/declarations/classes/methods/blocks.
  • ast_scan: native ast-grep YAML rule/config scanning from rule, inlineRules, explicit config, or cwd sgconfig.yml discovery.
  • ast_fetch: bounded raw code for result ids or explicit file/range targets; include: ["ancestors"] adds a concise best-effort outline chain when available.
  • ast_change_index: local/staged/branch changed-code index grouped by files/symbols where possible; use it to choose what to inspect, not to read patch diffs.
  • ast_diff_file: bounded git diff for exactly one concrete file; use only after choosing a specific file. It rejects directories, globs, and project-root paths.
  • ast_rewrite: structural rewrite; dry-run first, apply only with expectedMatches.

Pattern examples

Calls:

txt
foo($$$ARGS)
readFileSync($$$ARGS)

Imports:

txt
import { $NAME } from "$MOD"
import $NAME from "$MOD"

Functions/classes:

txt
function $NAME($$$PARAMS) { $$$BODY }
class $NAME { $$$BODY }

Blocks:

txt
if ($COND) { $$$BODY }
try { $$$BODY } catch ($ERR) { $$$HANDLER }

Use selector and strictness only as pattern modifiers, not with kind. Example: pattern: "foo($$$ARGS)", selector: "call_expression", strictness: "ast" to keep a call-shaped match focused.

Use beforeLines / afterLines for compact one-sided context in ast_search; use ast_fetch when editable code is needed.

JSX-like syntax is just syntax, not a React-specific workflow. Use only when the target language/files support it.

Language support

Language support depends on the local ast-grep installed for the session.

The extension normalizes common aliases and infers common file extensions when a single file language is clear. Explicit language is still useful for directory searches, ambiguous extensions, mixed-language paths, and parse errors.

Unknown or unsupported file types are passed through to ast-grep; zero-match results and failures should be treated cautiously because they can mean a language/inference problem rather than true absence.

Fallback rules

  • Unknown file type: ast-grep sees it; use an available alternative or targeted read if results look suspicious.
  • Pattern parse error: simplify the pattern and specify language.
  • Zero matches: do not assume absence; check language, path/globs, inference, and whether this is actually text search.
  • Stale id: re-run the source ast tool or pass explicit file/range to ast_fetch.
  • Large changed-code result: narrow ast_change_index with paths, symbolKinds, maxFiles, or maxItems; do not switch to broad git diff or raise limits to read the whole patch.
  • Large result: use nextCursor for ast_search/ast_scan/ast_outline result pagination, or narrow paths/globs/query. Cursor calls may include only paging/output params and return fresh fetchable ids. Cursors do not recover output truncated by maxBytes.

Safe rewrite workflow

  1. Run ast_search first if unsure about match shape.
  2. Run ast_rewrite with apply: false.
  3. Inspect the diff.
  4. Apply only with exact expectedMatches.
  5. Validate with tests/typecheck/formatting as appropriate.

Never assume ast_rewrite is type-aware. It is syntax-aware only.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/eko24ive/pi-config/pi-ast-grep/badge)](https://verified-skill.com/skills/eko24ive/pi-config/pi-ast-grep)

Something wrong with this skill or its page? Tell us.