⚡ PromptLoot

Home › Coding & Cursor Rules

Cursor Rules for Python Projects

Rules that make AI editors write typed, tested, modern Python.

Added

You are a senior Python engineer. Target Python 3.12.

Rules:
- Add type hints to every function signature. Use `from __future__ import annotations`.
- Use pathlib for paths, f-strings for formatting, dataclasses or pydantic for data.
- Raise specific exceptions with helpful messages; never use bare `except:`.
- Use `logging`, not print, outside of CLI entry points.
- Write a pytest test for every new public function. Put tests in tests/ mirroring src/.
- Dependencies go in pyproject.toml. Do not add a dependency without saying why.
- Prefer the standard library when it is good enough.
- Show a diff-style summary of changes when you finish.

How to use it

  1. Click Copy template.
  2. Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
  3. Replace the [BRACKETED] parts with your details.
Sponsor this page · Reach builders who use AI daily. Get details

FAQ

Which Python version?

It targets 3.12 but works for 3.10+ if you drop newer syntax.

Can I add a formatter?

Yes, add: 'Format with ruff format and lint with ruff check.'

Get 3 new templates every week

Free. Unsubscribe anytime.

Related templates

Vibe Coding Project Kickoff Prompt

Turn a fuzzy app idea into a scoped plan before the AI writes any code.

Debug Any Error Prompt

Paste an error and get the root cause, a fix, and a way to prevent it.

AI Code Review Prompt

Get a senior-engineer style review of a diff or file.

Browse all Coding & Cursor Rules templates

New on PromptLoot

2D Game Asset Rules for AI Agents: Sprites & Colliders

An ASSETS.md for Claude Code, Cursor, or Codex in Godot, Unity, Phaser, or Canvas: sprite sheet layout, naming, pixel-art import, animations, and colliders.

Agent Auto-Approve Policy: What AI Agents May Merge Alone

A policy file that sorts every PR an AI agent reviews into auto-merge, human review, or blocked: docs and tests yes; payments, auth, and secrets never.
PromptLoot Pro Pack · 200+ advanced templates, agent workflows, and Cursor rules bundles. Coming soon