Install any skill in seconds. Free to start, no credit card required.
Get Started Free →AST-based code search and refactoring via ast-grep MCP
.claude/skills/ast-grep-find/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-14 | ✗→✓ | ▲ Improved | -52% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 285% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 22% | 0% |
| case-05 | ✓→✗ | ▼ Worse | 30% | 0% |
| case-07 | ✓→✗ | ▼ Worse | 2% | 0% |
Structural code search that understands syntax. Find patterns like function calls, imports, class definitions - not just text.
bashuv run python -m runtime.harness scripts/ast_grep_find.py \ --pattern "import asyncio" --language python
bashuv run python -m runtime.harness scripts/ast_grep_find.py \ --pattern "async def \$FUNC(\$\$\$)" --language python --path "./src"
bashuv run python -m runtime.harness scripts/ast_grep_find.py \ --pattern "console.log(\$MSG)" --replace "logger.info(\$MSG)" \ --language javascript
bashuv run python -m runtime.harness scripts/ast_grep_find.py \ --pattern "print(\$X)" --replace "logger.info(\$X)" \ --language python --dry-run
| Parameter | Description | |-----------|-------------| | --pattern | AST pattern to search (required) | | --language | Language: python, javascript, typescript, go, etc. | | --path | Directory to search (default: .) | | --glob | File glob pattern (e.g., **/*.py) | | --replace | Replacement pattern for refactoring | | --dry-run | Preview changes without applying | | --context | Lines of context (default: 2) |
| Syntax | Meaning | |--------|---------| | $NAME | Match single node (variable, expression) | | $$$ | Match multiple nodes (arguments, statements) | | $_ | Match any single node (wildcard) |
bash# Find all function definitions uv run python -m runtime.harness scripts/ast_grep_find.py \ --pattern "def \$FUNC(\$\$\$):" --language python # Find console.log calls uv run python -m runtime.harness scripts/ast_grep_find.py \ --pattern "console.log(\$\$\$)" --language javascript # Replace print with logging uv run python -m runtime.harness scripts/ast_grep_find.py \ --pattern "print(\$X)" --replace "logging.info(\$X)" \ --language python --dry-run
| Tool | Best For | |------|----------| | ast-grep | Structural patterns (understands code syntax) | | warpgrep | Fast text/regex search (20x faster grep) |
Use ast-grep when you need syntax-aware matching. Use warpgrep for raw speed.
Requires ast-grep server in mcp_config.json.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-15 | fail→fail | 8,380 | 7,698 | -8% | 1 | 1 | 0% | 612 | 1,181 | +93% | 0 | 0 | — |
case-14 | fail→pass | 13,587 | 4,201 | -69% | 1 | 1 | 0% | 2,862 | 1,378 | -52% | 0 | 0 | — |
case-01 | fail→fail | 10,877 | 7,074 | -35% | 1 | 1 | 0% | 522 | 1,168 | +124% | 0 | 0 | — |
case-02 | fail→pass | 2,778 | 7,887 | +184% | 1 | 1 | 0% | 349 | 1,345 | +285% | 0 | 0 | — |
case-03 | fail→fail | 10,417 | 5,656 | -46% | 1 | 1 | 0% | 1,916 | 1,047 | -45% | 0 | 0 | — |
case-04 | pass→pass | 6,639 | 3,710 | -44% | 1 | 1 | 0% | 1,165 | 1,335 | +15% | 0 | 0 | — |
case-05 | pass→fail | 8,645 | 7,267 | -16% | 1 | 1 | 0% | 1,575 | 2,048 | +30% | 0 | 0 | — |
case-06 | pass→pass | 11,131 | 5,004 | -55% | 1 | 1 | 0% | 1,812 | 1,787 | -1% | 0 | 0 | — |
case-07 | pass→fail | 9,135 | 7,033 | -23% | 1 | 1 | 0% | 972 | 991 | +2% | 0 | 0 | — |
case-08 | fail→fail | 8,168 | 5,339 | -35% | 1 | 1 | 0% | 432 | 1,007 | +133% | 0 | 0 | — |
case-09 | fail→fail | 12,284 | 6,130 | -50% | 1 | 1 | 0% | 1,256 | 1,154 | -8% | 0 | 0 | — |
case-10 | fail→fail | 6,810 | 6,378 | -6% | 1 | 1 | 0% | 1,229 | 1,182 | -4% | 0 | 0 | — |
case-11 | fail→pass | 4,962 | 6,332 | +28% | 1 | 1 | 0% | 904 | 1,103 | +22% | 0 | 0 | — |
case-12 | pass→fail | 14,635 | 6,515 | -55% | 1 | 1 | 0% | 2,035 | 1,067 | -48% | 0 | 0 | — |
case-13 | fail→fail | 9,168 | 1,565 | -83% | 1 | 1 | 0% | 501 | 989 | +97% | 0 | 0 | — |
case-16 | pass→fail | 8,921 | 7,173 | -20% | 1 | 1 | 0% | 1,765 | 1,270 | -28% | 0 | 0 | — |
case-17 | pass→fail | 18,577 | 6,665 | -64% | 1 | 1 | 0% | 2,550 | 1,132 | -56% | 0 | 0 | — |
case-18 | fail→fail | 6,256 | 5,163 | -17% | 1 | 1 | 0% | 1,139 | 944 | -17% | 0 | 0 | — |
case-19 | fail→fail | 9,050 | 6,325 | -30% | 1 | 1 | 0% | 677 | 1,066 | +57% | 0 | 0 | — |
case-20 | fail→fail | 8,755 | 10,670 | +22% | 1 | 1 | 0% | 1,435 | 1,403 | -2% | 0 | 0 | — |
case-21 | fail→fail | 8,387 | 6,956 | -17% | 1 | 1 | 0% | 538 | 1,117 | +108% | 0 | 0 | — |
case-22 | pass→fail | 8,559 | 6,043 | -29% | 1 | 1 | 0% | 1,543 | 1,047 | -32% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 6 counted toward the lift figure. The other 16 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of -14 percentage points is the difference between those two pass rates over the 6 comparable cases. 9 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 7/30/2026 | +45% |
Other measured skills in the registry, with their headline benchmark lift.