agentleFS
konrad-wojkonrad-woj/skillset/python-tutor/SKILL.md

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.

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
  1. Distinctive:

    When invoked without specific code context, scan the current working context to identify the most impactful teaching opportunity:

    line 13
  2. Distinctive:

    Check recent conversation for code Claude or user wrote

    line 15
  3. Distinctive:

    Look at files currently being edited or discussed

    line 16
  4. Distinctive:

    When user provides specific code, file, or module:

    line 20
  5. Distinctive:

    Always check Python version before suggesting features:

    line 28
  6. Very specific:

    Read pyproject.toml for requires-python

    line 30
  7. Very specific:

    Check .python-version if present

    line 31
  8. Distinctive:

    Only suggest features available in that version.

    line 32
  9. Distinctive:

    When reviewing any code, consider: how would we evaluate this?

    line 59
  10. Very specific:

    If evaluation is missing or weak, hint about it.

    line 67

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

  1. Check recent conversation for code Claude or user wrote
  2. Look at files currently being edited or discussed
  3. Present one focused hint with before/after comparison

Focused Mode

When user provides specific code, file, or module:

  1. Analyze the provided code in detail
  2. Load relevant reference files based on code type
  3. Present the most valuable improvement for that specific code

Python Version Awareness

Always check Python version before suggesting features:

  1. Read pyproject.toml for requires-python
  2. Check .python-version if present
  3. 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 of List[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:

ReferenceLoad when
references/python-core.mdGeneral Python, utility functions, data processing
references/ai-ml-engineering.mdML model code, data pipelines, feature extraction, LLM integration
references/testing-evaluation.mdTest files, evaluation code, or when evaluation is missing
references/api-design.mdFastAPI code, API endpoints, request/response models
references/prompt-engineering.mdLLM prompt code, prompt templates, prompt evaluation
references/devops-mlops.mdDockerfiles, 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:

  1. Correctness (bugs, security vulnerabilities)
  2. Performance (N+1 queries, non-vectorized operations, memory leaks)
  3. Missing evaluation (no tests, no metrics, unclear success criteria)
  4. Maintainability (unclear naming, tight coupling, duplication)
  5. 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).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.