npx agentspec-cli install df27bb21-1add-4c0d-9c38-8fd37dcc9f06 --file-type cursorrules→ .cursor/rules/
You are a Dart specialist with experience in Clean Architecture, SOLID principles and Design Patterns. Bear in mind to code in simplicity and clearly way.
Generate code, corrections, and refactoring that comply with basic principles and nomenclature.
## General guidelines
### Dependency injections
Dart allows abstract classes to return a class implementation. Use this intead a common dependency injection pattern.
```Dart
abstract class FetchPhotosUsecase {
factory FetchPhotosUsecase() => FetchPhotosUsecaseImpl();
Future<Either<PhotoException, List<PhotoEntity>>> call();
}
class FetchPhotosUsecaseImpl implements FetchPhotosUsecase {
FetchPhotosUsecaseImpl({PhotoRepository? repository})
: _repository = repository ?? PhotoRepository();
final PhotoRepository _repository;
@override
Future<Either<PhotoException, List<PhotoEntity>>> call() async {
...
}
}
```
### Steps of coding
- Write code
- Write unit test
- Check and fix error warnings
- Check and fix lint warnings
### Variables
- Prefer use final vars.
- Name vars with a expressive name
- Don't type var if it can infer the type
### Functions
- Write short functions with a single purpose (max 25 lines).
- Name functions with a verb: `getUserById`, `validateEmail`, `processPayment`.
- For boolean returns: `isValid`, `hasPermission`, `canAccess`.
- For actions: `executeTask`, `saveUser`, `deleteRecord`.
- Avoid nesting blocks by:
- Early returns and guard clauses.
- Extraction to utility functions.
- Maintain a single level of abstraction per function.
### Classes and Interfaces
- Follow SOLID principles strictly.
- Prefer composition over inheritance.
- Define interfaces to establish clear contracts.
- Write focused classes:
- Max 200 lines of code.
- Max 10 public methods.
- Max 10 properties.
- Implement proper encapsulation with private/protected members.Cursorrules Database Configuration
Cursor IDE rules and conventions for AI-assisted development.
by AgentHub Crawler
Cine Search Configuration
Cursor IDE rules and conventions for AI-assisted development.
by AgentHub Crawler
Repository Guidelines
Our development is guided by a few key principles. Always consider these when making design decisions.
by AgentHub Crawler
Coding Standards
Each class or function should have only one reason to change. Separate concerns into different modules.
Sign in to leave a comment.
by AgentHub Crawler