explain
Explain Code
Provide a clear, thorough explanation of the specified code.
Input
The user will provide one of:
- A file path:
/explain src/auth/jwt.ts - A file path with line range:
/explain src/auth/jwt.ts:45-80 - A function/class name:
/explain parseToken - Just
/explain— explain the currently open or most recently discussed file
Explanation Structure
1. Overview (2-3 sentences)
What does this code do at a high level? What problem does it solve?
2. Key Components
Break down the major parts:
## Function: functionName
**Purpose:** One sentence description
**Parameters:**
- `param1` (type) — what it's for
- `param2` (type) — what it's for
**Returns:** What and when
**Side effects:** Any mutations, API calls, state changes
3. Control Flow
Explain the execution path:
- First, it does X
- Then checks Y
- If Y is true, Z happens
- Otherwise, W happens
Use a simple flowchart for complex logic:
Input -> Validate -> Transform -> Output
|
Error -> Log -> Return null
4. Dependencies
What does this code depend on?
- External libraries
- Internal modules
- Environment variables
- Database/API connections
5. Gotchas & Edge Cases
Things that might surprise someone:
- Non-obvious behavior
- Edge cases handled (or not handled)
- Performance considerations
- Known limitations
6. Usage Example
Show how to use this code:
// Example usage
const result = functionName(arg1, arg2);
Tone
- Assume the reader is a competent developer unfamiliar with this specific code
- Avoid jargon unless defining it
- Use "this code" not "the code" for clarity
- Be concise but complete
More from toilahuongg/shopify-agents-kit
shopify-polaris-icons
Guide for using Shopify Polaris Icons in Shopify Apps. Covers icon usage patterns, accessibility, tone variants, and common icon categories for commerce applications.
19email-template-design
Design and build professional HTML email templates with inline CSS for broad email client compatibility. Use this skill when the user asks to create, design, or build email templates, newsletters, transactional emails (order confirmations, receipts, shipping notifications, password resets), marketing emails, welcome series, onboarding emails, abandoned cart emails, drip campaigns, or any HTML email layout. Covers responsive design, dark mode support, and compatibility with Gmail, Outlook (desktop + web), Apple Mail, Yahoo, and mobile clients.
18shopify-extensions
Guide for building and managing Shopify Extensions (Admin, Checkout, Theme, Post-purchase, etc.) using the latest Shopify CLI and APIs.
14shopify-api
Comprehensive guide for Shopify APIs in Remix apps. Covers Admin GraphQL/REST, Storefront API, all resources (products, orders, customers, inventory, collections, discounts, fulfillments, metafields, files), bulk operations, webhooks, resource pickers, and TypeScript patterns. Use when querying/mutating Shopify data or building integrations.
14shopify-polaris-viz
Guide for creating data visualizations in Shopify Apps using the Polaris Viz library. Use this skill when building charts, graphs, dashboards, or any data visualization components that need to integrate with the Shopify Admin aesthetic. Covers BarChart, LineChart, DonutChart, SparkLineChart, and theming.
13code-investigator
Comprehensive code investigation and audit tool. Discovers all project features, then dispatches parallel subagents to analyze issues, risks, dead code, missing functionality, and redundancies. Produces a prioritized risk report. Use this skill when the user asks to "investigate code", "audit project", "find risks", "check code quality", "analyze codebase", "what's wrong with this code", "project health check", "code review entire project", "find dead code", "find redundant code", or any request for a thorough codebase analysis.
11