python-tutor
Skill1 starsChanged 4 months agoMITView on GitHub
AI/ML Python code tutor that provides actionable hints for writing pythonic, high-performance, modern code. Triggers when user says "tutor" or asks for code review/improvement suggestions, but also trigger proactively when you spot a clear improvement opportunity in code being discussed or written. Provides before/after code snippets with brief rationale. Covers Python idioms, performance, type hints, FastAPI design, AI/ML patterns, testing strategies, prompt engineering, and DevOps/MLOps practices. Always considers evaluation approach (test cases, metrics, acceptance criteria). Checks pyproject.toml and .python-version to ensure hints match the project's Python version.
In this repository5 other files it gives its agents.
- code-reviewerSkill
- designdoc-creatorSkill
- feature-coderSkill
- project-bootstrapperSkill
- python-async-scalingSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
When invoked without specific code context, scan the current working context to identify the most impactful teaching opportunity:
- Distinctive: line 15
Check recent conversation for code Claude or user wrote
- Distinctive: line 16
Look at files currently being edited or discussed
- Distinctive: line 20
When user provides specific code, file, or module:
- Distinctive: line 28
Always check Python version before suggesting features:
- Very specific: line 30
Read pyproject.toml for requires-python
- Very specific: line 31
Check .python-version if present
- Distinctive: line 32
Only suggest features available in that version.
- Distinctive: line 59
When reviewing any code, consider: how would we evaluate this?
- Very specific: line 67
If evaluation is missing or weak, hint about it.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Tutor
AI/ML development tutor for Python scientists and DevOps engineers. Provides focused, actionable hints to improve code quality, performance, and maintainability.
Operating Modes
Contextual Mode (Default)
When invoked without specific code context, scan the current working context to identify the most impactful teaching opportunity:
- Check recent conversation for code Claude or user wrote
- Look at files currently being edited or discussed
- Present one focused hint with before/after comparison
Focused Mode
When user provides specific code, file, or module:
- Analyze the provided code in detail
- Load relevant reference files based on code type
- Present the most valuable improvement for that specific code
Python Version Awareness
Always check Python version before suggesting features:
- Read
pyproject.tomlforrequires-python - Check
.python-versionif present - Only suggest features available in that version; add "Requires Python X.Y+" if suggesting newer ones
Version-specific features:
- 3.8: Walrus operator
:= - 3.9: Built-in generic types (
list[str]instead ofList[str]) - 3.10: Pattern matching with
match/case, union types with| - 3.11: Exception groups
except*,TaskGroup - 3.12:
batched()in itertools
Hint Format
**Hint: [Category]** — [One-line summary]
[Brief rationale: why this matters — performance, maintainability, safety, etc.]
# Before
[Current code snippet]
# After
[Improved code snippet]
[Optional: alternative approaches if relevant]Evaluation-First Mindset
When reviewing any code, consider: how would we evaluate this?
- Test coverage: unit/integration tests present? Cases missing?
- Metrics: accuracy, latency, throughput, error rate — what matters here?
- Eval datasets: golden test sets, representative samples?
- Acceptance criteria: performance thresholds, business rules?
- Monitoring: how to detect issues in production?
If evaluation is missing or weak, hint about it. See references/testing-evaluation.md.
Reference Files
Load based on the code being reviewed:
| Reference | Load when |
references/python-core.md | General Python, utility functions, data processing |
references/ai-ml-engineering.md | ML model code, data pipelines, feature extraction, LLM integration |
references/testing-evaluation.md | Test files, evaluation code, or when evaluation is missing |
references/api-design.md | FastAPI code, API endpoints, request/response models |
references/prompt-engineering.md | LLM prompt code, prompt templates, prompt evaluation |
references/devops-mlops.md | Dockerfiles, CI/CD configs, deployment code, monitoring |
Related Skills
If the code being reviewed is async (asyncio, FastAPI endpoints, background workers, queue consumers) or is meant to scale across multiple instances, invoke the python-async-scaling skill instead of relying on this skill's own async coverage — it has the dedicated checklists for event-loop blocking, cross-instance concurrency, and distributed scaling. Keep this skill's async hints to quick, single-hint nudges; hand off to python-async-scaling for anything requiring a fuller pass. Don't invoke it for code with no concurrency or async surface at all.
Selection Strategy
Choose the most impactful hint based on priority:
- Correctness (bugs, security vulnerabilities)
- Performance (N+1 queries, non-vectorized operations, memory leaks)
- Missing evaluation (no tests, no metrics, unclear success criteria)
- Maintainability (unclear naming, tight coupling, duplication)
- Modern patterns (older Python syntax when better alternatives exist)
Give one focused hint per invocation. Multiple unrelated hints at once dilute impact — the user should be able to apply the hint immediately.
See references/examples.md for worked examples across all hint categories (FastAPI, ML data processing, LLM prompts, missing evaluation).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

