code-explainer

द्वारा microsoft

Explains code snippets in plain English, breaking down what the code does step by step. Perfect for learning, code reviews, or documentation.

npx skills add https://github.com/microsoft/waza --skill code-explainer

Code Explainer

A skill that explains code snippets in clear, educational language. Helps developers understand unfamiliar code, algorithms, and programming patterns.

Skill Activation Triggers

Use this skill immediately when the user asks to:

  • "Explain this code"
  • "What does this function do?"
  • "Break down this algorithm"
  • "Help me understand this snippet"
  • "Walk me through this code"
  • "What's happening in this file?"

Key Indicators:

  • User shares a code snippet and asks for explanation
  • User is confused about existing code
  • User wants to learn how something works
  • User asks "what does X do?" about code

Do NOT use when:

  • User wants to write new code
  • User wants to fix a bug
  • User wants code review with suggestions
  • User wants refactoring recommendations

Quick Reference

PropertyValue
InputCode snippet + optional language hint
OutputPlain language explanation
Best forLearning, onboarding, code comprehension

Explanation Guidelines

Structure

A good code explanation should include:

  1. Overview - One sentence summary of what the code does
  2. Step-by-step breakdown - Walk through the logic
  3. Key concepts - Explain any patterns or techniques used
  4. Example - Show sample input/output if applicable

Tone

  • Educational and approachable
  • Avoid jargon unless explaining it
  • Use analogies when helpful
  • Assume the reader is smart but unfamiliar with this specific code

Language-Specific Tips

LanguageFocus On
PythonList comprehensions, decorators, generators
JavaScriptAsync/await, closures, callbacks
SQLJOINs, subqueries, aggregations
JavaOOP patterns, generics, streams

Examples

Example 1: Python Recursion

User prompt:

Explain this code:
```python
def factorial(n):
    if n <= 1:
        return 1
    return n * factorial(n - 1)

Good response:

This is a recursive function that calculates the factorial of a number.

Overview: It multiplies a number by all positive integers less than it (e.g., 5! = 5 × 4 × 3 × 2 × 1 = 120).

Step by step:

  1. Base case (if n <= 1): If n is 0 or 1, return 1 (since 0! and 1! both equal 1)
  2. Recursive case: Otherwise, multiply n by factorial(n-1)

Example: factorial(4) → 4 × factorial(3) → 4 × 3 × factorial(2) → 4 × 3 × 2 × factorial(1) → 4 × 3 × 2 × 1 = 24

Example 2: JavaScript Async/Await

User prompt:

What does this code do?
```javascript
async function fetchUserData(userId) {
  try {
    const response = await fetch(`/api/users/${userId}`);
    if (!response.ok) throw new Error('User not found');
    return await response.json();
  } catch (error) {
    console.error('Failed:', error);
    return null;
  }
}

Good response:

This is an async function that fetches user data from an API.

Overview: It makes an HTTP request to get a user's data, handles errors gracefully, and returns the result as JSON.

Step by step:

  1. async function - Declares this function will use await for promises
  2. await fetch(...) - Makes HTTP GET request, waits for response
  3. if (!response.ok) - Checks if request succeeded (status 200-299)
  4. await response.json() - Parses response body as JSON
  5. catch block - If anything fails, logs error and returns null

Key pattern: This is the standard async/await pattern for API calls with error handling.

Error Cases

If the user provides:

  • No code: Ask them to share the code they want explained
  • Incomplete code: Explain what you can see and note what's missing
  • Non-code text: Clarify you need actual code to explain

Integration Notes

This skill works well with:

  • File reading tools (to access code from files)
  • Language detection (to tailor explanations)
  • Search tools (to find related documentation)

microsoft की और Skills

oss-growth
microsoft
OSS ग्रोथ हैकर व्यक्तित्व
official
accessibility-aria-expert
microsoft
React/Fluent UI वेबव्यू में पहुँच संबंधी समस्याओं का पता लगाता है और उन्हें ठीक करता है। स्क्रीन रीडर संगतता के लिए कोड की समीक्षा करते समय, ARIA लेबल ठीक करते समय, सुनिश्चित करते समय उपयोग करें…
official
generate-canvas-app
microsoft
[पुराना हो चुका है — इसके बजाय canvas-app का उपयोग करें] एक पूर्ण Power Apps कैनवास ऐप जनरेट करें।
official
django
microsoft
Django वेब डेवलपमेंट के लिए सर्वोत्तम अभ्यास जिसमें मॉडल, व्यू, टेम्पलेट और परीक्षण शामिल हैं।
official
github-issue-creator
microsoft
कच्चे नोट्स, एरर लॉग्स, वॉइस डिक्टेशन या स्क्रीनशॉट को साफ-सुथरे GitHub-फ्लेवर्ड मार्कडाउन इश्यू रिपोर्ट्स में बदलें। तब उपयोग करें जब उपयोगकर्ता बग जानकारी, एरर…
official
python-package-management
microsoft
निर्भरता प्रबंधन के लिए uv और कार्य स्वचालन के लिए poethepoet का उपयोग करता है।
official
runtime-validation
microsoft
माइग्रेटेड एप्लिकेशन के लिए रनटाइम सत्यापन — परीक्षण रणनीति (योजना चरण) और परीक्षण निष्पादन (सत्यापन चरण) को शामिल करता है: स्टार्टअप सत्यापन,…
official
azure-postgres-ts
microsoft
Azure Database for PostgreSQL Flexible Server से pg (node-postgres) पैकेज का उपयोग करके कनेक्ट करें, जिसमें पासवर्ड और Microsoft Entra ID (पासवर्डलेस) प्रमाणीकरण के लिए समर्थन है।
official