-
Notifications
You must be signed in to change notification settings - Fork 10
Add guidelines for effective prompting #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pinkeshmars
wants to merge
5
commits into
main
Choose a base branch
from
update/prompt-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+119
−1
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
23d720f
Add guidelines for effective prompting
pinkeshmars dde5a8d
Move 'Prompting Effectively' guide to 'Concepts' category
pinkeshmars 8432f24
Update meta
pinkeshmars 62c9391
Apply suggestions from code review
pinkeshmars d84afb6
Address review comments
pinkeshmars File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| --- | ||
| slug: /prompting-effectively | ||
| title: Prompting Effectively | ||
| description: Best practices for writing clear, structured prompts in Dreamflow to get accurate, efficient, and maintainable code from the Agent. | ||
| tags: [ai] | ||
| sidebar_position: 1 | ||
| keywords: [dreamflow prompting, ai prompting best practices, coding agent prompts, dreamflow agent, prompting, architectural prompting, ai-assisted development] | ||
| --- | ||
|
|
||
| # Prompting Effectively | ||
|
|
||
| Dreamflow’s agent is most effective when you treat it like a **collaborative developer**, not a one-shot code generator. Clear prompts, resolved ambiguity, and small scopes lead to better code, lower credit usage, and more predictable results. | ||
|
|
||
| Many coding prompts requests contain hidden ambiguity. A prompt like “Create this UI” or “Add favorites feature” can imply different data sources, navigation patterns, persistence, UX behavior, and architecture. If you do not specify these, the Agent has to guess, which can lead to extra code, mismatched behavior, more back-and-forth iterations, and higher credit usage due to unnecessary generation. | ||
|
|
||
| This guide explains how to prompt effectively, based on real research and practical experimentation with coding agents. | ||
|
|
||
| ### Ask Clarifying Questions | ||
|
|
||
| A reliable way to improve outcomes is to instruct the Agent to ask clarifying questions before writing code. For example: | ||
|
|
||
| ```jsx | ||
| Before writing any code, analyze my request. If there is any ambiguity in scope, behavior, data, or implementation, ask clarifying questions first. Do not proceed until I answer. | ||
| ``` | ||
|
|
||
| This approach works because human engineers naturally ask clarifying questions before writing code, and coding agents produce better results when they follow the same discipline. | ||
|
|
||
| In practice, this keeps you firmly in control of architectural decisions while preventing the agent from inventing or assuming requirements. As a result, the final implementation aligns much more closely with your original intent, both in structure and behavior. | ||
|
|
||
| :::tip[Reduced Credit Usage] | ||
|
|
||
| Clarifying questions can reduce credit usage because the Agent spends less effort exploring multiple interpretations. When your requirements are precise, the Agent can focus its effort on what you actually want rather than implementing assumed features or alternate paths. | ||
|
|
||
| ::: | ||
|
|
||
| ### Keep Tasks Small and Focused | ||
|
|
||
| Dreamflow's AI Agent is strongest when you break the task into small, reviewable steps. | ||
|
|
||
| Prefer prompts like: | ||
|
|
||
| - “Create the layout for the header and filters.” | ||
| - “Add persistence for favorites only.” | ||
| - “Wire the provider for this screen.” | ||
| - “Implement routing for this flow.” | ||
|
|
||
| Avoid one-shot prompts that attempt to build large chunks of the app at once. Smaller tasks are easier to validate and reduce downstream refactors. | ||
|
|
||
| ### Avoid Confidence-Based Instructions | ||
|
|
||
| Avoid prompts like “If you are less than 95% confident, ask questions.” A model’s self-assessed confidence is not a dependable signal of correctness. Instead, make clarification the rule whenever ambiguity exists, without relying on confidence thresholds. | ||
|
|
||
| :::tip[Characteristics of a Good Prompt] | ||
| - Goal and scope: what you want, and what you explicitly do not want | ||
| - Where it belongs: feature/module name, folder location, or the file(s) to modify | ||
| - Data and persistence: mock vs backend, and whether it must persist across sessions | ||
| - UX rules: loading, empty, error states, and any visual indicators | ||
| ::: | ||
|
|
||
| ## Prompting for Architecture | ||
|
|
||
| Dreamflow can go beyond prototypes when you prompt with architectural intent. The key is to treat the Agent as a fast implementer that follows your system design, not as a tool that invents your system design. | ||
|
|
||
| ### Think Like an Architect | ||
|
|
||
| If you do not specify architecture, the Agent will infer one. Inference is where inconsistency and refactor-heavy codebases come from. Start by choosing your architecture, core libraries, and folder conventions, then have the Agent implement within those boundaries. | ||
|
|
||
| Include specifics such as: | ||
|
|
||
| - Architectural pattern (layered, feature-based, clean architecture) | ||
| - State management (Provider, Riverpod, BLoC) | ||
| - Routing (GoRouter, Navigator 2.0) | ||
| - Networking (Dio, http) | ||
| - Data modeling (Freezed, json_serializable) | ||
| - Storage (SharedPreferences, SQLite, Supabase/Firebase) | ||
|
|
||
| ### Scaffold Structure Before Writing Code | ||
|
|
||
| A strong pattern is to have the Agent set up the project shape first. | ||
|
|
||
| Example prompt: | ||
|
|
||
| ```jsx | ||
| Create a task management app using feature-based architecture and BLoC for state management. Use GoRouter for navigation, Dio for networking, Freezed for data models, and SharedPreferences for local storage. Create the folders and files and update pubspec.yaml, but do not write any implementation code yet. | ||
| ``` | ||
|
|
||
| This gives you a clean structure you can review before any logic is added. | ||
|
|
||
| ### Separate Architecture from Implementation | ||
|
|
||
| Treat architecture and implementation as two different steps: | ||
|
|
||
| 1. Structure and dependencies | ||
| 2. Feature-by-feature implementation | ||
|
|
||
| This reduces churn because structure decisions are expensive to change later, while implementation can iterate quickly once the foundation is correct. | ||
|
|
||
|
|
||
| ### Use Project Rules | ||
|
|
||
| If you find yourself repeating architectural constraints in prompts, define them once as [Project Rules](../workspace/agent-panel.md#project-rules). | ||
|
|
||
| - Put global rules in a root `AGENTS.md` so they apply everywhere | ||
| - Put feature-specific rules in nested `AGENTS.md` files so they apply only when working in that folder | ||
| - Keep root rules short to avoid bloating context and slowing responses | ||
|
|
||
| With strong rules in place, your prompts can stay short while still producing consistent, production-ready output. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the prompts still feel low effort or less detailed for the agent. instead this section should talk about adding context to widget features of the app, for example, adding a widget to agent for exactly pointing which widget is being referred to and then give an example of a prompt and then also use screenshot feature for references to enrich the context further.
if possible a quick arcade would be great since this page is too text heavy. lets re-write this section keeping context and detailed task (not short) in mind and maybe update the title accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree! Let me re-think and re-write this section completely.