Skip to main content
skill CX Codex

writing-python — Claude Code skill: what it does, how to install

writing-python — a skill that keeps an agent on Python 3.14 idioms: standard library first, type hints on every function, uv and ruff in place of pip and black.

MIT 134 installs ★ 17 updated 2026-10-14

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add julianobarbosa/claude-code-skills --skill writing-python -a claude-code
Open on GitHub

What writing-python does

The skill sets house rules for new code on Python 3.14 and later. Reach for the standard library first, and pull in a package only when there is a reason. Every function and parameter gets an annotation. Errors are raised early, with a message that says what went wrong.

Inside are short snippets: annotations, a dataclass built with field(default_factory=...), event dispatch through match. A section on 3.14 covers deferred annotations, t-strings, except without parentheses, concurrent.interpreters and compression.zstd. Pointers to PATTERNS.md, CLI.md and TESTING.md follow, and two merged skills sit as reference in References/code-style.md and References/type-safety.md. The toolchain is named outright: uv in place of pip or poetry, ruff in place of flake8 or black, plus pytest and mypy. The agent may use Read, Bash, Grep and Glob.

The gotchas section says what breaks on an older codebase. On Python 3.9 dataclass(slots=True) does nothing quietly, int | None is evaluated at runtime only from 3.10, and importing annotations from __future__ turns every annotation into a string, so typing.get_type_hints fails on forward refs to classes in local scope.

What it helps with

  • write a CLI tool on the standard library alone
  • add type annotations to a module that has none
  • move a project from pip and black to uv and ruff
  • catch version traps: slots, union syntax, deferred annotations
  • dispatch events with pattern matching instead of if-chains

Example prompts for the agent

  • Write a Python 3.14 CLI that uses only the standard library, then run ruff and mypy over it.
  • Convert this module to the uv and ruff toolchain and drop the flake8 config.
  • Add a dataclass config with slots=True and tell me what breaks on Python 3.9.

How to install writing-python

1Skills CLI (Vercel)

npx skills add julianobarbosa/claude-code-skills --skill writing-python -a claude-code

2Manually: put the files in place

~/.claude/skills/writing-python/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/writing-python/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about writing-python

How do I install writing-python in Claude Code?

Run npx skills add julianobarbosa/claude-code-skills --skill writing-python -a claude-code. The skill lands at ~/.claude/skills/writing-python/SKILL.md.

What does writing-python do?

It gives the agent a set of rules for Python 3.14 code: the standard library comes first, annotations go on everything, errors surface early, and the toolchain is uv, ruff, pytest and mypy.

How does it relate to the python-infrastructure and uv skills?

This one covers code style, typing and the 3.14 feature set. Background jobs and retries live in python-infrastructure, while dependency handling and project scaffolding belong to uv.

Source text

SKILL.md · MIT
---
name: writing-python
description: Idiomatic Python 3.14+ development. Use when writing Python code, CLI tools, scripts, or services. Emphasizes stdlib, type hints, uv/ruff toolchain, and minimal dependencies.
allowed-tools: Read, Bash, Grep, Glob
---

# Python Development (3.14+)

## Core Principles

- **Stdlib first**: External deps only when justified
- **Type hints everywhere**: All functions, all parameters
- **Explicit over implicit**: Clear is better than clever
- **Fail fast**: Raise early with informative errors

## Toolchain

```bash
uv           # Package management (not pip/poetry)
ruff         # Lint + format (not flake8/black)
pytest       # Testing
mypy         # Type checking
```

## Quick Patterns

### Type Hints

```python
def process_users(users: list[User], limit: int | None = None) -> list[Result]:
    ...

async def fetch_data(url: str, timeout: float = 30.0) -> dict[str, Any]:
    ...
```

### Dataclasses

```python
from dataclasses import dataclass, field

@dataclass
class Config:
    host: str
    port: int = 8080
    tags: list[str] = field(default_factory=list)
```

### Pattern Matching

