Skip to content
Back to skills

Code Structure

ASecurity

Extract file structure (functions, classes, exports) efficiently without reading entire files, using ast-grep, go doc, ctags, or other language-specific tools to get outlines and signatures

  • 666 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 8, 2026
developmentpythongoapi

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill code-structure --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Structure?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Structure
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-code-structure/badge)](https://www.skillsdirectory.com/skills/majiayu000-code-structure)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-structure
description: Extract file structure (functions, classes, exports) efficiently without reading entire files, using ast-grep, go doc, ctags, or other language-specific tools to get outlines and signatures
---

# Code Structure Exploration Tools

## 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" (Go)
- "what's available in..."

**These keywords mean use search (Grep tool or ast-grep):**
- "where is X defined"
- "find calls to X"
- "search for pattern Y"

## Before You Choose a Tool

Ask yourself:
1. Am I listing/exploring what exists? → Structure tools
2. Am I finding WHERE something is? → Search tools (Grep or ast-grep)
3. 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
- ast-grep 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.

## Exploration Strategy

**Tiered approach (try in order):**

1. **ast-grep with known patterns** - Fast, targeted
   - Extract exports, functions, classes with specific patterns
   - See [code structure guide](./reference/code-structure-guide.md) for patterns

2. **Toolchain-specific approaches** - When available
   - **Go:** `go doc -all <package>` for all methods/functions with signatures
     - Example: "list all methods" → `go doc -all ./internal/pkg`
     - Example: "method signatures" → `go doc -all ./internal/pkg`
   - **Python:** Language-specific indexers
   - **ctags/universal-ctags:** Symbol index across languages
   - See [code structure guide](./reference/code-structure-guide.md) for examples

3. **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.

## Detailed Patterns

For language-specific extraction patterns, ast-grep examples, ctags usage, and integration strategies, load [code structure guide](./reference/code-structure-guide.md).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.