Skip to content

Commit 34bb4e2

Browse files
authored
Merge pull request #36 from FlutterFlow/feature/project-rules
Add Project Rules Docs
2 parents c0a2416 + a792b45 commit 34bb4e2

File tree

2 files changed

+207
-0
lines changed

2 files changed

+207
-0
lines changed

docs/workspace/agent-panel.md

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ The AI automatically has access to:
5656
- The widget you currently have selected
5757
- Recent changes you've made
5858
- Your project's dependencies and configuration
59+
- Your project-level guideline files (.cursorrules, CLAUDE.md, AGENTS.md, or ARCHITECTURE.md) to keep generated code consistent.
5960

6061

6162
### Image Attachments
@@ -220,5 +221,211 @@ The agent can access the following:
220221
</div>
221222
<p></p>
222223

224+
### Project Rules
223225

226+
Dreamflow allows you to define **custom project guidelines** that are automatically loaded into the Agent’s context every time you generate or edit code. It ensures that the Agent always follows your preferred architecture patterns, coding standards, and testing conventions, without needing to repeat them in every prompt.
224227

228+
Without project rules, you repeat long instructions in every prompt, for example:
229+
230+
```
231+
Add a login screen and use the BLoC pattern for state management, follow Clean Architecture, and place new features under /features/...
232+
```
233+
234+
With project rules, you can define these standards once in a file such as [`AGENTS.md`](http://AGENTS.md) and then simply ask:
235+
236+
```
237+
Add a login screen.
238+
```
239+
240+
#### Supported Rule Files
241+
242+
Dreamflow looks for one of the following files in your project root:
243+
244+
| Priority | Filename | Typical Purpose |
245+
| --- | --- | --- |
246+
| 1️⃣ | **.cursorrules** | Originally designed for the Cursor IDE but supported in Dreamflow for compatibility with existing codebases. |
247+
| 2️⃣ | [**CLAUDE.md**](https://code.claude.com/docs/en/overview) | Anthropic-style AI instruction file that can include guidelines for tone, safety, or project-specific context. |
248+
| 3️⃣ | [**AGENTS.md**](https://agents.md/) | Defines how AI agents should behave in your project, including coding standards, architecture patterns, and testing rules. |
249+
| 4️⃣ | [**ARCHITECTURE.md**](https://architecture.md/) | Documents your project’s structure, data flow, and design philosophy for better context. |
250+
251+
:::info
252+
253+
Only the **first file found** in this order is loaded. If multiple exist, Dreamflow stops scanning after the first match. For example, if .cursorrules exists, it will be used even if `AGENTS.md` is also present.
254+
255+
:::
256+
257+
When any of the supported rule files is loaded into the Agent’s context:
258+
259+
- The file’s contents are **appended to the system prompt** and used to fine-tune how the Agent generates, edits, and structures code.
260+
- These rules are applied to **every Agent action**, ensuring consistent behavior across your entire project.
261+
- Your rules **do not override** Dreamflow’s internal system instructions, they simply **guide and refine** the Agent’s decisions to match your project’s standards.
262+
263+
#### Adding Project Rules
264+
265+
Follow these steps to add project rules:
266+
267+
**Step 1: Create Rule File**
268+
269+
Create one of the supported rule files with the help of ChatGPT or Claude. While creating the file, include your project’s coding standards, architecture pattern, folder structure, testing requirements, and security guidelines.
270+
271+
Here’s a sample prompt you can use to generate your `AGENTS.md` file:
272+
273+
```jsx
274+
Create a clean, production-ready AGENTS.md file written specifically for a Flutter project using the BLoC architecture pattern.
275+
Its structure should clearly guide AI agents to always follow Flutter + BLoC best practices while keeping the file concise.
276+
[Add any other project-specific details here].
277+
```
278+
279+
Here are some sections you can include in the rule file:
280+
281+
- **Architecture pattern:** BLoC, Riverpod, MVVM, or Clean Architecture.
282+
- **Folder structure:** How features, data, and UI should be organized.
283+
- **Coding standards:** Formatting, naming, widget conventions, and logging.
284+
- **Testing requirements:** Required test types, structure, and frameworks.
285+
- **Security guidelines:** What not to log or expose.
286+
287+
Here’s an example output for the `AGENTS.md` file.
288+
289+
```markdown
290+
# AGENTS.md
291+
## Architecture: BLoC
292+
- Use flutter_bloc and equatable.
293+
- Each feature must include: bloc/, state/, event/, and screens/.
294+
- Keep business logic out of widgets.
295+
- Use BlocBuilder and BlocListener for state updates.
296+
297+
## Folder Structure
298+
features/[feature]/data/
299+
features/[feature]/domain/
300+
features/[feature]/presentation/
301+
302+
## Coding Standards
303+
- Follow effective_dart; use const constructors.
304+
- Use debugPrint() for logs (never print()).
305+
306+
## Security
307+
- Never log PII, tokens, or credentials.
308+
- Firestore access must be scoped to the authenticated user.
309+
- Validate input before saving to database.
310+
- Sanitize UI error messages.
311+
```
312+
313+
**Step 2: Place File in Project Root**
314+
315+
Upload the rule file at the **same level as `pubspec.yaml`**. Dreamflow **does not** scan subfolders. It should look like this:
316+
317+
![project-rule-file.avif](imgs/project-rule-file.avif)
318+
319+
**Step 3: Run Agent Action**
320+
321+
You can view or edit your rule file anytime from the Dreamflow File Editor. Once it’s saved, run any Agent command (for example, “Add a login screen”). Dreamflow will automatically load your rules and apply them to every generation.
322+
323+
#### Best Practices
324+
325+
- Keep the rule file specific, short, and imperative.
326+
- Keep must-follow standards at the top of the file.
327+
- Avoid overly long explanations — keep it concise and readable.
328+
- Update the file when your architecture or policies change.
329+
330+
331+
## FAQ
332+
333+
<details>
334+
<summary>
335+
Project rules aren’t being applied. Why?
336+
</summary>
337+
338+
<p>
339+
Your rule file might not be in the right location. Make sure it’s placed in the project root, at the same level as <code>pubspec.yaml</code>.
340+
</p>
341+
</details>
342+
343+
<details>
344+
<summary>
345+
Dreamflow isn’t detecting my project rules file.
346+
</summary>
347+
348+
<p>
349+
Check the filename — it must exactly match one of the supported names: <code>.cursorrules</code>, <code>CLAUDE.md</code>, <code>AGENTS.md</code>, or <code>ARCHITECTURE.md</code>. Any typos or variations will be ignored.
350+
</p>
351+
</details>
352+
353+
<details>
354+
<summary>
355+
The wrong project rules file is being used.
356+
</summary>
357+
358+
<p>
359+
Dreamflow loads only the first file it finds in the priority order. If a higher-priority file (for example, <code>.cursorrules</code>) exists, it will take precedence. Remove or rename that file if you want Dreamflow to use another one.
360+
</p>
361+
</details>
362+
363+
<details>
364+
<summary>
365+
I edited my rules file, but the Agent isn’t using the latest version.
366+
</summary>
367+
368+
<p>
369+
After editing, save the file and re-run your Agent command. The updated rules will be loaded automatically.
370+
</p>
371+
</details>
372+
373+
<details>
374+
<summary>
375+
The AI’s output seems inconsistent or off.
376+
</summary>
377+
378+
<p>
379+
There may be conflicting or unclear rules in your file. Try simplifying the instructions and making them more explicit.
380+
</p>
381+
</details>
382+
383+
<details>
384+
<summary>
385+
Isn’t <code>.cursorrules</code> only for the Cursor IDE?
386+
</summary>
387+
388+
<p>
389+
Originally yes, but Dreamflow supports <code>.cursorrules</code> for compatibility with existing projects. If a <code>.cursorrules</code> file is present in your project root, Dreamflow will automatically load it — it has the highest priority among all supported rule files.
390+
</p>
391+
</details>
392+
393+
<details>
394+
<summary>
395+
Do these rules override Dreamflow’s system prompts?
396+
</summary>
397+
398+
<p>
399+
No. They append to the system prompts. Dreamflow keeps its built-in logic, and your rules simply provide additional context.
400+
</p>
401+
</details>
402+
403+
<details>
404+
<summary>
405+
Can I edit or view the existing files?
406+
</summary>
407+
408+
<p>
409+
Yes — you can open them directly in Dreamflow’s File Editor.
410+
</p>
411+
</details>
412+
413+
<details>
414+
<summary>
415+
Can I use multiple rules files?
416+
</summary>
417+
418+
<p>
419+
You can keep several for compatibility, but Dreamflow will only load the first one found based on priority order. For consistency, it’s best to keep a single canonical file.
420+
</p>
421+
</details>
422+
423+
<details>
424+
<summary>
425+
Do I need to reload Dreamflow after adding a rules file?
426+
</summary>
427+
428+
<p>
429+
No. Simply add the file and re-run any Agent action. If Dreamflow doesn’t automatically pick it up, you can try reloading the project.
430+
</p>
431+
</details>
129 KB
Binary file not shown.

0 commit comments

Comments
 (0)