Explain a concept with code
Explains a programming concept through the problem it solves, a minimal runnable example, a common mistake and a quick self-check, pitched at the learner's level. Use to learn or teach a concept.
People understand a concept when they see the problem it solves before the solution, run a small example, and then see it break in a realistic way. Definitions alone do not stick, and analogies mislead when they are stretched. The example is the core of the explanation, so it has to run exactly as written.
Explain to a learner at the levelOnly if [LANGUAGE] is given: , with examples in .
- Give a one-sentence definition in plain words.
- Show the problem first: a few lines of code that are awkward, buggy or slow without the concept.
- Show the same code using the concept: a minimal, complete, runnable example with imports and a
mainor entry point if the language needs one, and the expected output as a comment. - Walk through how it works, step by step, referring to specific lines. For beginner, define every new term; for expert, go to the mechanism (memory, scheduling, complexity, the spec) and skip the basics.
- Show one common mistake with the concept, what happens, and the fix.
- Say when not to use it, and what to use instead.
- End with two short questions the learner can answer to check understanding, with answers after a separator.
- The examples must run as written on a current stable version of the language. State the version or runtime if behaviour depends on it.
- If the concept is used differently in different languages, say so in one line and stay with the language of the examples.
- Use at most one analogy, and say where it stops being accurate.
- Do not claim performance numbers without saying they depend on the workload.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
Markdown with these ## headings, in order: In one sentence, Why it exists, Example, How it works, Common mistake, When not to use it, Check yourself.
Code blocks have a language tag. Keep each example under 30 lines.
1 required value still a placeholder; the assistant will ask for it.
details
- kind
- Prompt: a task you run by name to get one finished thing back
- domain
- Software engineering
- category
- Learning to code
- level
- Beginner
- made for
- Software engineer, Student
- risk
- read-only
- version
- v1.0.0 · experimental
- reviewed
- 2026-10-02
- works in
- Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md, ChatGPT, claude.ai
use in
npx @hermes-hq/hodios install explain-concept-with-code --target claude-codenpx skills add hermes-hq/hodios-dist --skill explain-concept-with-code -a claude-codeclaude plugin marketplace add hermes-hq/hodios-distclaude plugin install hodios-software-engineering@hodiosThe plugin brings every entry in this domain at once.
pairs well with
All of Learning to codeSocratic tutor
Tutors by asking guiding questions and giving graded hints instead of answers, so the learner reaches the solution and can explain it. Use for studying, homework help and learning to code.
socratic-tutorBeginner friendly
Adapts answers for newcomers by defining jargon, explaining why each step matters and avoiding assumed knowledge, from light glossing to full guidance. Use when the reader is new to the topic.
beginner-friendlyExplain a codebase
Explains an unfamiliar codebase. Maps its structure, traces one real request end to end and names the concepts and gotchas a newcomer needs. Use when joining a project or reading an unknown repo.
explain-codebaseExplain a SQL query
Explains a complex SQL query clause by clause in logical execution order, shows intermediate results on a tiny example, and points out bugs and performance traps. Use when inheriting a query.
explain-sql-queryPlan a learning path for a technology
Builds a week-by-week plan to get productive in a new language, framework or tool, built around hands-on milestones and skipping what the learner already knows. Use when picking up a new stack.
plan-learning-pathCoding mentor
Acts as a senior developer mentoring a junior, asking what they tried, explaining the why behind fixes and reviewing code to teach. Use for early-career developers who want to grow.
coding-mentor