# ast-grep

Match forbidden syntax structurally

Express a repository convention as a syntax-tree pattern. Keep a matching fixture and a near miss alongside the rule so equivalent formatting produces the same finding.

Category: Code quality
Languages: JavaScript, TypeScript, Rust, Go, Python

## Standard evidence

Rubric v1 · 5/8 verified · 3 unknown · 0 contrary · reviewed 2026-11-28

- **Definition** (verified) — A rule selects syntax-tree nodes satisfying its specified fields. Node kinds and structural relationships constrain the match beyond surface text. Reviewed 2026-11-28. [Source](https://ast-grep.github.io/guide/rule-config.html)
- **Measurement** (verified) — The test runner evaluates two lists: valid snippets must produce no match, and invalid snippets must trigger the rule. Reviewed 2026-11-28. [Source](https://ast-grep.github.io/guide/test-rule.html)
- **Conformance** (verified) — The published no-await-in-loop example supplies valid and invalid snippets and expected rule behavior. It exercises that structural rule, not arbitrary user rules. Reviewed 2026-11-28. [Source](https://ast-grep.github.io/guide/test-rule.html)
- **CI enforcement** (verified) — A match on a rule set to error makes ast-grep scan return nonzero. Warning and hint levels allow a team to distinguish advisory checks from build gates. Reviewed 2026-11-28. [Source](https://ast-grep.github.io/guide/project/severity.html)
- **Getting started** (verified) — The quick start provides installation choices and a runnable search that finds a JavaScript pattern before demonstrating how to rewrite it. Reviewed 2026-11-28. [Source](https://ast-grep.github.io/guide/quick-start.html)
- **Real-world adoption** (unknown) — No reviewed evidence is recorded for this dimension.
- **Agent guidance** (unknown) — No reviewed evidence is recorded for this dimension.
- **Agent portability** (unknown) — No reviewed evidence is recorded for this dimension.

## Adoption

Use ast-grep in this repository to meet this standard: Match forbidden syntax structurally. Express a repository convention as a syntax-tree pattern. Keep a matching fixture and a near miss alongside the rule so equivalent formatting produces the same finding. Inspect the repository configuration, record the baseline and exact reproduction steps, then add the smallest repeatable check that detects a regression.

### Tool command

```
ast-grep scan
```

Seikika package: no verified installation is listed.

## References

- [Tool documentation](https://ast-grep.github.io/)
- [Agent skill](/skills/ast-grep/SKILL.md)
