Explain Code

VerifiedSafe

Analyze and explain code line by line to understand its logic, functionality, and key concepts.

Sby Skills Guide Bot
DocumentationBeginner
2/28/2026
Claude CodeCursorWindsurfCopilotCodex
#code-explanation#learning#onboarding#code-walkthrough#comprehension

Recommended for

Automated summary

Breaks down a file or code snippet line by line, with a high-level overview, so you can understand and learn from it.

Strengths

  • Enforces a five-step structure: identify the code, overview, line-by-line walkthrough, key concepts, summary
  • The 'what / why / how' format per block makes the explanation pedagogical rather than merely descriptive
  • Explicitly asks for a file path or pasted code when none is given, and scales depth to the request
  • Surfaces design patterns, unfamiliar language features, and potential gotchas

Limitations

  • Does not run or verify the code; explanations rely purely on static reading
  • No whole-repo analysis or cross-file call tracing beyond the immediate context
  • For large files, line-by-line output can become long and repetitive
When to use it

Use it when you encounter unfamiliar or complex code and want a line-by-line walkthrough to understand the logic and learn from it.

When not to use it

Avoid it when you need to fix a bug, refactor, or get a critical review rather than an explanation.

Security analysis

Safe
Quality score84/100

The skill only instructs the assistant to read user-specified code and explain it. It declares no tools and contains no destructive, exfiltration, obfuscation, or safety-disabling behavior.

No concerns found

How this analysis is made

Examples

Explain a file
Explain src/hooks/useAuth.ts line by line so I can understand how the token refresh works.
Explain pasted code
Explain this function I just pasted — what each line does and why it's written that way:

async function retry(fn, attempts = 3) { ... }
Explain a specific range
Explain lines 50-100 of api.ts, focusing on the unfamiliar patterns and any edge cases.

description: Explain what code does line by line so you can understand and learn from it.

Explain Code

Explain what code does, line by line, so you can understand and learn from it.

Instructions

When the user asks you to explain code:

Step 1: Identify the Code

If the user provides a file path, read that file. If they paste code directly, use that.

If no code is specified, ask:

"What code would you like me to explain? Please provide a file path or paste the code."

Step 2: Provide Overview

Start with a high-level summary:

  • What is the purpose of this code?
  • What problem does it solve?
  • How does it fit into the larger application?

Step 3: Walk Through Line by Line

For each significant section, explain:

  • What it does (literally)
  • Why it's needed (purpose)
  • How it works (mechanism)

Use this format:

Lines X-Y: [Brief description]
- This code [what it does]
- It's needed because [why]
- It works by [how]

Step 4: Highlight Key Concepts

Point out important patterns and concepts:

  • Design patterns used
  • Language features that might be unfamiliar
  • Best practices demonstrated
  • Potential gotchas or edge cases

Step 5: Summarize

End with:

  • Key takeaways
  • What the user should understand now
  • Suggestions for further learning if applicable

Example Output

## Overview

This is a React custom hook that manages authentication state. It handles
login, logout, and automatic token refresh.

## Line-by-Line Explanation

### Lines 1-5: Imports
```typescript
import { useState, useEffect, useCallback } from 'react';
import { authApi } from '@/services/api';
import { User } from '@/types';
  • Imports React hooks for state management and side effects
  • Imports the auth API service for making authentication requests
  • Imports the User type for type safety

Lines 7-15: Hook Definition and State

export function useAuth() {
  const [user, setUser] = useState<User | null>(null);
  const [loading, setLoading] = useState(true);
  • Creates a custom hook that can be used in any component
  • user state holds the current user (or null if logged out)
  • loading state tracks whether we're still checking auth status
  • Starting with loading: true prevents flash of unauthenticated content

Lines 17-30: Auto-refresh Effect

[... continue explanation ...]

Key Concepts

  1. Custom Hooks: Reusable logic extracted from components
  2. Optimistic Updates: UI updates before server confirms
  3. Token Refresh: Automatic re-authentication before expiry

Takeaways

  • This hook centralizes all auth logic in one place
  • Components just need to call useAuth() to access auth state
  • The refresh logic runs automatically in the background

## Tips for Users

Ask me to explain:
- "Explain this function" (paste code)
- "Explain src/hooks/useAuth.ts"
- "Explain lines 50-100 of api.ts"
- "What does this regex do?"
- "Why is this pattern used here?"

I'll adjust the depth based on what you ask. For simple code, I'll be brief. For complex code, I'll be thorough.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/explain-code-mm5t89rj/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/explain-code-mm5t89rj' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/explain-code-mm5t89rj/download' --output '.skill-downloads/explain-code-mm5t89rj/SKILL.md.part' && mv '.skill-downloads/explain-code-mm5t89rj/SKILL.md.part' '.skill-downloads/explain-code-mm5t89rj/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/explain-code-mm5t89rj/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills