From latestaiagents
Use this skill when generating explanations for code. Activate when the user needs to understand complex code, wants to document how something works, needs to explain code to others, is onboarding to a new codebase, or wants to create educational content about code.
npx claudepluginhub latestaiagents/agent-skills --plugin skills-authoringThis skill uses the workspace's default tool permissions.
Generate clear explanations for complex code to aid understanding and knowledge transfer.
Explains complex code with high-level overviews, step-by-step walkthroughs, diagrams, and audience-adapted language for onboarding and knowledge sharing.
Explains complex code, algorithms, system behaviors, and architectures with narratives, visual diagrams, and step-by-step breakdowns for onboarding, learning, and debugging reasoning.
Explains complex code, algorithms, system behaviors, and architectures with narratives, visual diagrams, and step-by-step breakdowns for all developer levels.
Share bugs, ideas, or general feedback.
Generate clear explanations for complex code to aid understanding and knowledge transfer.
| Level | Audience | Focus |
|---|---|---|
| Beginner | Junior devs, non-technical | What it does, simple terms |
| Intermediate | Mid-level devs | How it works, patterns used |
| Expert | Senior devs, architects | Why decisions made, trade-offs |
Explain this code for someone new to programming:
```[paste code]```
- Use simple, non-technical language
- Explain what the code accomplishes
- Use real-world analogies
- Avoid jargon or define terms used
Explain how this code works:
```[paste code]```
Include:
- Step-by-step execution flow
- Design patterns used
- Key functions and their purposes
- How components interact
Provide an architectural analysis of this code:
```[paste code]```
Cover:
- Design decisions and alternatives
- Performance characteristics
- Trade-offs made
- Potential improvements
- Edge cases and limitations
AI Prompt:
Add explanatory comments to each significant line of this code:
```[paste code]```
Comments should explain WHY, not WHAT (the code shows what).
Output:
// Debounce user input to prevent excessive API calls
const debouncedSearch = useMemo(
// Create a new debounced function only when delay changes
() => debounce((query: string) => {
// Skip empty queries to avoid unnecessary requests
if (!query.trim()) return;
// Trigger the actual search with the debounced value
onSearch(query);
}, delay),
[delay, onSearch] // Recreate when these dependencies change
);
AI Prompt:
Describe the flow of this code in a way that could be drawn as a flowchart:
```[paste code]```
Use this format:
1. [Start] → description
2. [Decision] condition? → Yes: action / No: action
3. [Process] what happens
4. [End] final state
Output:
1. [Start] User submits login form
2. [Process] Extract email and password from form
3. [Decision] Is email valid format?
→ No: Display email error, return to form
→ Yes: Continue
4. [Decision] Is password >= 8 characters?
→ No: Display password error, return to form
→ Yes: Continue
5. [Process] Send credentials to auth API
6. [Decision] Did API return success?
→ No: Display error message, return to form
→ Yes: Continue
7. [Process] Store auth token in secure storage
8. [Process] Redirect to dashboard
9. [End] User is logged in
AI Prompt:
Identify the key concepts in this code and how they relate:
```[paste code]```
Format as:
- Main Concept
- Related concept 1 (relationship)
- Related concept 2 (relationship)
Output:
- AuthContext (Central state management)
- User object (stores current user data)
- isAuthenticated (derived from user presence)
- login() (updates user, triggers redirect)
- logout() (clears user, clears storage)
- AuthProvider (React context provider)
- Wraps application (provides context to children)
- Manages state (useState for user)
- Handles persistence (localStorage sync)
- useAuth hook (Consumer interface)
- Accesses context (useContext internally)
- Provides type safety (typed return value)
Explain this algorithm:
```[paste algorithm code]```
Include:
1. What problem it solves
2. Time and space complexity
3. Step-by-step walkthrough with example
4. When to use vs alternatives
Explain this React component:
```[paste component]```
Cover:
1. Component purpose
2. Props and their uses
3. State management approach
4. Lifecycle (effects, cleanup)
5. Render logic
Explain this API endpoint:
```[paste route handler]```
Include:
1. What the endpoint does
2. Request format (method, body, params)
3. Response format
4. Error cases
5. Authentication/authorization
Explain this SQL/ORM query:
```[paste query]```
Cover:
1. What data it retrieves/modifies
2. Tables involved and relationships
3. Filtering and sorting logic
4. Performance considerations
5. Potential issues (N+1, etc.)
## `functionName(params)`
### Purpose
[What this function does and why it exists]
### Parameters
| Name | Type | Description |
|------|------|-------------|
| param1 | string | Description |
| param2 | number | Description |
### Returns
`ReturnType` - Description of return value
### Example
```javascript
const result = functionName('value', 42);
// result: { ... }
### Component Documentation
```markdown
## ComponentName
### Purpose
[What this component renders and its role in the app]
### Props
| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| prop1 | string | Yes | - | Description |
| prop2 | boolean | No | false | Description |
### Usage
```jsx
<ComponentName prop1="value" prop2={true} />
## Onboarding Guides
### AI Prompt for Onboarding Doc
```markdown
Create an onboarding guide for this module:
```[paste module code]```
The guide should help a new developer:
1. Understand the module's purpose
2. Know the key files and their roles
3. Understand how to make common changes
4. Know what to test after changes
After generating explanations: