For Developers
Lecture 3
Crafting effective prompts for AI-assisted development
2026 WayUp
The same AI, vastly different results
"Make a login page"
"Create a secure login form with email validation, bcrypt password hashing, JWT tokens, and rate limiting. Use React Hook Form with Zod schema validation."
What's the situation? What does the AI need to know?
What exactly should the AI do? Be specific.
What are the boundaries? What should it NOT do?
How should the response be structured?
Give AI the information it needs to generate relevant code.
Result: Generic, possibly insecure code
Result: Secure, framework-appropriate code
Vague requests get vague results. Details matter.
| Vague | Specific |
|---|---|
| "Add validation" | "Add Zod schema validation for email (RFC 5322), password (min 8 chars, 1 upper, 1 number), and phone (E.164 format)" |
| "Handle errors" | "Catch network errors, show toast notification, log to Sentry, retry 3 times with exponential backoff" |
| "Make it fast" | "Implement React.memo, useMemo for expensive calculations, lazy load images, target < 100ms render" |
| "Add tests" | "Write Jest unit tests covering: valid input, empty fields, invalid email format, duplicate users, network failure" |
Give the AI a role to adopt a specific expertise perspective.
"Act as a security engineer. Review this code for vulnerabilities..."
"Act as a performance specialist. Optimize this database query..."
"Act as a senior developer. Review this PR for best practices..."
"Act as a QA engineer. Generate edge case tests for..."
Break complex tasks into numbered steps for better results.
Show the AI what you want with concrete examples.
Tell AI what NOT to do. Prevents over-engineering and scope creep.
"Build a todo app"
AI might add: authentication, categories, due dates, notifications, sharing, themes...
"Build a todo app"
Control how the AI structures its response.
"Provide only the code, no explanations."
"Add inline comments explaining each section."
"First explain the approach, then provide code."
Don't expect perfection on the first try. Refine through conversation.
"Create a pagination component"
"Add keyboard navigation support"
"Make it accessible (ARIA labels)"
"Add loading states"
Ask AI to think through the problem step by step.
Forces the AI to reason through the problem rather than pattern-match to a solution.
"Make it better"
"Fix the bug"
"Add some tests"
Walls of text confuse AI. Break into multiple prompts.
"Keep it simple but add all these features..."
Abstract requirements without concrete samples.
If you can't explain what you want clearly to a human, you can't explain it clearly to an AI.
| Phase | Prompt Start |
|---|---|
| Discover | "Read vision.md. Map user journeys for [feature]. Identify personas, goals, flows..." |
| Plan | "Based on the journeys, create task epics with user stories and acceptance criteria..." |
| Review | "Review these tasks for duplication, coupling, missing edge cases..." |
| Execute | "Implement [task] using TDD. Write failing test first, then implement..." |
| Commit | "Review changes for security issues, run linting, write commit message following conventions..." |
| Test | "Generate human test script (think-aloud) and automated E2E tests for..." |
"Create a search feature"
"I'm building a React e-commerce app with TypeScript. Create a product search feature:
Requirements:
- Debounced input (300ms) to prevent excessive API calls
- Show loading spinner during search
- Display results in a dropdown below input
- Keyboard navigation (up/down arrows, enter to select)
- Handle empty results and errors gracefully
Constraints: Do NOT use external search libraries. Keep component under 150 lines.
Output: Provide the React component code with TypeScript types."
CTCO
Context, Task, Constraints, Output format
Specific
Vague prompts = vague results
Examples
Show what you want with samples
Iterate
Refine through conversation
Prompt engineering is not about tricks. It's about clear communication with a machine.
Effective Prompt Engineering
Next: Specifications & Vision Documents
2026 WayUp - way-up.io