Skip to main content
Back
AI Coding

How to Write Better Prompts for AI Coding Tools

Akonia Codex Team Akonia Codex Team
March 18, 2026
2 min read
How to Write Better Prompts for AI Coding Tools

Writing good prompts is the skill that separates average AI users from power users. When you learn to communicate well with AI, you get way better results.

The Anatomy of a Good Prompt

A good prompt has these parts:

[Context] + [Task] + [Constraints] + [Format]

Example Prompt Structure

Context: I'm building a SvelteKit application with TailwindCSS.
Task: Create a reusable card component.
Constraints: Must be accessible, support dark mode, and use TypeScript.
Format: Provide the full component code with comments.

Key Principles

1. Be Specific

Vague prompts get vague results. Instead of "make it better," say "reduce the function complexity by extracting helper functions."

2. Provide Context

AI performs better when it understands your project. Share relevant files, patterns, and constraints.

3. Iterate

Your first try is rarely perfect. Use follow-up prompts to refine the output.

4. Ask for Explanations

Request explanations for complex code. This helps you learn and catches issues.

Common Mistakes to Avoid

  • Too much at once: Break complex tasks into smaller prompts
  • Missing constraints: Always specify language, framework, and style
  • No examples: Show the AI what good output looks like
  • Ignoring errors: When AI makes mistakes, explain what went wrong

Advanced Techniques

Chain of Thought

Ask the AI to explain its reasoning:

Think through this problem step by step before providing the solution.

Few-Shot Prompting

Provide examples of what you want:

Here are examples of good variable names:
- userCount (not u or cnt)
- isLoading (not loading)
- handleSubmit (not submit)

Role Prompting

Give the AI a specific role:

You are a senior TypeScript developer reviewing code for best practices.

Practice Makes Perfect

The best way to improve is practice. Try these exercises:

  1. Refactor a complex function using AI
  2. Write tests for existing code with AI help
  3. Document your codebase with AI

AI is a tool that makes you more productive. The better you communicate, the more you get out of it.

#AI#prompts#productivity

Share this article

Stay Updated

Get the latest development tips delivered to your inbox.

Related Insights

Swipe →