Tips for Using LLMs in Software Development
Background
Context is everything when working with LLMs. Here are five practical levers that determine whether your agent session succeeds or wastes a lot of tokens.
This article explores the minimum amount of context you need to provide to an LLM in order to perform a given software development task. When answering a user's prompt, an agent harness (like Claude Code or Cursor) can perform additional work such as reading files, exploring trial solutions, and updating existing source code. We want the LLM — together with its harness — to succeed at whatever task we provide, but we need to be thoughtful about the context we give it.
Context 1: Project Folder
For the LLM to efficiently reach application source code, database schemas, table structures, and markdown documents, it is best to start the agent harness inside the project folder, or just by specifying the project folder for the conversation. The harness will allow the LLM to list directories, search for keywords within the project, and examine what libraries are being used (e.g., `requirements.txt`).
Context 2: Task Description
Describe clearly to the LLM what needs to be done. Where possible, provide both the objective and the method to perform the task. The more specific you are, the less time the agent spends guessing at intent.
Context 3: Definition of Done
For some tasks, the definition of done is simply that the application logic is implemented. A stronger task definition also includes a validation mechanism — for example, agreement of results within a tolerance of ±1E-8 compared to a reference result. In that case, you should also provide the location of the reference result files (whether CSV or XLSX), as well as the location of your application's output (a database table or a directory path).
If the structure of the reference result and the application result differ, a mapping between the two terminologies must also be provided so the LLM can reconcile them correctly.
Context 4: Limiting Conditions
This is optional, but it is worth setting boundaries to prevent the agent harness from burning tokens endlessly on unproductive paths. One alternative is for the user to press the stop button when too much effort is being spent with no good result. Sometimes it is better to pause and ask the LLM to report its current status, so you can decide what the next best action should be.
Context 5: Session Continuity
After roughly 10 turns of conversation — which may involve no user input at all, just the results of Python script executions or grep searches — the context load grows significantly. Every prompt, response, and file read is tokenized, and the full history is sent on every subsequent turn. While there is some caching, context usage always trends upward.
A practical solution is to ask the LLM to write a session summary to a markdown file before ending the session. This effectively compresses the history, removing lower-value tokens from the next iteration. You can then start a fresh conversation, point the LLM to the summary file, and continue where you left off.
It also helps to keep the task definition in its own dedicated markdown file — stored in a `specs/` or `docs/` directory — so that any new session can read both the task context and the current session status before getting to work.
Conclusion
In short, a well-structured context reduces wasted turns and keeps your agent on track. Start with these five elements — project folder, task description, definition of done, limiting conditions, and session continuity — and refine based on what your specific project needs. The investment in setting up context upfront pays for itself quickly in faster, more reliable results.
Comments