Solar Dashboard - Claude setup and what goes into CLAUDE.md
In coding, agentic or not, leverage comes from understanding the problem clearly and stating your intent precisely, in as few words as it takes.
Learning from my previous project
My late reflection on a recent agentic coding project was that extensive documentation can become more problematic than having little of it. I started with the presumption that humans and LLMs use docs to work out what the system does, with the remaining detail in the code. I wrote some docs and used LLMs to add and maintain more.
Very quickly the volume became overwhelming, not just to me but also to the models, which missed updates more often. I also changed code by hand, and my vague requests to update the docs went amiss. The docs drifted apart and began to conflict, making the output (mainly code) unreliable.
If you use Claude to update documentation keep checking that the verbosity is just about enough to convey the detail. When docs overlap specific feature ensure the update affects all places.
Unsurprisingly, subsequent code changes drifted too (yes, I let some of it sneak in). At the speed of creation, these effects accumulated and amplified with each change. Working with the agentic harness became a wrestle on certain tasks: responses were slower, more expensive and, most importantly, not heading where I'd like.
This isn't too dissimilar to working on legacy code. Unclear code, mountain of outdated docs and unclear requirements make changes slower and riskier. If the system isn't malleable to a human, LLMs may not help much with it. The saving grace with greenfield product is that I know what I want the system to do, so I define all the requirements: functional, non-functional and architectural.
when the output becomes unreliable, ask what the generated code was based on. In a few cases the LLM pointed out sections of documentation or code that misled it, so I could review those parts.
Luckily, this project is a blank slate and I can start from a blank CLAUDE.md file. Importantly, I build this system for myself so at least I can start with a clear picture of what I want.
What goes into my CLAUDE.md file?
Keep in mind that, as I was discovering the problem space, this file was evolving.
Describe the problem at hand
I listed the main problems of the old setup as per the challenge.
I boiled it down to just a few sentences because the powerful Claude models already know all the risks of hosting a transactional public site without encryption or pains of a site that has low availability or data inconsistency.
Describe what you want to happen
It was, again, a distilled version of what's in the vision post describes.
State non-negotiable requirements for the new system and encourage the model to suggest options for any areas where you want it.
Add factual and relevant detail
Describe the relevant context factually and precisely. If you don't know something, say so, instead of guessing. Providing a wrong information will hinder your progress and impact the correctness of the solution. Focus on facts.
If unsure what to put in here, encourage the model to question you.
I have added the following details:
- exact models of equipment, I also pointed to PDFs with user guides and manufacturer's specifications
- old dashboard URLs, URL to the landing page of the inverter's communication module
- equipment's IP addresses, network gateway and DHCP detail
- network topology and information about access controls and firewalls
- DNS configuration and the domain for the new system
- my desired target platform (homelab) for the applicable modules to run in and details on how it operates
- the preferred low-power device to consider slotting between the inverter and homelab to make solution more resilient
No credentials.
Allow the file to grow if there's a good reason
As the project progressed and Claude was running discovery, it needed real-life, physical experiments, which only I could run. To name a few we were verifying the characteristic of the inverter/battery bank/solar array in various scenarios. It included testing power-cut, overload, recovery, bank capacity, voltage sagging under load in multiple scenarios, battery bank imbalance and inverter losses, temperature impact on the operation, overcast sky and others.
That drove more detail which seemed unnecessary at first:
- my observations about the charge/discharge characteristics (state what's objective and what subjective, you don't want to bias the inference)
- rating and length of the high current leads and PV ones too
- the parameters of the battery bank, its chemistry, age, location and external charging setup
- electrical parameters of the solar array, size, composition, layout of panels, azimuth and tilt
- parallel/serial configuration of the solar array as well as partial shading issues.
- a mechanism to measure inverter's utility power consumption as it does not seem to report it itself
This helped with experiments which were verifying the role of certain fields in payloads.
It also helped to explain anomalies that the system was reporting (such as misreported bank's capacity,
incorrect charging voltage and unexpected power curve, inaccurate load figure).
The updates wouldn't strictly belong in a generic project space but, since it is only mine and working for my use case,
I kept it here.
Execution plan
A couple of years ago I came up with a phased approach for this specific project. I didn't execute it then as, after about a week of setup, research and tinkering, I learnt the spec of the inverter protocol and the messages themselves were misaligned. I simply didn't have the time to work out the gaps as it would require too much experimentation given the little spare time I had.
Now I can lean on Claude for the gap analysis, I will use that same plan unchanged.
Details of the first three phases went right into the file, with the forwarder being a bit more vague than the rest. What mattered the most is to start capturing and saving the real messages as soon as possible.
For the agent, I have added success criteria for each phase so that it was clear what "done" meant. I have used plain English (non-deterministic context) rather than writing tests manually upfront. Claude simply expanded my criteria into deterministic Python tests.
I believe this setup, combining traditional assertions/verification and a sense of direction for the agent from criteria narrative helped to build this solution with less prompting and less confusion. I rarely had to explain twice what done meant.
The subsequent phases were added once I made enough progress. I didn't want to be prescriptive about the entirety of the process as the learnings of the first phases could impact the rest.
Other posts in solar-dash series
- The challenge
- The vision
- Claude setup
- Phased approach
- Learning the protocol
- Managing agentic output
- Reflecting on agentic coding
- Conclusions