Generate concise summaries of source code at multiple scales. Use when users ask to summarize, explain, or understand code - whether it's a single function, a class, a module, or an entire codebase. Handles function-level code by explaining intention and core logic, and large codebases by providing high-level overviews with drill-down capabilities for specific modules.
84
77%
Does it follow best practices?
Impact
94%
1.11xAverage score across 3 eval scenarios
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/code-summarizer/SKILL.mdGenerate clear, concise summaries of source code at any scale - from individual functions to entire codebases.
This skill helps analyze and summarize code by adapting the level of detail to the code's scale:
User provides code → Assess scale
├─ Small-scale (< 200 lines, single file/function)
│ └─ Generate focused summary
│
└─ Large-scale (> 200 lines, multiple files/modules)
├─ Generate high-level overview
├─ List main modules/components
└─ Prompt user to select specific parts for detailed analysisFor functions, classes, or small files (typically < 200 lines), provide a focused summary that includes:
Purpose Statement (1-2 sentences)
Core Logic (2-4 bullet points)
Key Details
Notable Patterns (if applicable)
## Summary
**Purpose**: This function validates user email addresses and normalizes them to lowercase format before database storage.
**Core Logic**:
- Uses regex pattern matching to validate email format (RFC 5322 compliant)
- Strips whitespace and converts to lowercase for consistency
- Checks against a blocklist of disposable email domains
- Logs validation failures for security monitoring
**Key Details**:
- Input: `email` (string) - raw email address from user input
- Returns: `normalized_email` (string) or raises `ValidationError`
- Side effect: Logs to `security.log` on validation failure
- Dependencies: `re`, `logging`, custom `EmailBlocklist` class
**Notable Patterns**:
- Uses early return pattern for validation failures
- Implements defensive programming with input sanitizationFor modules, packages, or entire repositories (typically > 200 lines or multiple files), use a hierarchical approach:
Provide a concise overview that includes:
Project Purpose (2-3 sentences)
Architecture Overview
Main Components (list with brief descriptions)
Entry Points
After providing the overview, prompt the user to select specific areas for detailed analysis:
## Detailed Analysis Available
I can provide more detailed summaries of specific components:
1. **[Component Name]** - [Brief description]
2. **[Component Name]** - [Brief description]
3. **[Component Name]** - [Brief description]
...
Which component(s) would you like me to analyze in detail? You can:
- Select one or more by number
- Ask about specific functionality (e.g., "How does authentication work?")
- Request a specific file or module by nameWhen user selects a component, provide a detailed summary using the small-scale format adapted for the component:
Read strategically
Identify patterns
Focus on intent over implementation
Adapt terminology and patterns to the language:
User: "Can you summarize this repository?"
Response approach:
User: "What does this function do?" [provides code]
Response approach:
User: "Summarize these two implementations and compare them"
Response approach:
User: "Help me understand this old code"
Response approach:
Use clear markdown with:
Use structured markdown with:
When referencing specific code elements:
backticks for function/class/variable namessrc/utils/validator.py:validate_email()lines 45-67When encountering limitations, acknowledge them and offer alternative approaches or ask for additional context.
0f00a4f
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.