Skip to main content
rule

python-projects-guide-cursorrules-prompt-file — Cursor rule

Guides Cursor to write Python code following modular design, Rye dependency management, pytest suites, and Ruff formatting.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/python-projects-guide-cursorrules-prompt-file.mdc
Open on GitHub

What python-projects-guide-cursorrules-prompt-file does

This rule configures Cursor for structured Python development. It organizes code into distinct layers, isolating models, services, controllers, and utility modules into separate files. Environment variables handle configuration, while complex logic receives detailed comments and docstrings.

The setup specifies explicit tooling. Rye manages dependencies and virtual environments, Ruff enforces code formatting, and pytest runs the test suite. Automated delivery relies on GitHub Actions or GitLab CI pipelines.

It requires strict type annotations. If your codebase relies on Poetry or standard pip instead of Rye, the suggested dependency workflows will conflict with your setup.

What it helps with

  • organize Python files into models, services, and controllers
  • set up virtual environments and dependencies with Rye
  • write automated unit tests using pytest
  • configure CI pipelines for GitHub Actions or GitLab CI

Example prompts for the agent

  • Scaffold a user registration service separating models, services, and controllers
  • Generate pytest test cases for the token validation helper
  • Create a GitLab CI configuration that runs Ruff checks and pytest

How to install python-projects-guide-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/python-projects-guide-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about python-projects-guide-cursorrules-prompt-file

How do I install python-projects-guide-cursorrules-prompt-file in Cursor?

Save the rule file to .cursor/rules/python-projects-guide-cursorrules-prompt-file.mdc in your project root.

What does python-projects-guide-cursorrules-prompt-file do?

It prompts Cursor to produce clean Python code using Rye for packages, Ruff for style checks, pytest for testing, and explicit type hints.

Which packaging tool does this rule expect?

The instructions specifically point to Rye for virtual environments and package resolution.

Source text

python-projects-guide-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for Python development with projects guide integration."
globs: **/*
alwaysApply: false
---
You are an AI assistant specialized in Python development. Your approach emphasizes:

1. Clear project structure with separate directories for source code, tests, docs, and config.
2. Modular design with distinct files for models, services, controllers, and utilities.
3. Configuration management using environment variables.
4. Robust error handling and logging, including context capture.
5. Comprehensive testing with pytest.
6. Detailed documentation using docstrings and README files.
7. Dependency management via https://github.com/astral-sh/rye and virtual environments.
8. Code style consistency using Ruff.
9. CI/CD implementation with GitHub Actions or GitLab CI.
10. AI-friendly coding practices:
   - Descriptive variable and function names
   - Type hints
   - Detailed comments for complex logic
   - Rich error context for debugging

You provide code snippets and explanations tailored to these principles, optimizing for clarity and AI-assisted development.

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Programming languages →

From the same set210

qwik-basic-cursorrules-prompt-file A Cursor rule that sets Qwik conventions for the agent: lazy functions with the $ suffix, signals, tasks, and a TypeScript plus Vite project layout. ★ 41,024repo stars qa-bug-report-cursorrules-prompt-file Configures Cursor to generate detailed bug reports acting as a QA engineer. It formats reproduction steps, environment data, console logs, and severity ratings. ★ 41,024repo stars pytorch-scikit-learn-cursorrules-prompt-file This Cursor rule guides Python machine-learning work on chemistry problems with scikit-learn and PyTorch. It covers molecular data, model training, and evaluation. ★ 41,024repo stars python A Cursor rule that sets project layout, code style and stack choices for Python work with Flask and SQLite. Useful when the agent edits files in your repo. ★ 41,024repo stars python-llm-ml-workflow-cursorrules-prompt-file This rule guides Cursor through Python, LLM, and ML work. Use it for API code, experiments, tests, and project structure. ★ 41,024repo stars python-github-setup-cursorrules-prompt-file Tells Cursor how to write and review Python code: style, tests, GitHub Pull Requests and GitHub Actions CI. Useful when the team has no shared rulebook. ★ 41,024repo stars python-flask-json-guide-cursorrules-prompt-file Guides Cursor on using the drawscape_factorio module. Helps parse exported-entities.json and generate SVG blueprints. ★ 41,024repo stars python-fastapi-scalable-api-cursorrules-prompt-fil This rule sets coding and project-structure guidance for FastAPI and React apps. Use it when you want Cursor to follow shared conventions for implementation, tests, and deployment. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor