Learn principles and see examples for writing effective prompts when using AI development tools like Replit Agent and Assistant.
Bad Prompt | Good Prompt | Explanation |
---|---|---|
”Fix my code." | "My script fails when processing user input. The error seems to be in the validation function. Can you help debug the validate_input part? Here’s the relevant error message: [details]“ | Specificity & Context (Debug, Select, Show): The good prompt identifies the problem area and the suspected function. It also offers specific context like code and error details, unlike the vague request. |
”Make a website." | "Create a simple portfolio website. It needs sections for Home, About Me, and a Contact Form. Use a clean, modern design theme and placeholder content.” | Clarity & Constraints (Simplify, Specify, Test): The good prompt defines the purpose, core features (sections), desired aesthetic, and initial content state. |
”Don’t make it slow." | "Refactor the data processing function to handle larger inputs more efficiently. Could we use a different algorithm or data structure?” | Positive Instruction & Goal (Instruct, Specify): Tells the AI how to improve (efficiency) and suggests what to consider (algorithm, data structure) rather than a negative constraint. |
”Add animation." | "Animate the main image on the landing page so it gently fades in when the page first loads to create a welcoming effect.” | Specificity & Outcome (Specify, Show): The good prompt identifies the specific element, desired visual effect (fade in), timing (page load), and the intended user experience. |
”Build the backend." | "Set up the server-side logic. Implement user authentication (signup/login) and create an API endpoint to retrieve user profile data securely.” | Breaking Down Tasks (Checkpoint, Test, Specify): The good prompt breaks down a large task (“backend”) into specific functionalities (authentication, data retrieval API). |
Tip | Description |
---|---|
Checkpoint | Structure development iteratively. Break large goals into smaller, testable steps, using Checkpoints in Agent to save progress and enable safe experimentation. |
Debug | Assist the AI in troubleshooting by providing detailed context, including exact error messages, relevant code snippets, and the steps taken. |
Discover | Leverage the AI’s knowledge by asking for suggestions on appropriate tools, libraries, frameworks, or general programming approaches for your task. |
Experiment | Treat prompting as an iterative process. Refine your requests by adjusting wording, adding detail, or simplifying instructions to improve AI responses. |
Instruct | Guide the AI effectively by stating clear, positive goals and desired actions, rather than focusing on negative constraints or what to avoid. |
Select | Provide focused, relevant context using features like file mentions. Avoid overwhelming the AI with unrelated information; start new chats for distinct tasks. |
Show | Reduce ambiguity by providing concrete examples, such as code snippets, desired output formats, sample data, or even UI mockups via image uploads. |
Simplify | Communicate clearly and directly. Use concise language, break down complex ideas, and avoid jargon, as if instructing a new team member. |
Specify | Ensure the AI understands the exact requirements by defining expected outputs, necessary constraints, data formats, and edge case handling. |
Test | Plan your application’s structure and features before prompting. Break down requirements like a PM/engineer to guide the AI effectively. |
git commit
) to save your progress. If a subsequent step fails, you can easily Rollback to a working state and try a different prompt.
/login
page, I get a ‘User not found’ error in the browser console. It seems like the check against the database isn’t working. Here’s the relevant login handling code in auth.js
.”profile.js
, profile.html
), mention or attach only those key files. Supplement with specific external context like documentation URLs or design mockups instead of attaching the entire codebase.
profile_mockup.jpg
].”/contact
. The form should include fields for Name (required), Email (required, must be valid format), and Message (required, min 10 characters). On submit, send the form data to contact@mydomain.com
.”