Sub topic 9
Standing instructions and project conventions
This chapter assumes you have used an AI chat or coding assistant, can run a small Python file, and know how to attach files or selections to a request. Earlier chapters covered per-request context. This one covers context you write once and reuse.
Why standing instructions exist
Some facts stay true for every request in a project. The language is Python 3. Tests use pytest. Functions stay small. If you retype these facts each time, you waste effort and sometimes forget one. The assistant then guesses, and its guess may not match your project.
Standing instructions are short notes that the assistant reads with every request. Many tools load them from a file in the project, from a settings screen, or from a custom-instructions field. The name and location differ by tool, so check your tool's documentation. The idea is the same everywhere.
Project conventions are the rules your team follows: language version, test framework, naming, style, and what to avoid. When you write them down as standing instructions, the assistant follows them without being asked.
What the file looks like
Here is a small example for the stats.py project used in this tutorial:
# Project conventions
- Language: Python 3
- Tests: pytest, files named test_*.py
- Keep functions small and add type hints to new codeEach line is a fact or a rule the assistant can apply directly. Compare this with the per-request message from the earlier chapters:
Context: stats.py (attached), selection: the average function (lines 1-2).
Error: ZeroDivisionError: division by zero when average([]) is called.
Task: Change average so an empty list returns None instead of raising. Keep the function signature and do not change other code.The request names the file, the selection, the error, and the task. It does not need to say "use Python 3" or "write the test with pytest". The standing instructions cover that.
What belongs where
| Put it in standing instructions | Put it in the request |
|---|---|
| Language and version | The file or selection for this task |
| Test framework and file naming | The error output you are debugging |
| Style rules such as type hints | What you want changed now |
| Things to avoid in every task | Limits that apply only to this task |
A useful test: if the note would still be true next week for a different task, it belongs in standing instructions. If it describes only the current bug, it belongs in the request.
Writing good standing instructions
Keep them short. Standing instructions use part of the context budget on every request, as described in the chapter on context limits. Ten precise lines work better than two pages of prose.
Follow these guidelines:
- Write rules the assistant can check. "Add type hints to new code" is checkable. "Write good code" is not.
- Name specifics. "pytest, files named test_*.py" tells the assistant where to put a new test.
- State only what is true now. If you move from unittest to pytest, update the note on the same day.
- Leave out secrets. The file is sent with requests, so treat it like any other shared context.
Common errors
- Too long. A long list buries the rules that matter, and it leaves less room for your files and errors.
- Out of date. A note that says "Python 3.8" after you upgrade leads to code that avoids newer features for no reason.
- Conflicts with the request. If the instructions say "do not change other code" and the request asks for a refactor, the assistant must pick one. State the exception in the request.
- Treating it as a guarantee. The assistant usually follows these notes but can miss one. Review the output against your conventions, as covered in the chapter on verifying answers.
Exercise
You keep writing "use pytest and name test files test_*.py" at the end of each request. You also have a one-time request to fix a ZeroDivisionError in stats.py. Which of these two pieces of information belongs in standing instructions, and why?
Show answer
The pytest and file-naming rule belongs in standing instructions, because it applies to every task in the project. The ZeroDivisionError belongs in the request, because it describes only the current bug and will be irrelevant once it is fixed.
Exercise
Your standing instructions say "Python 3.8", but the project now runs on Python 3.12. What problem can this cause, and what should you do?
Show answer
The assistant may avoid features from newer versions or suggest workarounds that are no longer needed. Update the note to the current version as soon as the project changes.