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 agentmods add skills/fmind/dot/ast-grepnpx skills add fmind/dot --skill ast-grepgit clone --depth 1 https://github.com/fmind/dotWrote 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/fmind/dot/ast-grep)<a href="https://agentmods.dev/skills/fmind/dot/ast-grep"><img src="https://agentmods.dev/badge/skills/fmind/dot/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 | $0.00043 | $0.01115 |
| Opus 5 | $0.00022 | $0.00558 |
| Sonnet 5 | $0.00009 | $0.00223 |
| Haiku 4.5 | $0.00004 | $0.00112 |
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 yesterday.
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 — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ast-grep
Structural code search and rewrite: a pattern is real code with meta-variables, matched against the syntax tree, so it ignores formatting and never matches inside strings or comments. Use it where rg gives false positives and where a refactor must touch every call site exactly once; plain text search stays with rg.
Commands
ast-grep run -p 'print($A)' -l python # search; run is the default subcommand
ast-grep run -p 'console.log($$$ARGS)' -r 'logger.info($$$ARGS)' -l ts # dry run: prints the diff, changes nothing
ast-grep run -p 'console.log($$$ARGS)' -r 'logger.info($$$ARGS)' -l ts --update-all # apply after reviewing the dry run (-i to confirm per hunk)
ast-grep run -p 'func _() { os.Getenv($K) }' --selector call_expression -l go # Go calls need a function context (see Gotchas)
ast-grep run -p 'print($A)' -l python --json=compact # structured output; --json=stream gives one object per line
ast-grep scan # every rule in sgconfig.yml
ast-grep scan -r rules/no-print.yml --format github # one rule file; GitHub annotations in CI
Workflow
- Write the pattern as code:
$NAMEmatches one node,$$$NAMEa sequence (arguments, statements),$_a node without binding; always pass-l <lang>so the pattern parses in the right grammar, and use--debug-query=astwhen a pattern that should match does not. - Search first: run without
-r, read the matches with-C 2for context, and tune--globsor--no-ignorewhen files are skipped. - Rewrite in two steps: add
-rto see the diff, then--update-all(or-ifor an interactive session); captured meta-variables are reused in the replacement. - Promote to a rule: for a lint or a repeated refactor,
ast-grep new projectscaffoldssgconfig.ymlandrules/; a rule file hasid,language,rule(pattern,kind,inside,has,not), optionalfix,severity, andmessage;ast-grep testruns itsvalidandinvalidcases. - Wire into the gate: run
ast-grep scaninsidecheck:lint(see mise) so hooks and CI apply the same rules.
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.
- yesterday First seen · 57 lines · 43 tokens per session scan A 0762aa76e687
ast-grep is a skill published in the GitHub repository fmind/dot (4 stars, last pushed today), licensed MIT. It adds 43 tokens to every session and 1,115 once invoked, about $0.0002 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-09-03.
Other skills, from other repositories
go-stack
Build Go projects, libraries, CLIs, TUIs, web apps, or ADK agents with the standard package layout and pinned tooling.
python-stack
Build typed Python projects with uv, Ruff, ty, pytest, Litestar, and Typer. Use for packages, CLIs, web apps, tests, typing, or API verification.
k8s-local
Create and manage local Kubernetes clusters (k3d or kind) and deploy to them with kubectl, helm, helmfile, and skaffold. Use for local k8s cluster setup, dev loops, and debugging.
release
Cut or verify a versioned release — bump semver, generate the changelog with git-cliff, tag and publish on GitHub, or reconcile an already-published tag and assets.
chezmoi
Manage chezmoi dotfiles: source naming, Go templates, age-encrypted secrets, and the edit-source then apply/diff workflow.
cloud-run
Deploy container services to Google Cloud Run with Artifact Registry, keyless CI identity, Secret Manager, ko, or Dockerfiles.