Fichiers de Prompts
Provides two Cursor prompt templates for generating Freezed models and Flutter widgets with Clean Architecture conventions.
What this file does
Provides two Cursor prompt templates for generating Freezed models and Flutter widgets with Clean Architecture conventions.
When to use it
- Starting a new domain model with Freezed and JSON serialization
- Creating a new Flutter widget in a Clean Architecture project
- Standardizing code generation across a team using Cursor
- Reducing boilerplate when adding multiple models or widgets
Assumes this stack
Fichiers de Prompts
Afin d’optimiser davantage notre flux de travail avec Cursor, nous avons ajouté des fichiers
dans le dossier prompts/. Chacun contient un “prompt” détaillant comment générer
des classes ou des fonctions spécifiques.
Ces fichiers sont mis dans le gitignore. Les codes sont à copier dans les différents fichiers prompts.
Nouveaux Fichiers de Prompts
-
create_model.prompt
- Explique à Cursor comment créer un modèle
@freezedavec un certain nombre de champs. - Peut inclure la logique pour générer un fichier .dart dans
domain/model/ou ailleurs.
- Explique à Cursor comment créer un modèle
create_model.prompt
You are an expert in Flutter, Dart, and Clean Architecture.
Create a new domain model in the domain/model/ directory. The model must:
- Use the
freezedpackage for immutability. - Annotate with
@freezed. - Include JSON serialization if needed (
with JsonSerializable). - Generate a
fromJsonfactory constructor if required.
Template:
import 'package:freezed_annotation/freezed_annotation.dart';
part '{{model_name.snakeCase()}}.freezed.dart';
part '{{model_name.snakeCase()}}.g.dart';
@freezed
class {{model_name.pascalCase()}} with _${{model_name.pascalCase()}} {
const factory {{model_name.pascalCase()}}({
// TODO: Add fields
required int id,
required String name,
// ...
}) = _{{model_name.pascalCase()}};
factory {{model_name.pascalCase()}}.fromJson(Map<String, dynamic> json) =>
_${{model_name.pascalCase()}}FromJson(json);
}
-
create_widget.prompt
- Génère un nouveau widget (StatelessWidget ou StatefulWidget) en fonction de l’utilisateur.
- Propose un template de base pour une vue Flutter.
2. create_widget.prompt
File Name: create_widget.prompt
Description: Generates a new widget with a recommended structure.
# create_widget.prompt
You are an expert in Flutter, Dart, and Clean Architecture.
Create a new widget in the `presentation/view/` folder. The widget must:
- Be a stateless or stateful widget (depending on a placeholder).
- Include a constructor with named parameters.
- If the widget has parameters, mark them as `final` in the class.
- Use `const` constructors where possible.
**Template**:
```dart
import 'package:flutter/material.dart';
class {{widget_name.pascalCase()}} extends {{widget_type | default("StatelessWidget")}} {
const {{widget_name.pascalCase()}}({
Key? key,
// TODO: Add parameters here if needed
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
// TODO: Implement the widget layout
child: Text('{{widget_name.pascalCase()}}'),
);
}
}
```
Utilisation
- Dans Cursor, appuyez sur Ctrl + I (Composer) ou allez dans l’interface de prompts.
- Sélectionnez le prompt désiré (ex: “create_model.prompt”).
- Répondez aux questions (ex: nom du modèle, champs à inclure).
- Cursor génère automatiquement le code dans la bonne structure de dossiers (selon vos indications).
Avantages
- Moins de répétitions : plus besoin de copier-coller un vieux modèle ou un widget existant.
- Qualité : Cursor utilise également
.cursorrules, donc le code généré est aligné avec nos conventions. - Évolution facile : on peut créer ou modifier d’autres prompts pour générer par exemple des tests, des data sources, etc.
What's inside
2 prompt files: one for Freezed models, one for Flutter widgets, each with a template and usage instructions.
Change this for your project
- Replace
domain/model/with your own model directory path - Replace
presentation/view/with your own widget directory path - Replace
{{model_name.snakeCase()}}and{{widget_name.pascalCase()}}placeholders with actual names
Where it goes
A prompt collection. Copy the individual prompts you need rather than the whole file.
Worth borrowing
- Using Cursor prompt files to enforce project-specific code conventions
- Embedding template placeholders like
{{model_name.snakeCase()}}for dynamic generation
Related Documents
You must use artifacts for
Defines when to use artifacts and provides detailed instructions for creating code, documents, HTML, SVG, Mermaid diagrams, and React components.
starProject
Lists 120+ starred open-source projects across AI, DevOps, Flutter, and web development for discovery and inspiration.
midjourney-expert
Serves as a reference for Midjourney V7/Niji 7 prompting, covering parameters, reference systems, editing tools, and moderation workarounds.
Daily Agent Tasks Framework
Gives you a daily structure for assigning strategic work to Claude and development work to Codex, organized by project priority and current sprint.