python-syntax-tutor

python-syntax-tutor is a skill for Claude Code from SWHee/diffscope. It costs 238 tokens per session (1,673 once invoked), scanned A, original, MIT.

A Python syntax tutor that explains unfamiliar language features in the code where they appear. Python is a programming language; examples include decorators, async code, generators, and type hints.

In plain words
What is it for?
Use it to explain why a particular Python construct is used, what it does there, and what common pitfalls to watch for.
Why use it?
It helps readers understand code that uses advanced or easy-to-misread Python notation without turning the explanation into a general course.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the diffscope plugin — 2 skills, 3 commands, 3 agents, 2 hooks shipped together

Good fit Use it to explain why a particular Python construct is used, what it does there, and what common pitfalls to watch for.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/swhee/diffscope/python-syntax-tutor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add SWHee/diffscope --skill python-syntax-tutor
Clone the repo
git clone --depth 1 https://github.com/SWHee/diffscope

Made for: Claude Code.

Or install diffscope, the plugin that ships this one along with the rest of its 2 skills, 3 commands, 3 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-syntax-tutor

README.md
[![agentmods](https://agentmods.dev/badge/skills/swhee/diffscope/python-syntax-tutor/github.svg)](https://agentmods.dev/skills/swhee/diffscope/python-syntax-tutor)
Your own site
<a href="https://agentmods.dev/skills/swhee/diffscope/python-syntax-tutor"><img src="https://agentmods.dev/badge/skills/swhee/diffscope/python-syntax-tutor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-syntax-tutor

Your own site · 80×15
<a href="https://agentmods.dev/skills/swhee/diffscope/python-syntax-tutor"><img src="https://agentmods.dev/badge/skills/swhee/diffscope/python-syntax-tutor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 238 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,673 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00238 $0.01673
Opus 5.5 $0.00095 $0.00669
Sonnet 5.5 $0.00048 $0.00335
Haiku 4.5 $0.00024 $0.00167

Measured 1mo ago against content hash 8a2fd1387d24, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-syntax-tutor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/python-syntax-tutor/SKILL.md · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.

python-syntax-tutor — Python 문법 해설

Python 코드를 읽다 막힌 사람에게 그 자리에서 필요한 만큼만 설명한다. 문법 강의가 아니라 눈앞의 코드에 붙이는 주석에 가깝다.

왜 이 스킬이 필요한가

코딩 에이전트가 쓴 Python은 숙련자용 이디엄을 거리낌 없이 쓴다. 데코레이터가 제어 흐름을 감추고, 타입 힌트가 실제 동작과 무관해 보이고, yield가 함수의 반환 개념을 바꿔 놓는다. 로직은 따라가도 표기에서 막히면 코드가 통째로 불투명해진다. 이 스킬은 그 표기만 걷어낸다.

해설 원칙

1. 일반론이 아니라 이 코드의 설명

@lru_cache를 만나면 캐시 이론이 아니라 이 함수에 왜 붙었는지부터 말한다. 일반화는 그 뒤에 한 줄로 붙인다. 순서를 뒤집으면 학습자는 자기 코드와 설명을 연결하지 못한다.

1. 이 자리에서 하는 일     ← 2~3줄
2. 안 썼으면 어떻게 됐을지  ← 1줄
3. 최소 예시              ← 3~6줄
4. 언제 쓰는 문법인가      ← 1줄

2. 고를 줄 아는 것이 실력

전부 설명하면 아무것도 설명하지 않은 것과 같다. 모르면 코드 흐름을 잘못 읽게 되는 것만 고른다. for, if, def, 단순한 표준 라이브러리 호출은 설명하지 않는다.

우선순위:

  1. 제어 흐름을 숨기는 것 — 데코레이터, 컨텍스트 매니저, 제너레이터, async
  2. 함정 — 가변 기본 인자, 늦은 바인딩, 얕은 복사, is vs ==
  3. 이름으로 동작을 알 수 없는 것 — dunder, 디스크립터, 메타클래스
  4. 타입 표기 — Protocol, TypeVar, Literal, overload
  5. 최신 문법 — match, :=, dataclass 옵션

한 번에 3~5개. 함정은 개수 제한과 무관하게 반드시 포함한다.

3. 예시는 그 코드의 이름으로

foo/bar로 쓴 예시는 원본과 연결되지 않아 기억에 남지 않는다. 설명 중인 코드의 함수명·변수명을 그대로 써서, 예시가 곧 그 코드의 축소판이 되게 한다.

4. 추측하지 말고 실행한다

"아마 이렇게 될 것"이라고 쓰고 싶어지면 python3 -c '...'로 확인한다. Python은 직관을 배신하는 구석이 많다(스코프, 평가 시점, 복사 깊이). 틀린 문법 설명은 아무 설명도 없는 것보다 나쁘다 — 학습자가 그걸 믿고 계속 간다.

확인할 수 없으면 "확실하지 않음"이라고 밝힌다.

5. 프로젝트 고유 문법은 정의부를 읽는다

@retry, @app.route 같은 것은 Python 문법이 아니라 그 프로젝트/라이브러리의 데코레이터다. 일반론으로 넘기지 말고 Grep으로 정의부를 찾아 실제로 무슨 일을 하는지 읽고 설명한다. 찾지 못하면 그 사실을 밝힌다.

참조 자료

깊이가 필요할 때만 해당 파일을 읽는다. 전부 읽지 않는다 — 대부분의 해설은 이 SKILL.md만으로 충분하고, 참조는 설명이 얕아질 때만 연다.

등장 요소 파일
데코레이터, @property, functools, 디스크립터, 메타클래스 references/decorators-and-descriptors.md
타입 힌트, 제네릭, Protocol, TypeVar, overload, Self references/typing-and-generics.md
async/await, 이벤트 루프, gather, 스레드/GIL references/async-and-concurrency.md
제너레이터, yield, 이터레이터, 컴프리헨션, itertools references/iterators-and-comprehensions.md
dunder 메서드, dataclass, 연산자 오버로딩, __slots__ references/dunder-and-data-model.md
가변 기본 인자, 늦은 바인딩, 복사, 스코프, is vs == references/gotchas.md

Read the full file on GitHub · 105 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 105 lines · 238 tokens per session scan A 8a2fd1387d24

Subscribe to this mod's changes

python-syntax-tutor is a skill published in the GitHub repository SWHee/diffscope (1 stars, last pushed 2mo ago), licensed MIT. It adds 238 tokens to every session and 1,673 once invoked, about $0.0010 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

modelcontextprotocol-python-sdk-context

Answers questions about the official Model Context Protocol (MCP) Python SDK (mcp package on PyPI, modelcontextprotocol/python-sdk on GitHub). Tracks the main branch (v2 pre-alpha — MCPServer/snakecase/constructor-on handlers). Use when working with MCP servers or clients in Python, debugging v1→v2 migrations, or…

nick-railsback/skill-engine · 116 tokens

string-algorithms

Reference for string algorithm patterns — KMP, Z-function, Rabin-Karp, Manacher's, string hashing, suffix arrays, and Aho-Corasick. Covers recognition signals, core ideas, Python templates, edge cases, and common mistakes for each technique.

sequenzia/agent-alchemy · 59 tokens

programming

MUST USE for ANY work on .py .pyi .rs .ts .tsx .mts .cts .go files. One philosophy: strict types, modern stacks (Pydantic v2 / serde+thiserror / Zod / gin+sqlc+pgx+slog), modern toolchains (uv+basedpyright+ruff / cargo+clippy+miri / Bun+Biome+tsc / gofumpt+golangci-lint v2+nilaway+go-race), parse-don't-validate…

code-yeongyu/lazyclaudecode · 261 tokens

course

A Python helper that displays tutorials, group information, source-code links, and other resources for the python-office library in a terminal.

CoderWanFeng/python-office · 38 tokens

shiny-py-optimize

Diagnose and fix performance problems in Shiny for Python apps — slow startup, sluggish interactions, blocking operations, and apps that struggle beyond a handful of concurrent users. Use when a Shiny for Python app is slow, hangs, recomputes too much, times out, or must support more users; when the user asks to…

posit-dev/skills · 105 tokens

triton-cuda-api

A reference for Triton CUDA's core programming functions and their parameters. It explains how to identify program blocks, load and store memory, reduce values, perform dot products, and use atomic updates.

mindspore-ai/akg · 69 tokens