Using AI Agents Efficiently
A collection of practical tips for getting more out of AI coding assistants — without burning through tokens unnecessarily.
Images
Pasting screenshots is expensive. Each image consumes significant tokens for vision analysis.
- Describe layouts in text instead — “a 3-column grid with a hero section above” costs far less than a screenshot
- Use images only for details that are genuinely hard to describe (custom icons, specific gradients, unusual UI patterns)
- Reference existing code rather than screenshots of your own UI — paste the component path or code snippet directly
Be Specific and Targeted
- Ask about one file or function at a time rather than broad questions like “fix my whole codebase”
- Reference specific line numbers: “in
page.mdxaround line 40, how do I…” - Include the “why” so the AI doesn’t need to ask: “I need X because Y, so don’t suggest Z”
Avoid Redundant Context
- Don’t paste large files when you only need help with a small section — select just the relevant portion
- In JetBrains AI, open files are often auto-included as context — close files you’re not actively working on
Use the Right Tool
- For simple completions (autocomplete, boilerplate), use inline completion rather than chat
- Chat sessions are heavier — reserve them for reasoning tasks, not quick lookups
- File search, renaming, extracting, and formatting don’t need AI — use the IDE’s built-in tools for those
Manage Chat Sessions Wisely
- Continuing an existing chat is more efficient than starting fresh when the context is still relevant
- Start a new session when switching topics — long chats filled with resolved questions add noise and cost
Write Clear Prompts the First Time
- Complete, well-formed prompts avoid the costly back-and-forth of clarification
- State your constraints upfront so the AI can give a useful answer on the first try