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/alchemiststudiosdotai/harness-engineering/ast-grep-setupnpx skills add alchemiststudiosDOTai/harness-engineering --skill ast-grep-setupgit clone --depth 1 https://github.com/alchemiststudiosDOTai/harness-engineeringWrote 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/alchemiststudiosdotai/harness-engineering/ast-grep-setup)<a href="https://agentmods.dev/skills/alchemiststudiosdotai/harness-engineering/ast-grep-setup"><img src="https://agentmods.dev/badge/skills/alchemiststudiosdotai/harness-engineering/ast-grep-setup.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.00063 | $0.04793 |
| Opus 5 | $0.00032 | $0.02397 |
| Sonnet 5 | $0.00013 | $0.00959 |
| Haiku 4.5 | $0.00006 | $0.00479 |
Grade A, and why
ast-grep-setup 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 5d 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.
regex: ^(fs|path|os|crypto|http|https|net|dgram|dns|cluster|module|vm|child_process|worker_threads)$ How it starts
The opening of the file, as written. The whole thing — 776 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ast-grep Setup Skill
Set up ast-grep with common TypeScript rules for detecting anti-patterns, enforcing best practices, and preventing bugs.
When to Use
- Adding structural linting to a TypeScript codebase
- Banning legacy patterns after migration
- Implementing ratchet gates (block new violations while grandfathering existing ones)
- Enforcing architecture boundaries
- Preventing common TypeScript/JavaScript bugs
CRITICAL: Read YAML Structure First
Agents: Before writing any rules, read the YAML Structure Rules section.
The most common mistakes are:
- Putting
constraintsinsiderule:(must be at top level) - Duplicate YAML keys like multiple
not:blocks - Not wrapping multiple conditions in
all:orany:
Use the validation script to catch these before running ast-grep:
python3 scripts/validate-rule.py rules/*.yml
Quick Start
1. Initialize ast-grep Configuration
# Create sgconfig.yml in project root
mkdir -p rules/ast-grep/rules rules/ast-grep/rule-tests
cat > rules/ast-grep/sgconfig.yml << 'EOF'
ruleDirs:
- rules
testConfigs:
- testDir: rule-tests
allowedFixers: []
EOF
2. Add Rules for Common TypeScript Pain Points
See the Rule Library below for ready-to-use rules.
3. Run and Test
# Scan the codebase
cd rules/ast-grep && ast-grep scan
# Run rule tests
cd rules/ast-grep && ast-grep test
# Update test snapshots after rule changes
cd rules/ast-grep && ast-grep test -U
Rule Library
Type Safety Rules
no-implicit-any-params
Prevents function parameters without explicit types (implicit any).
# rules/no-implicit-any-params.yml
id: no-implicit-any-params
language: TypeScript
severity: warning
message: "Parameter '$PARAM' lacks explicit type annotation"
files:
- src/**/*.ts
- src/**/*.tsx
rule:
pattern: function $FUNC($PARAM) { $$$BODY }
constraints:
PARAM:
not:
has:
kind: type_annotation
What ships with it
12 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.
- scripts/validate-rule.py 3.9 KB runs code
- templates/rule-tests/no-console-log-test.yml 409 B
- templates/rule-tests/no-debugger-test.yml 256 B
- templates/rule-tests/no-empty-catch-test.yml 514 B
- templates/rule-tests/no-floating-promises-test.yml 582 B
- templates/rule-tests/no-node-in-frontend-test.yml 321 B
- templates/rules/no-console-log.yml 259 B
- templates/rules/no-debugger.yml 175 B
- templates/rules/no-empty-catch.yml 368 B
- templates/rules/no-floating-promises.yml 711 B
- templates/rules/no-node-in-frontend.yml 430 B
- templates/sgconfig.yml 79 B
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.
- 5d ago First seen · 776 lines · 63 tokens per session scan A 8907cf09dbaa
ast-grep-setup is a skill published in the GitHub repository alchemiststudiosDOTai/harness-engineering (104 stars, last pushed 5mo ago), licensed MIT. It adds 63 tokens to every session and 4,793 once invoked, about $0.0003 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.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
chronicle
Analyze Copilot session history for standup reports, usage tips, session search, and session reindexing. Use when the user asks for a standup, daily summary, usage tips, workflow recommendations, wants to search or find past sessions by keyword/file/PR, wants to reindex their session store, or asks about deleting…
imagegen
Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…
chat-pet-sprite-creation
Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…