# Python Tutor

> 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 h…

- **Type:** Skill
- **Install:** `agentstack add skill-konrad-woj-skillset-python-tutor`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [konrad-woj](https://agentstack.voostack.com/s/konrad-woj)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [konrad-woj](https://github.com/konrad-woj)
- **Source:** https://github.com/konrad-woj/skillset/tree/main/python-tutor

## Install

```sh
agentstack add skill-konrad-woj-skillset-python-tutor
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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:

| 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:

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).

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [konrad-woj](https://github.com/konrad-woj)
- **Source:** [konrad-woj/skillset](https://github.com/konrad-woj/skillset)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-konrad-woj-skillset-python-tutor
- Seller: https://agentstack.voostack.com/s/konrad-woj
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
