Code structure

From xdg/xdg-claude · View interactive version

Code structure is an AI agent skill from the GitHub repository xdg/xdg-claude. Outline a file or package (functions, classes, methods, types, imports, exports) instead of reading it whole. Use before opening an unfamiliar or large file to orient, when surveying a package's API surface, or to find where a symbol is defined so you can Read just that range -- any "what's in / lis

How to use this skill

Skill file

code-structure

When the question is "list the X in Y", do not Read the whole file. Get an outline first; Read selectively after.

Trigger discrimination

Tiered approach

  1. ast-grep outline -- the default. One interface across languages, no build or import step, and every text view carries line numbers so you can Read just the range you need afterward. Pass -l to be safe (required for stdin; inferred from extension for paths).
  1. Compiler/parser-aware tool when you need true export semantics or docstrings, which outline does not carry:
  1. ctags fallback -- for languages outline's bundled rules don't cover; canonical for C/C++:

```bash

ctags -f - file | grep -v '^!' | cut -f1,4 # symbol + kind

```

Use the outline to decide what to Read, then Read just that section.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.