Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Python Pro

ASecurity

Idiomatic Python: project layout, packaging, type hints, testing, async, and performance. Use when writing, reviewing, or structuring Python projects.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentspythongojavasqltestingdebuggingapiperformancedocumentation

Works with

cliapi

Security Analysis

A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill python-pro --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Pro?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Python Pro
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-python-pro/badge)](https://www.skillsdirectory.com/skills/aicodedecode-python-pro)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: python-pro
description: Idiomatic Python: project layout, packaging, type hints, testing, async, and performance. Use when writing, reviewing, or structuring Python projects.
category: development
---

# Python Pro

## Overview

Python rewards **readability and the standard library**: the best Python code looks obvious after
you read it and leans on batteries-included modules before reaching for dependencies. This skill
covers professional Python — project layout that scales, packaging without pain, type hints as
documentation, testing culture, async done right, and performance work that respects how CPython
actually executes.

The through-line: write Python like Python, not like Java or C wearing a Python costume.

## When to use

- Starting or restructuring a Python project (layout, packaging, tooling).
- Writing or reviewing Python for idiom, correctness, or performance.
- Choosing between sync/async, packaging tools, or test frameworks.
- Debugging packaging issues, import problems, or slow code.
- Adding type hints or linting to an existing codebase.

## Core concepts

- **Project layout (src layout).** `src/mypackage/` with `pyproject.toml` at root; tests in
  `tests/` mirroring the package. Src layout prevents the classic bug of tests importing the local
  directory instead of the installed package. One `pyproject.toml` declares metadata, dependencies,
  and tool config — `setup.py` is legacy for most projects.
- **Virtual environments, always.** One venv per project (`python -m venv .venv`), dependencies
  pinned via lock file (`uv.lock`, `poetry.lock`, or `requirements.txt` with hashes for deploys).
  Never `pip install` into the system Python.
- **Type hints as documentation.** Annotate public APIs (`def fetch(url: str) -> Response`); run
  `mypy`/`pyright` in strict-ish mode on new code. Hints catch a class of bugs tests miss and make
  IDE support dramatically better. `dataclasses` (or `attrs`/`pydantic` at boundaries) over dicts
  for structured data.
- **The stdlib is deep.** `pathlib` over `os.path`, `dataclasses`, `functools`, `itertools`,
  `collections`, `datetime` with timezones (`zoneinfo`), `argparse`, `logging`, `sqlite3`,
  `http.server` for quick needs. Reach for PyPI only after checking the stdlib.
- **Async is for I/O concurrency.** `asyncio` shines when awaiting many network/disk operations;
  it doesn't speed up CPU work (GIL). Don't mix sync blocking calls into async code (use
  `run_in_executor` for blocking libs); don't make everything async "just in case" — async is
  viral and must be justified by actual concurrency needs.
- **Testing culture.** `pytest` with fixtures and `parametrize`; test behavior, not internals;
  `coverage` to find untested *areas*, not to chase a number. Doctests for documentation examples.

## Practical workflow

1. **Scaffold:** `src/` layout, `pyproject.toml` (build-system, project metadata, tool configs),
   `.venv`, lock file, `ruff` (lint+format — fast, one tool), `mypy` or `pyright`.
2. **Write code Pythonically:** context managers for resources, comprehensions where readable,
   generators for large/streaming data, `pathlib.Path` for paths, f-strings for formatting,
   exceptions for exceptional cases (EAFP) with specific except clauses.
3. **Type the boundaries.** Public functions fully annotated; internal code annotated where it
   clarifies. Run the type checker in CI — gradually, ratcheting strictness.
4. **Test in layers:** fast unit tests (pure functions), integration tests with real local
   services where feasible (testcontainers for Postgres/Redis), and a few end-to-end tests.
   `pytest -x -q` locally; full suite in CI.
5. **Profile before optimizing.** `cProfile`/`py-spy` to find hotspots; common wins: algorithmic
   fixes first, then reduce per-item overhead (avoid repeated attribute lookups in loops), use
   `__slots__` for millions of small objects, push inner loops to numpy/C extensions, or parallelize
   CPU work with multiprocessing.
6. **Package for distribution:** version in one place, build with `python -m build`, publish to an
   internal index or PyPI; CLIs via entry points (`[project.scripts]`).

Standard layout:

```text
mypackage/
├── pyproject.toml          # metadata, deps, tool config
├── src/mypackage/
│   ├── __init__.py         # minimal; don't import heavy deps here
│   ├── core.py
│   └── cli.py
├── tests/
│   ├── test_core.py
│   └── conftest.py         # shared fixtures
└── README.md
```

## Common pitfalls

- **Mutable default arguments.** `def f(items=[])` shares one list across calls — the classic
  Python gotcha. Use `None` + initialize inside.
- **Bare `except:` / swallowing exceptions.** Hides bugs and `KeyboardInterrupt`. Catch specific
  exceptions; log with context; let unexpected ones propagate.
- **Importing the wrong package.** Running tests/scripts from the repo root importing local code
  instead of the installed package — src layout + installed venv fixes this whole class of bug.
- **Timezone-naive datetimes.** `datetime.now()` without tz bites in serialization, scheduling,
  and DST. Use timezone-aware datetimes everywhere (`datetime.now(timezone.utc)`).
- **String concatenation in loops / quadratic joins.** Build lists and `''.join()`; use
  generators for streaming; don't load a 2GB file into memory to process it line by line —
  iterate the file object.
- **`pip freeze` chaos.** Unpinned or transitively-bloated requirements cause "works on my machine."
  Lock files, regenerated deliberately, committed to the repo.
- **Over-engineering with classes.** A module of functions beats a class with one method and no
  state. Python is multi-paradigm — reach for classes when there's genuine state + behavior.

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →