Skip to content

Claude Code plugin for analyzing Python and TypeScript/JavaScript code structure using AST parsing

License

Notifications You must be signed in to change notification settings

eran-broder/code-structure-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Structure Plugin for Claude Code

Analyze code structure using AST parsing. Extract classes, functions, interfaces, and types from Python and TypeScript/JavaScript files without reading full implementations.

Features

  • Python Support: Full AST analysis using Python's built-in ast module
  • TypeScript/JavaScript Support: Full AST analysis using the TypeScript Compiler API
  • Multiple Output Formats: skeleton, signatures, json, detailed
  • Smart Filtering: Focus on specific classes, interfaces, or functions
  • Token-Efficient: Designed for LLM consumption with minimal context usage

Installation

From GitHub Marketplace

# Add the marketplace
/plugin marketplace add yourusername/code-structure-plugin

# Install the plugin
/plugin install code-structure@code-structure-marketplace

Test Locally

# Test with local plugin directory
claude --plugin-dir ./code-structure-plugin

Skills Included

1. Python Structure (/python-structure)

Analyze Python files using AST parsing.

# Basic usage
python "${CLAUDE_PLUGIN_ROOT}/skills/python-structure/scripts/cli.py" myfile.py

# Get signatures only
python "${CLAUDE_PLUGIN_ROOT}/skills/python-structure/scripts/cli.py" myfile.py --format=signatures

# Focus on a class
python "${CLAUDE_PLUGIN_ROOT}/skills/python-structure/scripts/cli.py" myfile.py --class=MyClass

2. TypeScript Structure (/typescript-structure)

Analyze TypeScript/JavaScript files using the TypeScript Compiler API.

# Basic usage
node "${CLAUDE_PLUGIN_ROOT}/skills/typescript-structure/dist/cli.js" myfile.ts

# Get signatures only
node "${CLAUDE_PLUGIN_ROOT}/skills/typescript-structure/dist/cli.js" myfile.ts --format=signatures

# Focus on an interface
node "${CLAUDE_PLUGIN_ROOT}/skills/typescript-structure/dist/cli.js" myfile.ts --interface=MyInterface

Output Formats

Format Description Best For
skeleton Code outline with ... bodies Quick overview
signatures Just function/method signatures Maximum density
json Structured JSON data Programmatic use
detailed Full structure with docs Documentation

Example Output

Python Skeleton

# models.py (150 lines)
"""Data models for the application."""

from dataclasses import dataclass
from typing import Optional

@dataclass
class User:
    """Represents a user."""
    id: int
    name: str
    email: Optional[str] = None
    def validate(self) -> bool: ...
    def to_dict(self) -> dict: ...

def create_user(name: str, email: str) -> User: ...

TypeScript Skeleton

// services.ts (200 lines)

import { Database } from "./db"
import type { User, Config } from "./types"

export interface ServiceConfig {
  timeout: number
  retries: number
}

export class UserService {
  private db: Database
  constructor(config: ServiceConfig) { ... }
  async getUser(id: string): Promise<User | null> { ... }
  async createUser(data: Partial<User>): Promise<User> { ... }
}

Common Options

Both skills support these options:

Option Description
--format=FORMAT Output format (skeleton, signatures, json, detailed)
--only=TYPE Filter by element type
--class=NAME Focus on specific class
--no-docstrings / --no-jsdoc Omit documentation comments
--line-numbers Show line numbers
--compact Remove blank lines

Requirements

  • Python skill: Python 3.9+ (uses built-in ast module)
  • TypeScript skill: Node.js 18+ (includes TypeScript compiler)

License

MIT

About

Claude Code plugin for analyzing Python and TypeScript/JavaScript code structure using AST parsing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages