/core-skills:explain-codefrom core-skills
Explain code snippets at varying depths, from one-liners to architectural intent and design trade-offs.
Ships in core-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use explain-code when:
Map depth to model tier:
brief → haiku (one-liner)detailed (default) → sonnet (functional explanation)architectural → opus (intent, patterns, trade-offs)Explain "what" before "why": Start with observable behavior, then reasoning
Highlight non-obvious decisions: Async/await rationale, error handling philosophy, performance implications
For architectural depth:
Provide context clues: Variable names, return types, external dependencies
{
"code": "async function fetchWithRetry(url, maxRetries = 3) {\n let lastError;\n for (let i = 0; i < maxRetries; i++) {\n try {\n return await fetch(url);\n } catch (err) {\n lastError = err;\n await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));\n }\n }\n throw lastError;\n}",
"depth": "detailed"
}
This function fetches a URL with exponential backoff retry logic.
**What it does:**
1. Attempts to fetch a URL up to `maxRetries` times (default 3)
2. On fetch failure, waits before retrying: 1s, 2s, 4s (exponential backoff via 2^i)
3. Returns the successful fetch response immediately
4. Throws the last error if all retries exhaust
**Why it matters:**
- Retries handle transient network failures (flaky endpoints, temporary timeouts)
- Exponential backoff prevents overwhelming a struggling server with rapid re-requests
- Matches real-world best practice for API resilience (e.g., AWS, Firebase SDKs)
**Code flow:**
- Loop index `i` drives both retry count and backoff calculation
- `lastError` captures the final exception for rethrow if all attempts fail
- `Promise` + `setTimeout` creates the backoff delay
This function implements the **Retry with Exponential Backoff** pattern for network resilience.
**Architectural Intent:**
The design trades simplicity for robustness. Instead of failing instantly on network errors, it assumes transient failures (DNS hiccup, temporary 503) are recoverable. By waiting increasingly long between retries (1s → 2s → 4s), it:
1. Gives the remote server time to recover from load
2. Reduces noise on the wire (fewer rapid retries = less server strain)
3. Maintains user-facing availability for most real-world scenarios
**Pattern Recognition:**
- **Exponential Backoff**: `Math.pow(2, i) * 1000` is a standard resilience primitive
- **Circuit Breaker compatible**: Could be wrapped with a fallback endpoint if all retries fail
- **Jitter candidate**: Production systems often add random jitter (`Math.random()`) to prevent thundering herd
**Trade-offs:**
- ✓ Handles transient failures transparently
- ✓ Follows HTTP/gRPC best practices
- ✗ Increases latency on the happy path (always waits for first attempt before retry)
- ✗ Doesn't distinguish between timeout (worth retrying) vs 404 (not worth retrying)
**Fit in larger system:**
Typically used in API clients (REST, gRPC, database connections). Pairs well with timeout middleware, request queuing, and monitoring dashboards that track retry rates. High retry rates signal upstream problems.
**Maintenance risk:**
- `maxRetries` default of 3 may be too aggressive for slow networks; consider making it configurable per call
- No jitter means synchronized retries across concurrent requests; add `Math.random() * 0.1 * Math.pow(2, i)` for distribution
{
"code": "def fibonacci(n):\n return fibonacci(n-1) + fibonacci(n-2) if n > 1 else n",
"depth": "brief"
}
Recursive Fibonacci: slow (O(2^n)) but elegant. Use memoization or DP for production.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub internet-dot/ai-config-os --plugin core-skills35 skills in this plugin
/autoresearchAutonomously optimise any skill by running it repeatedly, scoring outputs against
binary evals, mutating the prompt, and keeping improvements. Based on Karpathy's
autoresearch methodology.
Use when: "optimise this skill", "improve this skill", "run autoresearch on",
"make this skill better", "self-improve skill", "benchmark skill", "eval my skill",
"run evals on". Outputs: an improved SKILL.md copy, a results log, and a changelog
of every mutation tried.
/changelogWhen to useGenerate structured changelog entries from git history, grouping commits by conventional prefix and flagging breaking changes./