mcp-server-python-template / rules
Cursor rule17 starsChanged 21 months agoMITView on GitHub
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ChiragAgg5k/poke-mcpword for word, first seen May 17, 2025
Other versions1 project uses a version of this.
Word for word · 1
- ChiragAgg5k/poke-mcp★ 2100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,263 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- .cursor/rules/clean-code.mdcCursor rule
- .cursor/rules/codequality.mdcCursor rule
The file
Show its rules and text
We split this python.mdc into the rules it gives an agent
45 rules. About 0 are common, 36 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈36
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Use src-layout with src/your_package_name/
- Very specific: line 15
Place tests in tests/ directory parallel to src/
- Very specific: line 16
Keep configuration in config/ or as environment variables
- Very specific: line 18
Place static files in static/ directory
- Very specific: line 19
Use templates/ for Jinja2 templates
- Distinctive: line 22
Follow Black code formatting
- Distinctive: line 23
Use isort for import sorting
- Distinctive: line 24
Follow PEP 8 naming conventions:
- Distinctive: line 29
Use absolute imports over relative imports
- Distinctive: line 32
Use type hints for all function parameters and returns
- Very specific: line 33
Import types from typing module
- Very specific: line 34
Use Optional[Type] instead of Type | None
- Very specific: line 35
Use TypeVar for generic types
- Very specific: line 37
Use Protocol for duck typing
- Distinctive: line 40
Use Flask factory pattern
- Distinctive: line 42
Use Flask-SQLAlchemy for database
- Distinctive: line 44
Use Flask-Login for authentication
- Distinctive: line 50
Use proper connection pooling
- Distinctive: line 53
Use proper indexing strategies
- Distinctive: line 56
Use Flask-Login for session management
- Distinctive: line 59
Use proper session security
- Distinctive: line 61
Use proper role-based access control
- Distinctive: line 64
Use Flask-RESTful for REST APIs
- Distinctive: line 66
Use proper HTTP status codes
- Distinctive: line 68
Use proper response formats
- Distinctive: line 72
Use pytest for testing
- Distinctive: line 73
Write tests for all routes
- Distinctive: line 74
Use pytest-cov for coverage
- Distinctive: line 76
Use proper mocking with pytest-mock
- Distinctive: line 77
Test all error scenarios
- Distinctive: line 80
Use HTTPS in production
- Distinctive: line 83
Use proper session configuration
- Distinctive: line 88
Use proper caching with Flask-Caching
- Distinctive: line 92
Use background tasks for heavy operations
- Distinctive: line 96
Create custom exception classes
- Distinctive: line 97
Use proper try-except blocks
- Distinctive: line 101
Use proper error messages
- Distinctive: line 105
Document all public APIs
- Distinctive: line 107
Use proper inline comments
- Distinctive: line 112
Use virtual environments (venv)
- Distinctive: line 114
Use proper Git workflow
- Distinctive: line 116
Use proper CI/CD practices
- Distinctive: line 121
Use requirements.txt for production
- Distinctive: line 123
Use proper package versions
- Distinctive: line 125
Check for security vulnerabilities
≈ “Common” is an estimate: at least 1 in 5 of the 7,111 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: globs: alwaysApply: false --- --- description: Python best practices and patterns for modern software development with Flask and SQLite globs: **/*.py, src/**/*.py, tests/**/*.py --- # Python Best Practices ## Project Structure - Use src-layout with `src/your_package_name/` - Place tests in `tests/` directory parallel to `src/` - Keep configuration in `config/` or as environment variables - Store requirements in `requirements.txt` or `pyproject.toml` - Place static files in `static/` directory - Use `templates/` for Jinja2 templates ## Code Style - Follow Black code formatting - Use isort for import sorting - Follow PEP 8 naming conventions: - snake_case for functions and variables - PascalCase for classes - UPPER_CASE for constants - Maximum line length of 88 characters (Black default) - Use absolute imports over relative imports ## Type Hints - Use type hints for all function parameters and returns - Import types from `typing` module - Use `Optional[Type]` instead of `Type | None` - Use `TypeVar` for generic types - Define custom types in `types.py` - Use `Protocol` for duck typing ## Flask Structure - Use Flask factory pattern - Organize routes using Blueprints - Use Flask-SQLAlchemy for database - Implement proper error handlers - Use Flask-Login for authentication - Structure views with proper separation of concerns ## Database - Use SQLAlchemy ORM - Implement database migrations with Alembic - Use proper connection pooling - Define models in separate modules - Implement proper relationships - Use proper indexing strategies ## Authentication - Use Flask-Login for session management - Implement Google OAuth using Flask-OAuth - Hash passwords with bcrypt - Use proper session security - Implement CSRF protection - Use proper role-based access control ## API Design - Use Flask-RESTful for REST APIs - Implement proper request validation - Use proper HTTP status codes - Handle errors consistently - Use proper response formats - Implement proper rate limiting ## Testing - Use pytest for testing - Write tests for all routes - Use pytest-cov for coverage - Implement proper fixtures - Use proper mocking with pytest-mock - Test all error scenarios ## Security - Use HTTPS in production - Implement proper CORS - Sanitize all user inputs - Use proper session configuration - Implement proper logging - Follow OWASP guidelines ## Performance - Use proper caching with Flask-Caching - Implement database query optimization - Use proper connection pooling - Implement proper pagination - Use background tasks for heavy operations - Monitor application performance ## Error Handling - Create custom exception classes - Use proper try-except blocks - Implement proper logging - Return proper error responses - Handle edge cases properly - Use proper error messages ## Documentation - Use Google-style docstrings - Document all public APIs - Keep README.md updated - Use proper inline comments - Generate API documentation - Document environment setup ## Development Workflow - Use virtual environments (venv) - Implement pre-commit hooks - Use proper Git workflow - Follow semantic versioning - Use proper CI/CD practices - Implement proper logging ## Dependencies - Pin dependency versions - Use requirements.txt for production - Separate dev dependencies - Use proper package versions - Regularly update dependencies - Check for security vulnerabilities
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

