Skip to content

Commit e052497

Browse files
committed
Enhance README.md with Cursor Rules integration details
- Added section on Cursor Rules for improved AI coding assistance. - Included clean code guidelines, enhanced AI understanding, and standardized patterns for MCP server implementation.
1 parent bd55e07 commit e052497

File tree

4 files changed

+247
-0
lines changed

4 files changed

+247
-0
lines changed

.cursor/rules/clean-code.mdc

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
---
7+
description: Guidelines for writing clean, maintainable, and human-readable code. Apply these rules when writing or reviewing code to ensure consistency and quality.
8+
globs:
9+
---
10+
# Clean Code Guidelines
11+
12+
## Constants Over Magic Numbers
13+
- Replace hard-coded values with named constants
14+
- Use descriptive constant names that explain the value's purpose
15+
- Keep constants at the top of the file or in a dedicated constants file
16+
17+
## Meaningful Names
18+
- Variables, functions, and classes should reveal their purpose
19+
- Names should explain why something exists and how it's used
20+
- Avoid abbreviations unless they're universally understood
21+
22+
## Smart Comments
23+
- Don't comment on what the code does - make the code self-documenting
24+
- Use comments to explain why something is done a certain way
25+
- Document APIs, complex algorithms, and non-obvious side effects
26+
27+
## Single Responsibility
28+
- Each function should do exactly one thing
29+
- Functions should be small and focused
30+
- If a function needs a comment to explain what it does, it should be split
31+
32+
## DRY (Don't Repeat Yourself)
33+
- Extract repeated code into reusable functions
34+
- Share common logic through proper abstraction
35+
- Maintain single sources of truth
36+
37+
## Clean Structure
38+
- Keep related code together
39+
- Organize code in a logical hierarchy
40+
- Use consistent file and folder naming conventions
41+
42+
## Encapsulation
43+
- Hide implementation details
44+
- Expose clear interfaces
45+
- Move nested conditionals into well-named functions
46+
47+
## Code Quality Maintenance
48+
- Refactor continuously
49+
- Fix technical debt early
50+
- Leave code cleaner than you found it
51+
52+
## Testing
53+
- Write tests before fixing bugs
54+
- Keep tests readable and maintainable
55+
- Test edge cases and error conditions
56+
57+
## Version Control
58+
- Write clear commit messages
59+
- Make small, focused commits
60+
- Use meaningful branch names

.cursor/rules/codequality.mdc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
---
7+
description: Code Quality Guidelines
8+
globs:
9+
---
10+
# Code Quality Guidelines
11+
12+
## Verify Information
13+
Always verify information before presenting it. Do not make assumptions or speculate without clear evidence.
14+
15+
## File-by-File Changes
16+
Make changes file by file and give me a chance to spot mistakes.
17+
18+
## No Apologies
19+
Never use apologies.
20+
21+
## No Understanding Feedback
22+
Avoid giving feedback about understanding in comments or documentation.
23+
24+
## No Whitespace Suggestions
25+
Don't suggest whitespace changes.
26+
27+
## No Summaries
28+
Don't summarize changes made.
29+
30+
## No Inventions
31+
Don't invent changes other than what's explicitly requested.
32+
33+
## No Unnecessary Confirmations
34+
Don't ask for confirmation of information already provided in the context.
35+
36+
## Preserve Existing Code
37+
Don't remove unrelated code or functionalities. Pay attention to preserving existing structures.
38+
39+
## Single Chunk Edits
40+
Provide all edits in a single chunk instead of multiple-step instructions or explanations for the same file.
41+
42+
## No Implementation Checks
43+
Don't ask the user to verify implementations that are visible in the provided context.
44+
45+
## No Unnecessary Updates
46+
Don't suggest updates or changes to files when there are no actual modifications needed.
47+
48+
## Provide Real File Links
49+
Always provide links to the real files, not x.md.
50+
51+
## No Current Implementation
52+
Don't show or discuss the current implementation unless specifically requested.

