structural-code-search
Skill0 starsChanged 4 months agoMITView on GitHub
Uses ast-grep for AST-aware code search, lint rules, and controlled rewrites while keeping text search and semantic navigation separate. Use for syntactic patterns, codemods, repeated code shapes, or structural rules that regex cannot safely express.
In this repository12 other files it gives its agents.
- policies/claude.mdCLAUDE.md
- agent-supply-chainSkill
- browser-qaSkill
- current-docsSkill
- dependency-architectureSkill
- evidence-reportSkill
- large-codebase-mapSkill
- performance-reportSkill
- project-bootstrapSkill
- serena-symbolic-codeSkill
- verification-gateSkill
- workflow-routerSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Start with a simple pattern and metavariables.
- Distinctive: line 18
Test the pattern against a small representative sample.
- Distinctive: line 22
Run formatter, type checks, and relevant tests afterward.
- Very specific: line 28
Use rg for text, filenames, logs, and non-code configuration.
- Distinctive: line 29
Use Serena when symbol identity or references matter.
- Distinctive: line 30
Never assume formatting-insensitive matching means semantic equivalence.
- Distinctive: line 31
Do not run a repository-wide rewrite before validating positive and negative cases.
- Distinctive: line 32
Keep project-specific rules in the project, not in a global catch-all config.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Structural Code Search
Requires sg or ast-grep; project scans require sgconfig.yml.
Workflow
- Confirm the target language and the smallest relevant path.
- Start with a simple pattern and metavariables.
- Test the pattern against a small representative sample.
- Move complex constraints into a YAML rule.
- Inspect the project config with
sg scan --inspect summary. - Preview rewrites interactively or as a diff before applying broadly.
- Run formatter, type checks, and relevant tests afterward.
See patterns and safety for examples.
Guardrails
- Use
rgfor text, filenames, logs, and non-code configuration. - Use Serena when symbol identity or references matter.
- Never assume formatting-insensitive matching means semantic equivalence.
- Do not run a repository-wide rewrite before validating positive and negative cases.
- Keep project-specific rules in the project, not in a global catch-all config.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

