---
name: ast-grep
description: "Use when adopting ast-grep to assess this standard: Match forbidden syntax structurally"
---

# Apply ast-grep

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.

## Procedure

1. Inspect the repository configuration and identify the files or targets covered by ast-grep.
2. 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.
3. Record the tool version, configuration, scope and findings. Explain any checks that could not run.
4. Use the same invocation after changes and compare the evidence against the baseline.

Refer to [the upstream documentation](https://ast-grep.github.io/) for configuration and prerequisites.

## Tool invocation

```
ast-grep scan
```
