# 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. [Cited 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. [Cited 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. [Cited 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. [Cited 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. [Cited source](https://ast-grep.github.io/guide/quick-start.html)
- **Real-world adoption** (unknown) — No reviewed evidence is recorded for this dimension.
  - Has another team put it to work? [Contribute evidence](https://github.com/seikika/seikika/issues/new?title=Evidence+review+%C2%B7+ast-grep+%C2%B7+Real-world+adoption&body=Practice%3A+ast-grep%0ACriterion%3A+adoption+%28rubric+v1%29%0AHas+another+team+put+it+to+work%3F%0A%0APublished+judgment%3A+unknown%0ANo+reviewed+evidence+is+recorded+for+this+dimension.%0A%0AProposed+judgment+and+rationale%3A%0A%0APublic+source+or+reproduction+%28include+version%2C+inputs+and+observed+result%29%3A)
- **Agent guidance** (unknown) — No reviewed evidence is recorded for this dimension.
  - Can an agent act on a specific finding? [Contribute evidence](https://github.com/seikika/seikika/issues/new?title=Evidence+review+%C2%B7+ast-grep+%C2%B7+Agent+guidance&body=Practice%3A+ast-grep%0ACriterion%3A+guidance+%28rubric+v1%29%0ACan+an+agent+act+on+a+specific+finding%3F%0A%0APublished+judgment%3A+unknown%0ANo+reviewed+evidence+is+recorded+for+this+dimension.%0A%0AProposed+judgment+and+rationale%3A%0A%0APublic+source+or+reproduction+%28include+version%2C+inputs+and+observed+result%29%3A)
- **Agent portability** (unknown) — No reviewed evidence is recorded for this dimension.
  - Does the practice work in two agent harnesses? [Contribute evidence](https://github.com/seikika/seikika/issues/new?title=Evidence+review+%C2%B7+ast-grep+%C2%B7+Agent+portability&body=Practice%3A+ast-grep%0ACriterion%3A+portability+%28rubric+v1%29%0ADoes+the+practice+work+in+two+agent+harnesses%3F%0A%0APublished+judgment%3A+unknown%0ANo+reviewed+evidence+is+recorded+for+this+dimension.%0A%0AProposed+judgment+and+rationale%3A%0A%0APublic+source+or+reproduction+%28include+version%2C+inputs+and+observed+result%29%3A)

## 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)
