
ast-grep-outline
Use when exploring or modifying a codebase and you need a cheap structural map of files, directories, imports, exports, or direct members before reading full source.
- Installs
- 2.4K
- Last 24h
- +19
- Trending rank
- #5956
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/ast-grep/agent-skill --skill ast-grep-outline- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads ast-grep-outline automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Use ast-grep outline
ast-grep outline prints a compact structural map of source code with line
numbers: top-level items (imports, functions, classes, structs,
interfaces, modules, enums) and their direct members (fields, methods,
constructors, enum variants). It is a local, syntax-only view — cheap enough
to run before any full file read.
Read code in stages: find candidate files with search or file names, outline them, then open only the source range the outline points to. Defaults adapt to input: a file shows its local structure with member digests; a directory shows only its exported surface as grouped names.
When To Use It
Understand a file before editing. Get a table of contents, dependencies, and public entry points before reading implementation details:
ast-grep outline <file>
ast-grep outline <file> --items imports
ast-grep outline <file> --items exports
Map an unfamiliar directory. Scan the public surface of a subtree, then narrow by symbol type when you know what you are looking for:
ast-grep outline <dir> --items exports
ast-grep outline <dir> --type struct,enum,function
Zoom into a known symbol. After search finds a likely name, list its members with line numbers instead of reading the whole body:
ast-grep outline <file> --match <symbol> --type class --view expanded
Trace dependency direction. Find which files import a package or module to decide where a change belongs:
ast-grep outline <dir> --items imports --view signatures
Review changed files after editing. Git tells you what changed; outline summarizes the resulting structure and public surface:
ast-grep outline $(git diff --name-only HEAD) --items exports
Argument Guide
--items <KIND>selects top-level items:structurefor local declarations (file default),exportsfor public API (directory default),importsfor dependencies,allwhen import/export edges matter together.--view <VIEW>controls detail, from least to most:namesfor directory scans,signaturesfor one line per item,digestfor signatures plus member names,expandedfor one line per member with its line number.--match <REGEX>filters top-level items by name or signature. Rust regex, case-sensitive; it never matches members.--type <TYPE[,TYPE...]>keeps only some top-level symbol types, such as--type class,function. Member types likemethod,fieldnever match top-level items.--pub-membershides private members when the view prints members.--json=streamemits one JSON object per file with precise ranges. Use it only to pipe or post-process entries; prefer text for navigation.
Limits
outline shows local syntax structure. It does not resolve references, infer
types, follow re-export chains, or build a call graph. Use ast-grep run,
rg, or compiler-backed tools for those questions, then outline the candidate
files they surface.
FAQ
What does the ast-grep-outline skill do?
Use when exploring or modifying a codebase and you need a cheap structural map of files, directories, imports, exports, or direct members before reading full source.
How do I install ast-grep-outline?
Run npx skills add https://github.com/ast-grep/agent-skill --skill ast-grep-outline in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ast-grep-outline/ (personal) or .claude/skills/ast-grep-outline/ (project).
Which AI agents can use ast-grep-outline?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is ast-grep-outline safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains ast-grep-outline?
It is published by ast-grep in ast-grep/agent-skill. It has 2,427 recorded installs.
More from ast-grep/agent-skill
ast-grep
ast-grep/agent-skill
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.