Blog→AI & Development

How to Prompt AI for Coding (Beginner Guide)

The specific prompting techniques that produce working code. From a non-technical founder who ships real software with AI.

May 6, 2026 1 min read

Why Your Prompts Aren't Working

Most people prompt AI coding tools like a search engine: "how do I add auth to Next.js." That produces documentation summaries, not working code for your specific project.

Good coding prompts require specificity, context, and constraints.

The Four-Part Structure

1. **Context** — what already exists: "I have a posts table with columns id, content, user_id, status, scheduled_at"

2. **Goal** — what you want: "Add a retry button to failed posts that resets status to scheduled and sets scheduled_at 5 minutes from now"

3. **Constraints** — what to preserve: "Use the existing PATCH /api/posts/[id] route. Don't touch the published section."

4. **Edge cases** — what to handle: "Show a spinner in flight. Show a success toast on completion."

Prompts That Work

**"Use the same pattern as..."** — points to existing code so AI follows your conventions.

**"Don't touch X"** — protects working parts from well-intentioned destruction.

**"Simplest possible version"** — AI over-engineers by default. This forces minimal implementations.

**"Plan before writing code"** — for complex features, wrong architecture in the plan is free to fix. After 200 lines, it's not.

**"This is the exact error"** — paste the full error message, not your interpretation.

Full prompting guide: Gilgamesh's Guide Vol. 4. Free.

Try SocialMate free

Schedule to 7 platforms, get 15+ AI tools, and grow your audience — all for free. No credit card required.

Create free account →

7 platforms · 15+ AI tools · Free forever

More from the blog

❤️ 2% of every SocialMate subscription goes to SM-Give — our charity initiative. Learn about SM-Give →