I created the following prompt below.
However, Cursor completely forgot a lot of things. For instance, it forgot to create tests altogether and messed up the project structure.
How can I improve Cursor?
Are Cursor rules the answer? What exact rules should I use?
How do I improve it?
Are there any good ways to make it better follow its goals?
What are the ways to amke it foolow strict project structure?
Promt example:
Here’s a prompt for creating a dating Telegram bot for IT specialists using the specified technology stack and architecture:
Create a Telegram bot for IT specialists' dating with the following structure:
1. Project Structure:
```python
dating_bot/
│
├── alembic/
│ ├── versions/
│ ├── env.py
│ └── alembic.ini
│
├── src/
│ ├── bot/
│ │ ├── __init__.py
│ │ ├── handlers/
│ │ │ ├── __init__.py
│ │ │ ├── profile.py
│ │ │ ├── search.py
│ │ │ └── messaging.py
│ │ └── keyboards/
│ │ ├── __init__.py
│ │ └── inline.py
│ │
│ ├── controllers/
│ │ ├── __init__.py
│ │ ├── profile_controller.py
│ │ ├── search_controller.py
│ │ └── message_controller.py
│ │
│ ├── services/
│ │ ├── __init__.py
│ │ ├── profile_service.py
│ │ ├── search_service.py
│ │ └── message_service.py
│ │
│ ├── repositories/
│ │ ├── __init__.py
│ │ ├── profile_repository.py
│ │ └── message_repository.py
│ │
│ ├── models/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── profile.py
│ │ └── message.py
│ │
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── photo_handler.py
│ │ └── validators.py
│ │
│ └── config.py
│
├── tests/
│ ├── __init__.py
│ ├── conftest.py
│ ├── test_controllers/
│ ├── test_services/
│ └── test_repositories/
│
├── media/
│ └── photos/
│
├── requirements.txt
└── main.py
- Key Features to Implement:
a. Database Models:
- Profile model with fields:
- user_id (Telegram ID)
- username
- gender
- bio
- programming_languages (Array/JSON)
- photos (Array of paths)
- created_at
- updated_at
b. Bot Handlers:
-
Profile creation flow:
- Start profile creation
- Add photos (up to 5)
- Add bio
- Select programming languages
- Choose gender
- Review and confirm
-
Profile viewing:
- Show random profiles
- Next profile button
- Like/Skip buttons
-
Search functionality:
- Search by programming languages
- Search by gender
- Combined search
-
Messaging:
- Start conversation
- Block user option
- Testing Requirements:
-
Create fixtures for:
- Database connection
- Bot instance
- Mock profiles
- Mock photos
-
Test cases should cover:
- Profile creation
- Search functionality
- Photo handling
- Message handling
- Database operations
-
Use Allure for test reporting
- Additional Requirements:
- Implement rate limiting for profile viewing
- Add photo validation (size, format)
- Create fake profiles generator for testing and demo
- Implement proper error handling
- Add logging
- Technical Specifications:
# Example database model
class Profile(Base):
__tablename__ = "profiles"
id = Column(Integer, primary_key=True)
user_id = Column(BigInteger, unique=True)
username = Column(String)
gender = Column(Enum('male', 'female'))
bio = Column(Text)
programming_languages = Column(JSON)
photos = Column(JSON)
created_at = Column(DateTime, default=datetime.utcnow)
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
# Example test fixture
@pytest.fixture
def mock_profile():
return {
'user_id': 123456789,
'username': 'test_user',
'gender': 'male',
'bio': 'Python developer',
'programming_languages': ['Python', 'JavaScript'],
'photos': ['/media/photos/test1.jpg']
}
# Example service method
async def create_profile(self, user_data: dict) -> Profile:
profile = await self.profile_repository.create(user_data)
return profile
- Dependencies to Include:
aiogram==3.x
SQLAlchemy==2.x
alembic==1.x
pytest==7.x
pytest-asyncio
allure-pytest
Pillow
faker
The bot should be implemented following clean architecture principles, with clear separation of concerns between layers. Each layer should have its own responsibility:
- Controllers: Handle the interaction between bot handlers and services
- Services: Contain business logic
- Repositories: Handle database operations
- Models: Define database structure
Include proper documentation and type hints throughout the code.