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.
.cursor/rules/python-projects-guide-cursorrules-prompt-file.mdcWhat 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.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/python-projects-guide-cursorrules-prompt-file.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/python-projects-guide-cursorrules-prompt-file.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/python-projects-guide-cursorrules-prompt-file.mdManually: put the files in place
.clinerules/python-projects-guide-cursorrules-prompt-file.mdStep 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