extracting-code-structure
Use when listing all methods, functions, or classes in a file, exploring unfamiliar code, getting API overviews, or deciding what to read selectively without loading entire files
- License 许可
- MIT
- 最近更新
- 2026-05-29
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- extracting-code-structure
- description
- Use when listing all methods, functions, or classes in a file, exploring unfamiliar code, getting API overviews, or deciding what to read selectively without loading entire files
02 资源文件 1
- 参考文档reference/code-structure-guide.md11.8 KB
03 SKILL.md 正文
Code Structure Exploration Tools
Always invoke extracting-code-structure skill to extract file structure - do not execute bash commands directly.
Recognizing Structure Questions
These keywords mean use structure tools, NOT grep/search:
- "all the methods/functions/classes in..."
- "list of function signatures"
- "what functions/exports/API..."
- "package API" or "module exports"
- "method signatures with receivers" (Dart/Flutter, TypeScript)
- "what's available in..."
These keywords mean use search (Grep tool or extracting-code-structure skill):
- "where is X defined"
- "find calls to X"
- "search for pattern Y"
Before You Choose a Tool
Ask yourself:
- Am I listing/exploring what exists? → Structure tools
- Am I finding WHERE something is? → Search tools (Grep or ast-grep)
- Am I understanding HOW something works? → Read
When to Get File Outline vs Read
Get outline/index when:
- File is large (>500 lines)
- Need to see what's available (functions, classes, exports)
- Exploring unfamiliar code
- Want to decide what to read in detail
- Saves 90%+ context vs reading entire file
Just use Read when:
- File is small (<500 lines)
- Already know what you're looking for
- Need to understand implementation details
- extracting-code-structure pattern already targets what you need
Anti-Patterns
DON'T use grep/rg/Grep tool for:
- Extracting function/method lists
- Getting API overviews
- Finding all exports/public members
- Getting signatures/interfaces
These are STRUCTURE queries, not SEARCH queries.
Default Strategy
Invoke extracting-code-structure skill for extracting file structure (functions, classes, exports) efficiently without reading entire files.
Use ast-grep patterns, Dart/Flutter analyzer, ctags, or language-specific tools to get outlines and signatures. Dart/Flutter and JavaScript/TypeScript support have highest priority.
Exploration Strategy
Tiered approach (try in order):
-
ast-grep with known patterns - Fast, targeted (highest priority)
- Extract exports, functions, classes with specific patterns
- See code structure guide for patterns, including comprehensive Dart/Flutter support
-
Toolchain-specific approaches - When available
- Dart/Flutter analyzer - Comprehensive structure extraction for .dart files
- See code structure guide for Dart/Flutter patterns
- ctags/universal-ctags: Symbol index across languages
- See code structure guide for examples
- Dart/Flutter analyzer - Comprehensive structure extraction for .dart files
-
Read file - Last resort for exploration
- Sometimes necessary to understand structure
Key Principle
Use structure tools to decide what to read, then read selectively.
Don't read 1000-line files blind. Get an outline first, then read the 50 lines you actually need.
Skill Combinations
For Discovery and Exploration
- extracting-code-structure → finding-files: Find files of a specific type, then get structure
- extracting-code-structure → searching-text: Understand structure, then search for specific patterns
- extracting-code-structure → analyzing-code-structure: Get outline, then perform structural refactoring
- extracting-code-structure → querying-json/querying-yaml: Understand API structures before extracting data
In Refactoring Workflows
- extracting-code-structure → fuzzy-selecting → analyzing-code-structure: Interactive selection of components to refactor
- extracting-code-structure → searching-text → replacing-text: Find patterns and perform replacements
For Documentation and Analysis
- extracting-code-structure → analyzing-code: Get statistics for specific code components
- extracting-code-structure → viewing-files: View structure with syntax highlighting
Multi-Skill Workflows
- extracting-code-structure → searching-text → analyzing-code-structure → viewing-files: Complete code analysis and refactoring pipeline
- extracting-code-structure → finding-files → querying-json/querying-yaml: Find and analyze configuration structures
- extracting-code-structure → fuzzy-selecting → replacing-text: Interactive selection and modification of code elements
Integration Examples
# Get structure and find all methods
ast-grep -r 'function $FUNC($$$ARGS) {$$$BODY}' src/ | fzf | cut -d: -f1 | xargs -I {} bat {}
# Understand API and extract usage
yq '.endpoints' api.yml | fzf | ripgrep -A 10 -B 5
Detailed Patterns
For language-specific extraction patterns, ast-grep examples, ctags usage, and integration strategies, load code structure guide when needing:
- Dart/Flutter specific patterns and analyzer usage
- Language-specific extraction strategies
- ctags configuration and usage
- Comprehensive workflow examples
- Tool selection guidance for different languages
04 同仓库更多 Skills
writing-clearly-and-concisely
Use when writing prose humans will read—documentation, commit messages, error messages, explanations, reports, or UI text. Applies Strunk's timeless rules for clearer, stronger, more professional writing.
crafting-effective-readmes
Use when writing or improving README files. Not all READMEs are the same — provides templates and guidance matched to your audience and project type.
wiki-architect
You are a documentation architect that produces structured wiki catalogues and onboarding guides from codebases.
readme
You are an expert technical writer creating comprehensive project documentation. Your goal is to write a README.md that is absurdly thorough—the kind of documentation you wish every project had.
ubiquitous-language
Extract a DDD-style ubiquitous language glossary from the current conversation, flagging ambiguities and proposing canonical terms. Saves to UBIQUITOUS_LANGUAGE.md. Use when user wants to define domain terms, build a glossary, harden terminology, create a ubiquitous language, or mentions "domain model" or "DDD".
technical-writing-style
Enforce clear, direct writing in software development documents including OKRs, PRDs, tech specs, architecture decision records (ADRs), git commit messages, PR descriptions, READMEs, changelogs, runbooks, incident postmortems, API docs, and onboarding guides. Trigger whenever a user asks to write, edit, revise, or review any of these document types. Also trigger when the user says writing "sounds like AI", "feels robotic", "needs polish", or asks to "make it sound more natural" in the context of technical or professional prose. Do not trigger for fiction, poetry, creative writing, academic papers, or legal documents unless the user explicitly asks for a more natural tone.