flutter-app-expert-cursorrules-prompt-file — правило для Cursor
Настраивает Cursor на разработку мобильных приложений на Flutter 3.x с чистой архитектурой, BLoC и Material 3. Помогает держать единообразную структуру фич и тестов.
.cursor/rules/flutter-app-expert-cursorrules-prompt-file.mdcЧто делает flutter-app-expert-cursorrules-prompt-file
Правило задаёт стандарты кода для Flutter-проектов. Оно ориентирует Cursor на использование BLoC для состояния и GetIt для внедрения зависимостей. Навигация строится через GoRouter, а ошибки обрабатываются с помощью функционального типа Either. Код предлагается делить на слои data, domain и presentation, а вспомогательные утилиты выносить в core.
В правиле есть указание на гибкость: если в репозитории уже принята другая структура, агент обязан адаптироваться к ней. При создании виджетов инструкция требует использовать const-конструкторы и проверять доступность интерфейса. Для тестов заложены требования проверять бизнес-логику отдельно от компонентов UI.
Параметр alwaysApply: false означает, что правило не будет подмешиваться в контекст каждого диалога автоматически.
Какие задачи решает
- Организовать архитектуру фичи по слоям data, domain и presentation
- Настроить управление состоянием через BLoC и внедрение зависимостей через GetIt
- Написать юнит-тесты и виджет-тесты по единым стандартам
- Внедрить обработку ошибок с использованием типа Either
Примеры запросов агенту
- Создай новую фичу профиля пользователя с чистой архитектурой и BLoC
- Сделай виджет списка заказов с оптимизацией отрисовки и кэшированием изображений
- Напиши юнит-тесты для use case авторизации и моки для репозитория
Как установить flutter-app-expert-cursorrules-prompt-file
Вручную: положить файлы
.cursor/rules/flutter-app-expert-cursorrules-prompt-file.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/flutter-app-expert-cursorrules-prompt-file.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/flutter-app-expert-cursorrules-prompt-file.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/flutter-app-expert-cursorrules-prompt-file.mdВручную: положить файлы
.clinerules/flutter-app-expert-cursorrules-prompt-file.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о flutter-app-expert-cursorrules-prompt-file
Как установить flutter-app-expert-cursorrules-prompt-file в Cursor?
Создайте файл .cursor/rules/flutter-app-expert-cursorrules-prompt-file.mdc в корне репозитория и сохраните в него текст правила.
Что делает flutter-app-expert-cursorrules-prompt-file?
Задаёт правила разработки на Flutter 3.x: применение BLoC, GetIt, GoRouter, разделение кода на слои и требования к тестам.
Заставит ли правило переписать текущую структуру проекта?
Нет, инструкция прямо запрещает навязывать шаблонную структуру каталогов, если в проекте уже используется другая организация кода.
Исходный текст
flutter-app-expert-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for Flutter development with expert integration."
globs: **/*
alwaysApply: false
---
// Flutter App Expert .cursorrules
// Flexibility Notice
// Note: This is a recommended project structure, but be flexible and adapt to existing project structures.
// Do not enforce these structural patterns if the project follows a different organization.
// Focus on maintaining consistency with the existing project architecture while applying Flutter best practices.
// Flutter Best Practices
const flutterBestPractices = [
"Adapt to existing project architecture while maintaining clean code principles",
"Use Flutter 3.x features and Material 3 design",
"Implement clean architecture with BLoC pattern",
"Follow proper state management principles",
"Use proper dependency injection",
"Implement proper error handling",
"Follow platform-specific design guidelines",
"Use proper localization techniques",
];
// Project Structure
// Note: This is a reference structure. Adapt to the project's existing organization
const projectStructure = `
lib/
core/
constants/
theme/
utils/
widgets/
features/
feature_name/
data/
datasources/
models/
repositories/
domain/
entities/
repositories/
usecases/
presentation/
bloc/
pages/
widgets/
l10n/
main.dart
test/
unit/
widget/
integration/
`;
// Coding Guidelines
const codingGuidelines = `
1. Use proper null safety practices
2. Implement proper error handling with Either type
3. Follow proper naming conventions
4. Use proper widget composition
5. Implement proper routing using GoRouter
6. Use proper form validation
7. Follow proper state management with BLoC
8. Implement proper dependency injection using GetIt
9. Use proper asset management
10. Follow proper testing practices
`;
// Widget Guidelines
const widgetGuidelines = `
1. Keep widgets small and focused
2. Use const constructors when possible
3. Implement proper widget keys
4. Follow proper layout principles
5. Use proper widget lifecycle methods
6. Implement proper error boundaries
7. Use proper performance optimization techniques
8. Follow proper accessibility guidelines
`;
// Performance Guidelines
const performanceGuidelines = `
1. Use proper image caching
2. Implement proper list view optimization
3. Use proper build methods optimization
4. Follow proper state management patterns
5. Implement proper memory management
6. Use proper platform channels when needed
7. Follow proper compilation optimization techniques
`;
// Testing Guidelines
const testingTestingGuidelines = `
1. Write unit tests for business logic
2. Implement widget tests for UI components
3. Use integration tests for feature testing
4. Implement proper mocking strategies
5. Use proper test coverage tools
6. Follow proper test naming conventions
7. Implement proper CI/CD testing
`;
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules