5 Agentic Programming Tips Every Serious Engineer Should Use
Contents
You are already using Claude Code, Codex, Cursor, or something like that. And if you are honest, a good chunk of your sessions end with the AI confidently doing the wrong thing for 10 minutes while you watch.
That is not a model problem. That is a prompt problem.
Below is one master prompt you can paste at the start of any session. Then I will explain each line and why skipping it costs you tokens, time, and sanity.
The Master Prompt
Copy this. Paste it at the start of every session. Change the project description, keep everything else.
Rules for this session:
1. Use assertions throughout the code. Assert preconditions, postconditions, and invariants. Prefer explicit assertions over silent failures.
2. Never make assumptions. If something is unclear, stop and ask me before proceeding.
3. Keep code in standalone, focused files. No file should exceed 2000 lines. If a file is getting long, propose a split.
4. Use full descriptive names for all variables, parameters, and functions. No abbreviations or domain shorthand (write stress_in_x_direction not sigma_x, poisson_ratio not mu or nu, youngs_modulus_fiber not Ef).
5. Before exploring the codebase, check for a MEMORY.md at the root of each relevant folder. If it does not exist, create it by exploring the folder and documenting the key files, their purpose, and main functions. Use it as your navigation guide.
6. After any structural change, update the relevant MEMORY.md files to reflect what changed and why.
Six lines. Here is why each one is there.
Tip 1: Assert Everything
Use assertions throughout the code. Assert preconditions, postconditions, and invariants. Prefer explicit assertions over silent failures.
Most engineers skip assertions under time pressure. You know how it goes.
Now imagine the AI makes a wrong assumption three functions deep. Without assertions, the bug surfaces somewhere else entirely, wrapped in a useless error message, after the agent has already built five more things on top. With assertions, the program crashes immediately at the exact wrong value, at the exact line.
The AI writes assertions faster than you can think about them. And when something breaks, it reads the assertion message and fixes it in one shot instead of burning 15 turns tracing ghost values. Fewer tokens, faster fix.
If you do one thing from this list, do this one.
Tip 2: Never Assume, Always Ask
Never make assumptions. If something is unclear, stop and ask me before proceeding.
This is the closest thing to an anti-hallucination instruction that actually works.
By default, when an AI hits an ambiguity it fills the gap with the most plausible-sounding answer and keeps going. That answer is usually wrong for your specific case. You will not find out until the agent has stacked two more layers of code on top of it.
This one line flips the default. The agent stops and asks instead. Yes, one extra message. Still 10x cheaper than the backtracking session you would have had.
Put it in every prompt. Every single one.
Tip 3: Keep Files Small
Keep code in standalone, focused files. No file should exceed 2000 lines. If a file is getting long, propose a split.
This is a token problem as much as a code quality problem.
When an agent searches for a function, it usually reads the whole file. A 5000-line file means you just spent a big chunk of your context window on code that has nothing to do with the task. On long sessions this quietly burns 20-30% of your token budget before the AI does anything useful.
Small files fix this. The agent finds the right file, reads 400 lines, does the work, moves on. Less noise, cheaper per task, and when something breaks the list of suspects is short.
Tip 4: Full Names, No Shortcuts
Use full descriptive names for all variables, parameters, and functions. No abbreviations or domain shorthand (write stress_in_x_direction not sigma_x, poisson_ratio not mu or nu, youngs_modulus_fiber not Ef).
This one surprises engineers. It surprised me too.
The AI does not see your variables the way you do. When you write sigma_x you know it is the normal stress in x. The model sees a token that could mean stress, standard deviation, surface charge, or something else entirely depending on the field. mu alone? Could be Poisson ratio, friction coefficient, mean of a distribution, or dynamic viscosity. The model will guess. Sometimes right. Sometimes quietly wrong.
| Short | Full |
|---|---|
sigma_x |
stress_in_x_direction |
mu or nu |
poisson_ratio |
Ef |
youngs_modulus_fiber |
eps |
axial_strain |
K |
bulk_modulus |
Agentic AI runs on words. Long, unambiguous words. Your code gets more verbose, but you get fewer wrong suggestions, fewer wrong fixes, and the AI actually explains things back correctly.
You are not writing for a textbook. You are writing for a tool that thinks in text.
Tip 5: MEMORY.md is Code Now
Before exploring the codebase, check for a MEMORY.md at the root of each relevant folder. If it does not exist, create it by exploring the folder and documenting the key files, their purpose, and main functions. Use it as your navigation guide.
In 2026 a .md file at the root of your project is not documentation. It is a navigation layer for your agent.
As your codebase grows, the agent reads more and more files just to find where things live. Every read costs tokens. On a big project the agent might open five or six files just to locate one function. Across a long session that is a lot of context burned on exploration before a single useful line is written.
A MEMORY.md at the root of each folder gives the agent a map. It reads one file, knows where everything is, goes straight there.
The prompt also tells the agent to create the file if it is missing. On first run it explores the folder, builds the index itself, and uses it from that point on. You write zero lines of it.
Bonus: Keep It Updated Automatically
After any structural change, update the relevant MEMORY.md files to reflect what changed and why.
Every documentation system ever built has the same problem: nobody keeps it updated.
So do not. Put this line in the prompt and the agent does it. Every time it adds a file or refactors a module, it also updates the MEMORY.md. Six months from now you come back to the project, the agent reads the file, understands the layout immediately, and gets to work. No 20-turn rediscovery session.
Quick Reference
| Tip | What it prevents |
|---|---|
| Assertions | Silent failures, expensive bug hunts |
| Never assume | Hallucinated context, compounding wrong turns |
| Small files | Wasted tokens, bloated context reads |
| Full names | Misread variables, wrong suggestions |
| MEMORY.md read | Expensive exploration on every session |
| MEMORY.md update | Stale navigation, wasted tokens next time |
None of this requires a new tool. It is a text box you already open every session. The engineers who get the best results from agentic tools are not the ones with the fanciest setup. They are the ones who treat the prompt as part of the code.
Paste the master prompt above, change the project description, see what happens.
Basem Rajjoub