Best Practices
Working with the Template
This section outlines best practices for working with the Cursor Python Template to get the most out of its features.
Development Workflow
Using Cursor Effectively
To leverage the power of Cursor’s AI with this template:
Ask the AI for help: Cursor’s AI is aware of the project structure and rules - ask it questions about implementation approaches, code organization, or best practices.
Reference rules explicitly: When asking the AI for help, you can explicitly mention rule files:
“Following the Python rules, how should I handle exceptions in this function?”
“Based on the core rules, which design pattern would be appropriate here?”
“According to the testing rules, how should I test this component?”
Let the AI help with boilerplate: Use the AI to generate repetitive code patterns that follow the template’s rules.
Request rule-compliant reviews: Ask the AI to review your code for compliance with the rule files.
Project Organization
Following the Template Structure
Keep the directory structure clean:
Place all Python package code in
src/your_package/
Put all tests in
tests/
with similar structure to your packageKeep documentation in
docs/
Use
scripts/
for utility scripts and tools
Use proper packaging:
Maintain
pyproject.toml
as the central configurationDefine dependencies properly in
pyproject.toml
Use
__init__.py
files appropriately
Maintain separation of concerns:
Keep UI separate from business logic
Separate data access from processing
Place utilities in appropriate modules
Code Quality
Maintaining High-Quality Code
Follow language-specific rules:
Python code should follow the guidelines in
python-rules.mdc
PowerShell scripts should follow
powershell-rules.mdc
Use consistent code formatting:
Consider using Black for Python code formatting
Use consistent indentation and naming conventions
Follow the style guidelines in the rule files
Write comprehensive tests:
Follow
testing-rules.mdc
guidelinesMaintain high test coverage
Test both happy paths and edge cases
Use fixtures and parameterized tests when appropriate
Documentation Practices
Keeping Documentation Current
Document as you code:
Add docstrings to all public functions, classes, and methods
Keep README up-to-date with current project status
Update Sphinx documentation with new features
Follow documentation standards:
Use Google-style docstrings for Python code
Include type annotations
Document parameters, return values, and exceptions
Provide usage examples for complex functions
Maintain living documentation:
Update documentation when code changes
Remove outdated documentation
Keep examples current with the latest API
Version Control
Git Best Practices
Follow commit message guidelines:
Use descriptive commit messages
Reference issue numbers when applicable
Follow the conventions in
github-rules.mdc
Branch management:
Use feature branches for new features
Use bugfix branches for bug fixes
Keep main/master branch stable
Delete branches after merging
Pull request process:
Create descriptive PR titles and descriptions
Reference issues being addressed
Request appropriate reviewers
Address review comments promptly
Project Management
Tracking Project Progress
Use GitHub issues effectively:
Follow guidelines in
github-issues-rules.mdc
Create appropriate issue types (epics, stories, tasks)
Use labels to categorize issues
Maintain issue relationships
Track progress in the project plan:
Follow
project-plan-management-rules.mdc
Update status as tasks are completed
Document blockers and dependencies
Keep timelines current
Regular reviews:
Conduct code reviews for all changes
Review project plan regularly
Update documentation with each release
Refine rules based on project learnings
Getting Help
When you encounter issues with the template:
Consult the rules: Check the relevant rule files in
.cursor/rules/
for guidanceAsk Cursor AI: The AI is familiar with the template and can help resolve issues
Check project documentation: This documentation may provide insights
Contribute improvements: If you find ways to improve the template, consider contributing back