Skip to content
Back to skills

Python Antipatterns

ASecurity

Forbidden Python patterns — SQL injection, shell injection, unsafe deserialization, missing timeouts, blocking async calls. Applies when editing Python files.

  • 5 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added October 21, 2026
ai-agentspythongoshellsqldjangosecurity

Works with

  • cli

Security analysis

A100/100

Pro scans all 16 files and shows the line behind each finding

Scanned October 21, 2026

npx -y skills add emgiezet/aisdlc --skill python-antipatterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Antipatterns?

Add the live security badge to your README. It updates with every re-scan.

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

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

Download with Pro
SKILL.md
---
name: python-antipatterns
description: Forbidden Python patterns — SQL injection, shell injection, unsafe deserialization, missing timeouts, blocking async calls. Applies when editing Python files.
paths: ["**/*.py"]
user-invocable: false
---

# Python anti-patterns — do not write these

Checks run automatically after each edit. Findings reference the IDs below.

## Blockers
- AP-PY-SEC-001 — Pass params as second arg to `execute()`; never build SQL with f-strings or `%`.
- AP-PY-SEC-002 — Use `subprocess.run(['prog', arg1], shell=False)`; never `shell=True` with user input.
- AP-PY-SEC-003 — Use `json` for data exchange; replace `yaml.load` with `yaml.safe_load`.
- AP-PY-SEC-005 — Never use `verify=False`; supply a CA bundle path for internal PKI.
- AP-PY-SEC-007 — Replace `eval`/`exec` with a lookup dict or a safe parser; never eval user input.

## Errors
- AP-PY-SEC-004 — Always pass an explicit `timeout=` to `requests.get` and `httpx.get`.
- AP-PY-SEC-006 — Use `secrets.token_hex()` or `secrets.token_urlsafe()` for all security tokens.
- AP-PY-PERF-001 — Use `select_related`/`prefetch_related` (Django) or `selectinload`/`joinedload` (SQLAlchemy).
- AP-PY-PERF-002 — In `async def`, use `httpx.AsyncClient`, `asyncio.sleep`, and `aiofiles`; never block.
- AP-PY-MAINT-001 — Catch the narrowest exception; log and re-raise; never `except: pass`.
- AP-PY-MAINT-002 — Use `None` as default and initialise mutable defaults inside the function body.

Details for any ID: `reference/<ID>.md`

Files in this skill

  • SKILL.md1.5 KB
  • reference/AP-PY-MAINT-001.md678 B
  • reference/AP-PY-MAINT-002.md663 B
  • reference/AP-PY-MAINT-003.md547 B
  • reference/AP-PY-MAINT-004.md733 B
  • reference/AP-PY-PERF-001.md612 B
  • reference/AP-PY-PERF-002.md767 B
  • reference/AP-PY-PERF-003.md500 B
  • reference/AP-PY-SEC-001.md768 B
  • reference/AP-PY-SEC-002.md675 B
  • reference/AP-PY-SEC-003.md692 B
  • reference/AP-PY-SEC-004.md587 B
  • reference/AP-PY-SEC-005.md631 B
  • reference/AP-PY-SEC-006.md602 B
  • reference/AP-PY-SEC-007.md647 B
  • reference/AP-PY-SEC-008.md714 B

Attribution

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

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.