```python
match event:
    case {"type": "click", "x": x, "y": y}:
        handle_click(x, y)
    case {"type": "key", "code": code}:
        handle_key(code)
    case _:
        raise ValueError(f"Unknown event: {event}")
```

## Python 3.14 Features

- **Deferred annotations**: No more `from __future__ import annotations`
- **Template strings (t"")**: `t"Hello {name}"` returns Template object
- **except without parens**: `except ValueError, TypeError:`
- **concurrent.interpreters**: True parallelism via subinterpreters
- **compression.zstd**: Zstandard in stdlib
- **Free-threaded build**: No GIL (opt-in)

## References

- [PATTERNS.md](PATTERNS.md) - Code patterns and style
- [CLI.md](CLI.md) - CLI application patterns
- [TESTING.md](TESTING.md) - Testing with pytest

## Tooling

```bash
uv sync                    # Install deps
ruff check --fix .         # Lint and autofix
ruff format .              # Format
pytest -v                  # Test
mypy .                     # Type check
```

---

## Absorbed sub-skills (post-consolidation)

This skill now subsumes the former `python-code-style` and `python-type-safety` skills. Their original SKILL.md content is preserved as deep reference:

| Subject | Path |
|---------|------|
| ruff, mypy, naming, imports, docstrings (Google style) | `References/code-style.md` |
| Type annotations, generics, protocols, strict checking patterns | `References/type-safety.md` |

For system-reliability concerns (background jobs, retries, observability), see the sibling **`python-infrastructure`** skill. For dependency management and project scaffolding, see **`uv`**.

---

## Gotchas

- **`from __future__ import annotations` makes ALL annotations strings** — runtime introspection (`typing.get_type_hints`) needs the actual types available; forward refs to local-scope classes fail.
- **f-string debug syntax (`f"{var=}"`) is 3.8+** — quietly fails (treats `=` as literal) in 3.7 and earlier.
- **`dataclass(slots=True)` is 3.10+** — silently does nothing in 3.9. Use `__slots__` manually for portability.
- **PEP 604 union syntax (`int | None`) is 3.10+ at runtime** — works as a string annotation in 3.9 with `from __future__ import annotations`, fails at runtime introspection.
- **`async def` vs `def` for FastAPI dependencies**: async deps run in the event loop; sync deps run in a thread pool. Mixing without thought causes either blocking or extra context-switch overhead.

© julianobarbosa · MIT · julianobarbosa/claude-code-skills

Similar skills

All skills for Programming languages →

From the same set37

The whole set →
mkdocs This skill guides an agent through building a MkDocs documentation site from Markdown. Use it to configure pages, preview a site, or prepare a deployment. CX Codex +1 157installs loki This skill guides Grafana Loki configuration, from deployment modes and storage backends to LogQL queries. Use it while setting up Loki or investigating its configuration. CX Codex +1 148installs consulting-design consulting-design brings Gemini into your workflow to evaluate design trade-offs, review architecture, and brainstorm alternatives via MCP tools. CX Codex +1 140installs opentelemetry Walks the agent through OpenTelemetry work: collector config, rollout to Kubernetes, pipelines for traces, metrics and logs. CX Codex +1 135installs zabbix-api Hands the agent working Zabbix API calls through the zabbix_utils Python library: hosts, templates, triggers, history, trapper data. CX Codex +1 132installs shellcheck shellcheck runs static analysis on bash and sh scripts to catch quoting bugs, syntax errors, and POSIX mismatches while generating automated diff patches. CX Codex +1 129installs shell-prompt The shell-prompt skill for Claude Code provides zsh prompt configs with Powerlevel10k, vi mode, mode-specific cursor shapes, and NORMAL/INSERT indicators for tracking the current mode. CX Codex +1 125installs azure-ad-sso azure-ad-sso wires a Kubernetes app to Azure AD (Entra ID) sign-in over OAuth2/OIDC: app registration, group claims, client secret in Key Vault. CX Codex +1 124installs

Project sponsors

Companies that keep this analytics open