Skip to content
Back to skills

Rules Python

ASecurity

ANVIL coding rules for python code (**/*.py, **/test_*.py, **/*_test.py, tests/**/*.py): Python Security, Python, Python Testing.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmentpythonrustshellsqltestingsecurity

Works with

  • cursor

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill rules-python --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rules Python?

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

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

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: rules-python
description: "ANVIL coding rules for python code (**/*.py, **/test_*.py, **/*_test.py, tests/**/*.py): Python Security, Python, Python Testing."
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# ANVIL rules: python

Follow these rules for python code (**/*.py, **/test_*.py, **/*_test.py, tests/**/*.py).

## Python Security

# Python Security

- Never call `pickle.loads`, `yaml.load` (use `yaml.safe_load`), `eval`, or `exec` on untrusted data.
- Invoke OS commands with `subprocess.run([...], shell=False)` using argument lists rather than interpolated shell strings.
- Use parameterized SQL (`cursor.execute("... WHERE id = %s", (id,))`) or ORM bindings; never build queries with f-strings.
- Use `secrets` for tokens and `hmac.compare_digest` for MAC comparison; validate outbound URLs against SSRF and resolve paths within allowed roots.

## Python

# Python

- Type hints on public functions; run the configured type checker.
- Specific exceptions; `raise ... from err` to keep context; no bare `except:`.
- Context managers for files, locks and connections.
- `subprocess.run([...], check=True)` with argument lists; never `shell=True` on untrusted input.
- Format and lint with the project's tools (e.g. ruff, black).

## Python Testing

# Python Testing

- pytest with fixtures; parametrize cases instead of loops.
- No network or real clock in unit tests; use monkeypatch/freezegun-style tools.

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 development →

Comments

Loading comments…

Newsletter

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