agentleFS
Anders-planckAnders-planck/orditra/skills/structural-code-search/SKILL.md

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.

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
  1. Distinctive:

    Start with a simple pattern and metavariables.

    line 17
  2. Distinctive:

    Test the pattern against a small representative sample.

    line 18
  3. Distinctive:

    Run formatter, type checks, and relevant tests afterward.

    line 22
  4. Very specific:

    Use rg for text, filenames, logs, and non-code configuration.

    line 28
  5. Distinctive:

    Use Serena when symbol identity or references matter.

    line 29
  6. Distinctive:

    Never assume formatting-insensitive matching means semantic equivalence.

    line 30
  7. Distinctive:

    Do not run a repository-wide rewrite before validating positive and negative cases.

    line 31
  8. Distinctive:

    Keep project-specific rules in the project, not in a global catch-all config.

    line 32

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Structural Code Search

Requires sg or ast-grep; project scans require sgconfig.yml.

Workflow

  1. Confirm the target language and the smallest relevant path.
  2. Start with a simple pattern and metavariables.
  3. Test the pattern against a small representative sample.
  4. Move complex constraints into a YAML rule.
  5. Inspect the project config with sg scan --inspect summary.
  6. Preview rewrites interactively or as a diff before applying broadly.
  7. Run formatter, type checks, and relevant tests afterward.

See patterns and safety for examples.

Guardrails

  • Use rg for 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.