.cursor/rules/python.mdc

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
---
7+
description: Python best practices and patterns for modern software development with Flask and SQLite
8+
globs: **/*.py, src/**/*.py, tests/**/*.py
9+
---
10+
11+
# Python Best Practices
12+
13+
## Project Structure
14+
- Use src-layout with `src/your_package_name/`
15+
- Place tests in `tests/` directory parallel to `src/`
16+
- Keep configuration in `config/` or as environment variables
17+
- Store requirements in `requirements.txt` or `pyproject.toml`
18+
- Place static files in `static/` directory
19+
- Use `templates/` for Jinja2 templates
20+
21+
## Code Style
22+
- Follow Black code formatting
23+
- Use isort for import sorting
24+
- Follow PEP 8 naming conventions:
25+
- snake_case for functions and variables
26+
- PascalCase for classes
27+
- UPPER_CASE for constants
28+
- Maximum line length of 88 characters (Black default)
29+
- Use absolute imports over relative imports
30+
31+
## Type Hints
32+
- Use type hints for all function parameters and returns
33+
- Import types from `typing` module
34+
- Use `Optional[Type]` instead of `Type | None`
35+
- Use `TypeVar` for generic types
36+
- Define custom types in `types.py`
37+
- Use `Protocol` for duck typing
38+
39+
## Flask Structure
40+
- Use Flask factory pattern
41+
- Organize routes using Blueprints
42+
- Use Flask-SQLAlchemy for database
43+
- Implement proper error handlers
44+
- Use Flask-Login for authentication
45+
- Structure views with proper separation of concerns
46+
47+
## Database
48+
- Use SQLAlchemy ORM
49+
- Implement database migrations with Alembic
50+
- Use proper connection pooling
51+
- Define models in separate modules
52+
- Implement proper relationships
53+
- Use proper indexing strategies
54+
55+
## Authentication
56+
- Use Flask-Login for session management
57+
- Implement Google OAuth using Flask-OAuth
58+
- Hash passwords with bcrypt
59+
- Use proper session security
60+
- Implement CSRF protection
61+
- Use proper role-based access control
62+
63+
## API Design
64+
- Use Flask-RESTful for REST APIs
65+
- Implement proper request validation
66+
- Use proper HTTP status codes
67+
- Handle errors consistently
68+
- Use proper response formats
69+
- Implement proper rate limiting
70+
71+
## Testing
72+
- Use pytest for testing
73+
- Write tests for all routes
74+
- Use pytest-cov for coverage
75+
- Implement proper fixtures
76+
- Use proper mocking with pytest-mock
77+
- Test all error scenarios
78+
79+
## Security
80+
- Use HTTPS in production
81+
- Implement proper CORS
82+
- Sanitize all user inputs
83+
- Use proper session configuration
84+
- Implement proper logging
85+
- Follow OWASP guidelines
86+
87+
## Performance
88+
- Use proper caching with Flask-Caching
89+
- Implement database query optimization
90+
- Use proper connection pooling
91+
- Implement proper pagination
92+
- Use background tasks for heavy operations
93+
- Monitor application performance
94+
95+
## Error Handling
96+
- Create custom exception classes
97+
- Use proper try-except blocks
98+
- Implement proper logging
99+
- Return proper error responses
100+
- Handle edge cases properly
101+
- Use proper error messages
102+
103+
## Documentation
104+
- Use Google-style docstrings
105+
- Document all public APIs
106+
- Keep README.md updated
107+
- Use proper inline comments
108+
- Generate API documentation
109+
- Document environment setup
110+
111+
## Development Workflow
112+
- Use virtual environments (venv)
113+
- Implement pre-commit hooks
114+
- Use proper Git workflow
115+
- Follow semantic versioning
116+
- Use proper CI/CD practices
117+
- Implement proper logging
118+
119+
## Dependencies
120+
- Pin dependency versions
121+
- Use requirements.txt for production
122+
- Separate dev dependencies
123+
- Use proper package versions
124+
- Regularly update dependencies
125+
- Check for security vulnerabilities

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ This template provides a streamlined foundation for building Model Context Proto
1515
- Minimal dependencies
1616
- **Embedded MCP specifications and documentation** for improved AI tool understanding
1717

18+
## Cursor Rules Integration
19+
20+
This project uses Cursor Rules for improved AI coding assistance, with patterns from [Awesome Cursor Rules](https://github.com/PatrickJS/awesome-cursorrules).
21+
22+
- **Clean Code Guidelines**: Built-in clean code rules help maintain consistency and quality
23+
- **Enhanced AI Understanding**: Rules provide context that helps AI assistants generate better code
24+
- **Standardized Patterns**: Follow established best practices for MCP server implementation
25+
26+
Cursor Rules help both AI coding assistants and human developers maintain high code quality standards and follow best practices.
27+
1828
## Integrated MCP Documentation
1929

2030
This template includes comprehensive MCP documentation directly in the project:

0 commit comments

Comments
 (0)