A reusable teaching skill for AI coding agents and command-line assistants.
The skill helps developers understand code while an AI assistant inspects, explains, debugs, reviews, or modifies a project. Instead of only producing a solution, it guides the learner through the problem, root cause, execution flow, design decisions, edge cases, testing, debugging, and broader application impact.
It is intentionally platform-neutral and can be used with compatible tools that support reusable agent skills or SKILL.md-based instructions.
When explicitly invoked, code-teacher turns a normal coding task into an interactive learning session.
It helps the learner:
- Understand existing code before changing it
- Find the root cause of a bug instead of only applying a patch
- Trace requests, data, and side effects through an application
- Understand business logic and architectural decisions
- Compare reasonable implementation approaches and tradeoffs
- Identify important branches, edge cases, and failure scenarios
- Learn how to test and debug the implementation
- Build enough understanding to safely modify similar code independently
The skill instructs the AI assistant to ask focused questions and wait for the learner's response before continuing.
The skill is designed to work incrementally.
When the assistant asks the learner to:
- Restate their current understanding
- Answer a quiz
- Predict code behavior
- Trace an execution path
- Identify an edge case
- Use logs, tests, or a debugger
- Complete a small exercise
the assistant should stop and wait for the learner's next response.
It should not continue the lesson or answer its own question in the same message.
The assistant should:
- Confirm specifically what was correct
- Add any important missing detail
- Update the mastery checklist
- Continue to the next learning stage
The assistant should:
- Identify what was correct
- Explain the missing or inaccurate part
- Use relevant code, an example, trace, or analogy
- Ask a smaller follow-up question
- Stop and wait again
The assistant should:
- Clearly and respectfully state that the answer is incorrect
- Provide the correct answer
- Explain why the correct answer is correct
- Explain the misunderstanding
- Show relevant code, logs, queries, tests, or debugger evidence
- Ask a new verification question
- Stop and wait before proceeding
The skill guides the learner through these stages:
- Establish the learner's current understanding
- Understand the problem and visible symptom
- Identify the root cause
- Map the relevant files and execution flow
- Trace a realistic example
- Explain the proposed solution and tradeoffs
- Implement the requested change when applicable
- Explore relevant edge cases
- Explain testing and debugging
- Review the broader application impact
- Perform a final mastery check
The session is considered complete only after the learner demonstrates practical understanding of the relevant checklist items.
The skill maintains a running Markdown learning document inside the current project:
docs/learning-session.md
It may contain:
- The topic and learning objective
- Current understanding
- Relevant files
- Execution flow
- Root cause
- Solution
- Design decisions and tradeoffs
- Edge cases
- Testing and debugging notes
- Broader application impact
- Remaining knowledge gaps
- A mastery checklist
- The learner's final explanation
Checklist items should be marked complete only after the learner demonstrates understanding.
code-teacher-skill/
├── SKILL.md
├── README.md
└── LICENSE
This repository is designed for AI coding tools that support one of the following:
- Reusable agent skills
- A
SKILL.mdinstruction file - Global or project-level skill directories
- Explicit skill invocation from a prompt
Directory locations and invocation syntax vary between tools.
Check your tool's documentation to determine:
- Where global skills should be installed
- Whether the skill folder must have a particular name
- How a skill is invoked
- Whether the CLI must be restarted after installation
The skill folder should normally be named:
code-teacher
and contain:
code-teacher/
└── SKILL.md
Clone the repository:
git clone https://github.com/TazShetu/code-teacher-skill.gitThen copy or link the repository, or at minimum its SKILL.md, into the global or project-level skill directory required by your AI coding tool.
A typical result looks like:
<global-skills-directory>/
└── code-teacher/
└── SKILL.md
Restart the CLI if it does not detect the newly installed skill automatically.
For tools that use a global .agents/skills directory:
New-Item -ItemType Directory -Force "$HOME\.agents\skills"
git clone https://github.com/TazShetu/code-teacher-skill.git `
"$HOME\.agents\skills\code-teacher"The skill file will be located at:
C:\Users\TazShetu\.agents\skills\code-teacher\SKILL.md
For tools that use a global .agents/skills directory:
mkdir -p "$HOME/.agents/skills"
git clone https://github.com/TazShetu/code-teacher-skill.git \
"$HOME/.agents/skills/code-teacher"The skill file will be located at:
~/.agents/skills/code-teacher/SKILL.md
- Download
SKILL.md. - Create a folder named
code-teacherinside your tool's global or project-level skills directory. - Place
SKILL.mdinside that folder. - Restart the CLI when required.
- Confirm that the skill appears in the tool's available skills.
Write your normal coding prompt and invoke the skill using the syntax supported by your tool.
A common invocation style is to add the skill name at the bottom of the prompt:
Fix the N+1 query issue when loading templates with fonts and categories.
Inspect the current relationships, identify the source of the repeated
queries, implement a readable framework-native solution, and add a test.
$code-teacher
The assistant should begin by asking about your current understanding and then wait for your answer.
For tasks where teaching mode is not needed, omit the skill invocation:
Fix the typo in the validation message.
No permanent activation is required when the tool supports per-prompt skill invocation.
You:
Explain and fix the duplicate order creation issue.
$code-teacher
Assistant:
Before we inspect the complete flow, what do you currently think causes
the duplicate orders, and under what condition do they appear?
The assistant should stop and wait for your response.
When your answer is incorrect, it should explain the correct reasoning and verify your understanding with another focused question before proceeding.
During a session, the learner can request:
ELI5— a simple analogy with minimal terminologyELI14— a beginner-friendly technical explanationELII— an explanation suitable for an intern or junior developerSenior— architecture, tradeoffs, performance, security, maintainability, and failure modes
After using an analogy, the assistant should reconnect it to the actual code.
The skill includes additional guidance for Laravel and Livewire projects, including:
- Routes and route model binding
- Middleware
- Form Requests and validation
- Policies and authorization
- Controllers and Livewire components
- Services and action classes
- Eloquent relationships and eager loading
- N+1 query detection
- Transactions
- Events, listeners, queues, retries, and idempotency
- Cache keys and invalidation
- API Resources
- Exceptions and configuration
- Feature and unit testing
- Livewire state, lifecycle hooks, hydration, events, and rerendering
The skill prefers readable, framework-native solutions and modern conventions.
Pull the latest repository changes from the installed skill directory.
git -C "$HOME\.agents\skills\code-teacher" pullgit -C "$HOME/.agents/skills/code-teacher" pullRestart the CLI if updated instructions are not detected automatically.
Remove the code-teacher folder from the skill directory used by your tool.
Remove-Item -Recurse -Force "$HOME\.agents\skills\code-teacher"rm -rf "$HOME/.agents/skills/code-teacher"This skill provides strong behavioral instructions, but it is not a technically enforced state machine.
AI assistants may occasionally continue after asking a question. When that happens, remind the assistant:
Follow the mandatory interaction rules in $code-teacher.
You asked a question, so stop and wait for my answer.
Contributions are welcome.
Useful improvements may include:
- Better mastery checks
- Additional debugging exercises
- Support for more languages and frameworks
- More effective question patterns
- Tool-specific installation examples
- Reduced repetition during long sessions
Keep changes practical, incremental, and focused on demonstrated understanding.
This project is licensed under the MIT License. See LICENSE for details.
This is a community-created skill. It is not an official project of any AI tool vendor.