If you’ve ever built a Python tool that started as a simple script and ended up as something you’re slightly nervous to open six months later, this is for you.
I’ve been there many times. More than once I’ve returned to a tool and spent days reconstructing what past-me intended it to do.
This usually isn’t because the code was bad. It’s because the rules and any documentation only existed in your head.
Most geoscientists who build tools start the same way. A problem exists, an idea forms, and the coding begins. The goal lives in your head. The boundaries live in your head. The definition of “done” lives in your head.
That works fine for a weekend script.
It stops working the moment the tool grows, gets shared with a colleague or gets handed to an AI that will happily implement whatever it thinks you mean.
At that point the tool stops behaving according to intention and starts behaving according to interpretation.
One way to help control this is the Product Requirements Document (PRD). This is a commonly used tool in product management, but they often come with a bad reputation.
This is a follow on from my recent article where I followed a similar structure to create a lithology pattern creator: Working With Agentic LLMs: Why Structured Workflows Matter More Than Clever Prompts
PRDs are not paperwork, they are boundaries
In large organisations, PRDs can become bureaucratic documents that take weeks to write and are out of date before anyone reads them. That’s a process problem, not a document problem. This is often where their bad reputation comes from.
Stripped back to their essentials, a PRD is designed to answer three questions:
What does this tool do?
What does it explicitly not do?
What does done look like?
For a solo geoscientist building a tool for their own workflow or their team, those three questions can be answered in one or two pages. Often less.
The document doesn’t need to be perfect. It needs to exist. The purpose isn’t to document everything, it’s to remove ambiguity before the ambiguity becomes automation.
A real example: the lithology pattern generator
Recently, I built a small web app that generates lithology shading patterns, the kind used in well log plots and geological cross-sections. A user selects a lithology type, adjusts visual parameters like spacing and colour, and downloads the result as a PNG or SVG.
Simple enough.
But “simple” expands quickly unless it is constrained:
Should it match company standards?
Should it identify lithology automatically?
Should it remember patterns?
Should it understand geology?
All reasonable ideas. All fundamentally different tools.
So before writing any code, I wrote three sections.
What does it do?
The app generates lithology shading graphics based on user-selected presets and adjustable visual parameters. It helps geoscientists create consistent, repeatable patterns for figures and plots.
What does it explicitly not do?
No automatic lithology classification
No depth or well data handling
No geological interpretation
No adherence to any specific published standard
No persistent pattern libraries
This section matters more than the feature list.
Because the moment software looks geological, users and AI assistants assume geological meaning.
The non-goals prevent the tool accidentally gaining authority it was never meant to have.
What does done look like?
The user can generate a pattern from presets.
The user can adjust parameters and see immediate visual feedback.
The user can download the pattern reliably.
Output is predictable and repeatable.
No hidden automation or inference.
These are checkable statements. Either the behaviour exists or it doesn’t.
The document isn’t just a description it helps define the behaviour any future change is allowed to introduce.
Here is the final example PRD from the Lithology Generator. It does go into more depth than listed above, but it still follows the similar idea of what it does, what it doesn’t do and what does done look like.
# Product Requirements Document (PRD)
## Lithology Shading Pattern Generator
---
### Overview
This application generates small lithology shading pattern graphics
based on user-selected presets and adjustable visual parameters.
The tool is intended to help geoscientists create consistent,
repeatable lithology shading patterns for use in plots, figures,
and reports.
This is a visual pattern generator.
It does not perform geological interpretation.
---
### Target Users
- Petrophysicists
- Geologists
- Geoscientists preparing plots or technical figures
---
### Core Use Case
1. User selects a lithology type (e.g. sandstone, shale, limestone)
2. User selects a preset shading pattern associated with that lithology
3. User adjusts visual parameters (size, spacing, angle, thickness)
4. A preview graphic updates immediately
5. User downloads the generated pattern as an image file
---
### Functional Requirements
#### Presets
- The application provides a small set of lithology presets
- Each preset defines:
- base motif (dots, lines, bricks, triangles, etc.)
- default spacing or density
- default orientation
- default stroke thickness
Presets encode convention, not interpretation.
#### User Controls
The user can adjust:
- symbol or motif size
- spacing or density
- orientation or angle
- line or stroke thickness
- foreground and background colour
#### Preview
- A preview graphic is always visible
- Any change to presets or controls updates the preview immediately
- The preview represents the exact output that will be exported
#### Export
- The user can download the generated pattern as an image
- Supported formats: PNG or SVG
- The exported image must match the preview exactly
---
### Validation Rules
- Numeric parameters must accept only numeric input
- Invalid values are clamped or ignored gracefully
- The application must not crash due to invalid input
---
### Technical Context
- The application is a small client-side web app
- Built using React
- No backend or server-side logic
- All rendering occurs in the browser
- All state is local to the application
The choice of framework is incidental.
The focus is on structure and predictable behaviour.
---
### Non-Goals
- No automatic lithology classification
- No depth or well data handling
- No geological interpretation
- No adherence to any specific published standard
- No persistence or pattern libraries
- No project management or user accounts
---
### Definition of Done
- User can generate a lithology shading pattern from presets
- User can adjust parameters and see immediate visual feedback
- User can download the pattern reliably
- Output is predictable and repeatable
- No hidden automation or inferenceThe PRD is the starting point. If you want to see how this plays out in practice with a real agentic tool, I cover the full workflow including task management and keeping the agent on track in a piece on Substack. Link at the end.
A second example: a LAS file curve range checker
The lithology app is purely visual. The same idea becomes more important with data.
Imagine a tool that loads a LAS file, checks whether curve values fall within acceptable ranges, and produces a pass/fail summary.
Seems straightforward.
But without explicit constraints, the next request will eventually be:
“Can it fix the bad values?”
To a human, that’s questionable and requires careful consideration.
To an AI assistant, that’s helpful.
So the boundaries must exist in writing.
What does it do?
Loads a LAS file and checks whether each curve’s values fall within defined acceptable ranges.
What does it explicitly not do?
No automatic correction of out-of-range values
No clipping or smoothing
No zonation or formation-specific QC
No interpretation of geological meaning
No modification of the original LAS file
That last line is critical.
Because an instruction like “improve data quality” is logically satisfied by rewriting the data unless explicitly forbidden.
With an agent, forgotten intent doesn’t cause confusion, it can easily become the new way the agent behaves.
What does done look like?
The user receives a clear report listing each curve and its pass/fail status.
Observed min/max values are reported alongside expected ranges.
The output can be saved.
The original LAS file remains unchanged.
Running the tool twice produces identical results.
Deterministic behaviour is the completion criteria.
Getting an LLM to help you write it
You don’t have to write the PRD alone. One of the most useful uses of an LLM before coding begins is stress-testing your specification.
Describe the idea and ask it to identify ambiguity.
You are not asking the model to design the system.
You are asking it to expose gaps in the rules.
For example:
Before we write any code, help me write a simple PRD answering what the tool does, what it does not do, and what done looks like. Ask clarifying questions. Do not suggest implementation details.
At this stage you are trying to isolate behaviour from implementation. Once this stage is done then we can move onto architecture planning later.
We are also trying to reduce the chances of model and coding agent interpreting your description in multiple ways.
Once the LLM is prompted, you may get back something like
# Clarifying Questions
Should acceptable ranges be predefined or provided by the user at runtime?
Should the tool analyse the entire well or only the logged interval containing data?
Should missing values (nulls) count as failures or be reported separately?
Should the tool modify the LAS file to fix issues, or only report them?
Is the output intended for humans (readable report) or for downstream software (machine-readable file)?
## Product Requirements Document (Draft)
### 1. What does this tool do?
The tool loads a LAS file and inspects the numeric values of each curve against defined acceptable ranges.
For each curve, the tool:
Reads the available depth samples
Determines the minimum and maximum observed values
Compares these values against the specified acceptable limits
Classifies the curve as pass or fail
Reports the magnitude of any violations
The tool provides a summary showing:
curves within expected ranges
curves exceeding limits
curves containing only missing data
The purpose is early data quality screening prior to geological interpretation.
### 2. What does this tool explicitly NOT do?
The tool does not:
modify the LAS file
correct, clip, smooth, or interpolate values
infer lithology or petrophysical meaning
determine whether data is geologically reasonable
apply zonation or formation-specific rules
compare multiple wells
calculate petrophysical properties
standardise units
replace missing values
The tool only evaluates numeric ranges and reports observations.
### 3. What does done look like?
The tool is considered complete when:
A user can provide a LAS file and defined value ranges
The tool returns a clear report listing each curve and its status
The report includes observed minimum and maximum values
Failures are identifiable without interpretation
The original LAS file remains unchanged
Re-running the tool on the same file produces identical results
Success is measured by clarity and determinism, not interpretation accuracy.After you receive a draft, you can push it further with the following prompt:
Review this PRD and identify anything that is ambiguous or could be
interpreted in more than one way by a developer who has no domain
knowledge of geoscience. Flag each ambiguity and suggest how to
make it more precise.This is particularly valuable because the LLM has no geological intuition. Anything it finds ambiguous, a coding agent will also find ambiguous and will fill in with its own assumptions. Better to surface those gaps now than discover them halfway through development.
One other method I have found helpful here is to copy the PRD output and paste it to a new chat or even to a completely different model. For example, design and refine it initially in ChatGPT and then cross check with Claude Sonnet. This can reveal extra inconsistencies or things you hadn’t considered.
Why this feels familiar if you work in subsurface
Geoscientists already think this way. We just don’t always apply it to the tools we build.
Before running a petrophysical interpretation, you define your inputs, your methodology, your depth references, and your acceptance criteria for the project. You don’t just feed data into a model and see what comes out. You define what you’re doing and what you’re not doing before you start.
A PRD is the same discipline applied to tool development. The scope is your methodology. The non-goals are your exclusions. The definition of done is your acceptance criteria.
The only difference is that in petrophysics, that structure is drilled into you through training and practice. In tool development, nobody tells you to write it down. So most people don’t.
A simple template to get started
Overview: one short paragraph describing what the tool is and who it’s for.
Core use case: the primary workflow a user follows, written as numbered steps.
Functional requirements: what the tool must do, broken into concrete behaviours.
Non-goals: an explicit list of what this tool will never do.
Definition of done: checkable statements that confirm the tool is complete.
For a small geoscience tool, this fits on one to two pages. Write it before you write any code. Update it if the scope genuinely needs to change, not every time you have a new idea.
The cost of not writing it down
The alternative is a tool whose scope lives entirely in your memory. That works until you come back to it after three months, hand it to a colleague, or ask an agent to extend it.
At that point, the question “what is this supposed to do?” has no reliable answer. And you’ll spend time rebuilding your own understanding of a tool you built yourself.
A two-page document written before you start is a small investment. The scope creep it prevents is not.




