Analyze Code
SKILL.md
Analyze Code Skill
Extract implementation details from code repositories to write accurate methodology and experiment sections. Acts as a Code Analyst that understands code structure and translates it to paper descriptions.
Overview
This skill helps you:
- Understand code structure and key components
- Extract algorithms and architectures
- Generate pseudo-code from implementations
- Map code to methodology descriptions
- Extract hyperparameters and configurations
Commands
/analyze-code [--section <section>]
Extract implementation details from code.
Parameters:
--section <section>(optional): Target paper section (e.g.,methodology,experiments)
Section Options:
methodology: Extracts algorithms, architectures, training proceduresexperiments: Extracts evaluation setup, metrics, configurations
Analysis Capabilities
Structure Analysis
- File organization and key components
- Dependencies and imports
- Main entry points and workflows
Implementation Extraction
- Algorithms: Step-by-step algorithm descriptions
- Architectures: Model structures and components
- Data Pipelines: Data loading and preprocessing
- Training Procedures: Training loops and optimization
Pseudo-code Generation
- Converts code to LaTeX algorithm blocks
- Extracts key steps and logic
- Preserves algorithm flow
Hyperparameters and Configuration
- Extracts hyperparameter values
- Identifies configuration files
- Documents training settings
Code Elements Mapped to Paper Descriptions
| Code Element | Paper Description |
|---|---|
| Class definitions | Component descriptions |
| Forward pass | Algorithm steps |
| Hyperparameters | Paper configs |
| Loss functions | Training objectives |
| Data loaders | Dataset processing |
| Evaluation code | Experimental setup |
Examples
# Analyze for methodology section
/analyze-code --section methodology
# Analyze for experiments section
/analyze-code --section experiments
# General code analysis
/analyze-code
Workflow
- Add Code: Link repository or directory (can be done via codebase context)
- Analyze: Run
analyze-codeto extract details - Integrate: Use output to write Methodology section with
write-section
Output Format
Returns:
- Natural language description of implementation
- LaTeX algorithm environment code (for methodology)
- Key hyperparameters and configuration
- Training/evaluation procedure description (for experiments)
Integration with Writing
After analysis, use the output with write-section:
# 1. Analyze code
/analyze-code --section methodology
# 2. Write methodology using code analysis
/write-section methodology --from code/ --from notes/implementation/
Supported Code Types
- Python (most common)
- Configuration files (YAML, JSON)
- Training scripts
- Model definitions
- Evaluation code
Platform Compatibility
Works on all platforms (Claude Code, Codex, OpenCode, Gemini, Cursor). Command syntax may vary by platform - see platform-specific documentation in docs/.