Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add bahayonghang/my-ai-cli-toolkit --skill ast-grepgit clone --depth 1 https://github.com/bahayonghang/my-ai-cli-toolkitWrote 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.
[](https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/ast-grep)<a href="https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/ast-grep"><img src="https://agentmods.dev/badge/skills/bahayonghang/my-ai-cli-toolkit/ast-grep.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00064 | $0.01427 |
| Opus 5 | $0.00032 | $0.00714 |
| Sonnet 5 | $0.00013 | $0.00285 |
| Haiku 4.5 | $0.00006 | $0.00143 |
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 7d 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.
How it starts
The opening of the file, as written. The whole thing — 192 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ast-grep Structural Search
Use ast-grep when the user needs code structure, not just text. The useful outcome is a validated rule plus a clear statement of what it matches and what it may miss.
Triage
Start with the smallest tool that can answer the question.
- Use
rgfor exact names, strings, comments, or simple text. - Use language tooling for semantic facts such as type resolution, references, imports, or rename safety.
- Use ast-grep for syntax shape: descendants, ancestors, call forms, decorators, missing constructs, nested contexts, or multi-language structural searches.
If ast-grep is not installed, say so and offer an rg fallback only when the
fallback will not pretend to be structural.
Workflow
-
Identify the language and target files.
- Infer from paths and extensions when possible.
- Ask only if the language or include/exclude scope cannot be inferred.
-
Write a tiny fixture before searching the real repository.
- Include at least one positive example.
- Add a negative example when false positives would be costly.
-
Start with the simplest pattern.
- Use
ast-grep run --pattern ... --lang ...for a single-node search. - Move to a YAML rule when the search needs
has,inside,not,any,all,regex,nthChild, or reusable metadata.
- Use
-
Debug the parsed structure when the first rule misses.
- Use
ast-grep run --pattern '<sample code>' --lang <lang> --debug-query=ast. --debug-queryprints diagnostic output and may exit non-zero; treat the printed tree as useful debug output, not as a failed repository search.
- Use
-
Validate on the fixture before running on the repository.
- Keep the rule as simple as possible until it matches the fixture.
- Then scan the real path and report expected false-negative boundaries.
-
Report the final rule, command, and caveats.
- Name node kinds or language constructs intentionally excluded.
- Prefer JSON output when a downstream script will consume matches.
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 7d ago First seen · 192 lines · 64 tokens per session scan A e1299a8af6da
ast-grep is a skill published in the GitHub repository bahayonghang/my-ai-cli-toolkit (16 stars, last pushed yesterday), licensed MIT. It adds 64 tokens to every session and 1,427 once invoked, about $0.0003 per session on Opus 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-08-30.
Other skills, from other repositories
sensegrep-cli
Semantic-first code discovery via the sensegrep CLI. Default to sensegrep search for behavior, concepts, structure, and exploration; reserve sensegrep literal for known exact strings, regexes, exhaustive occurrence audits, or verification after discovery.
sensegrep
Semantic-first code discovery via MCP. Default to sensegrepsearch for behavior, concepts, structure, and exploration; reserve sensegrepliteral for known exact strings, regexes, exhaustive occurrence audits, or verification after discovery.
ccc
This skill should be used when code search is needed (whether explicitly requested or as part of completing a task), when indexing the codebase after changes, or when the user asks about ccc, cocoindex-code, or the codebase index. Trigger phrases include 'search the codebase', 'find code related to', 'update the…
health-check
Get an overall Python code quality health score using pyscn. Use when user asks how healthy or good the code is, wants a quality overview, a grade, a summary of technical debt, or a before/after quality comparison.
x-ray
Deep codebase exploration using semantic search and relationship mapping. Use when you need to understand the current codebase.
bloat-detector
Detects codebase bloat via dead code, duplication, complexity, and doc bloat scans. Use when codebase feels large or before a release.