ast-index

ast-index is a skill for Claude Code from defendend/Claude-ast-index-search. It costs 236 tokens per session (7,095 once invoked), scanned A, original, MIT.

A code-search skill for finding symbols, files, implementations, callers, dependencies, and project structure across many programming languages. It uses ast-index, a tool that builds a searchable index of source code.

In plain words
What is it for?
Use it to locate classes, functions, usages, implementations, module relationships, unused dependencies, and project conventions.
Why use it?
It gives coding agents a defined first step for code searches and explains when other search methods are appropriate. The project must have ast-index installed and initialized first.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: reads .claude/ paths; mentions Claude Code.

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/me/.cache/ast-index/abc123/index.db.

Part of the ast-index plugin — 1 skill, 7 commands, 3 hooks shipped together

Good fit Use it to locate classes, functions, usages, implementations, module relationships, unused dependencies, and project conventions.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add defendend/Claude-ast-index-search
Claude Code
/plugin install ast-index

Made for: Claude Code.

Or install ast-index, the plugin that ships this one along with the rest of its 1 skill, 7 commands, 3 hooks.

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-index

README.md
[![agentmods](https://agentmods.dev/badge/skills/defendend/claude-ast-index-search/ast-index/github.svg)](https://agentmods.dev/skills/defendend/claude-ast-index-search/ast-index)
Your own site
<a href="https://agentmods.dev/skills/defendend/claude-ast-index-search/ast-index"><img src="https://agentmods.dev/badge/skills/defendend/claude-ast-index-search/ast-index/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-index

Your own site · 80×15
<a href="https://agentmods.dev/skills/defendend/claude-ast-index-search/ast-index"><img src="https://agentmods.dev/badge/skills/defendend/claude-ast-index-search/ast-index.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 236 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 7,095 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00236 $0.07095
Opus 5 $0.00118 $0.03547
Sonnet 5 $0.00047 $0.01419
Haiku 4.5 $0.00024 $0.00709

Measured 13d ago against content hash 1d0677003cba, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

ast-index scanned grade A with 1 finding 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 13d 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

db_path = subprocess.check_output(["ast-index", "db-path"]).decode().strip()
plugin/skills/ast-index/SKILL.md · 700 lines

How it starts

The opening of the file, as written. The whole thing — 700 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ast-index - Code Search for Multi-Platform Projects

Fast native Rust CLI for structural code search in Android/Kotlin/Java, iOS/Swift/ObjC, Dart/Flutter, TypeScript/JavaScript, Rust, Ruby, C#, Scala, PHP, Perl, Python, Go, C++, and Proto projects using SQLite + FTS5 index.

Critical Rules

ALWAYS use ast-index FIRST for any code search task. These rules are mandatory:

  1. ast-index is the PRIMARY search tool — use it before grep, ripgrep, or Search tool
  2. DO NOT duplicate results — if ast-index found usages/implementations, that IS the complete answer
  3. DO NOT run grep "for completeness" after ast-index returns results
  4. Use grep/Search ONLY when:
    • ast-index returns empty results
    • Searching for regex patterns (ast-index uses literal match)
    • Searching for string literals inside code ("some text")
    • Searching in comments content

Why: ast-index is 17-69x faster than grep (1-10ms vs 200ms-3s) and returns structured, accurate results.

Prerequisites

Install the CLI before use:

brew tap defendend/ast-index
brew install ast-index

Initialize index in project root:

cd /path/to/project
ast-index rebuild

The index is stored at ~/Library/Caches/ast-index/<project-hash>/index.db (macOS) or ~/.cache/ast-index/<project-hash>/index.db (Linux). Rebuild deletes the DB file entirely and creates a fresh index.

Supported Projects

Platform Languages Module System
Android/Java Kotlin, Java Gradle (build.gradle.kts), Maven (pom.xml)
iOS Swift, Objective-C SPM (Package.swift)
Web TypeScript, JavaScript, React, Vue, Svelte package.json
Rust Rust Cargo.toml
Ruby Ruby, Rails, RSpec Gemfile
.NET C#, ASP.NET, Unity *.csproj
Dart/Flutter Dart pubspec.yaml
Scala Scala Bazel (WORKSPACE, BUILD)
PHP PHP composer.json
Perl Perl Makefile.PL, Build.PL
Python Python None (*.py files)
Go Go None (*.go files)
Proto Protocol Buffers (proto2/proto3) None (*.proto files)
WSDL WSDL, XSD None (*.wsdl, *.xsd files)
C/C++ C, C++ (JNI, uservices) None (*.cpp, *.h, *.hpp files)
Godot GDScript project.godot
Mixed All above All

Read the full file on GitHub · 700 lines

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. 13d ago First seen · 700 lines · 236 tokens per session scan A 1d0677003cba

Subscribe to this mod's changes

ast-index is a skill published in the GitHub repository defendend/Claude-ast-index-search (560 stars, last pushed 7d ago), licensed MIT. It adds 236 tokens to every session and 7,095 once invoked, about $0.0012 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

debug-optimize-lcp

Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…

ChromeDevTools/chrome-devtools-mcp · 99 tokens

systematic-debugging

Use when debugging a failing test, build error, or runtime issue that isn't immediately obvious. Guides a 4-phase root cause analysis instead of random fix attempts.

open-metadata/OpenMetadata · 37 tokens

diagnose

Trace from a reproduced symptom to the source code that causes it. Pin the specific file and approximate line, rate confidence in the cause and clarity of the fix independently, and always propose a concrete fix.

emdash-cms/emdash · 43 tokens

repro-admin

Reproduce an EmDash admin UI bug. Attach a container, start the demo dev server, drive the admin with agent-browser using the dev-bypass session, and capture the reproduction as screenshots plus a replayable transcript.

emdash-cms/emdash · 48 tokens

log-error-digest

Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…

zebbern/claude-code-guide · 71 tokens

byted-util-volcengine-detect-retry

An orchestration workflow for Volcengine Cloud Detect, a service that checks websites or network endpoints from test locations.

bytedance/agentkit-samples · 101 tokens