General
Spec Driven Development Kit w/HexaLayered Architecture
Agit Rubar Demir DEV Community 周榜
22 views
Something has bothered me ever since I wrote HexaLayered Architecture.
The documentation was good, the examples were good, the rules were clear. But the rules only worked if someone read them. A new developer would join a project and use TicketEntity in the service layer. I would see it in the pull request. Sometimes I did not see it, and it was merged.
Some time ago I sat down and turned the architecture into something Claude Code can read and apply. There is a .claude directory in the repo now.
Inside it there is a file called constitution.md. It keeps the rules of the architecture, not as advice like "you should do it this way", but as rules you can test. Which classes are public, which ones are package-private, how far an entity can go up through the layers.
There is also a Spec Driven Development flow. /hexa:specify writes down what will be built, /hexa:plan writes down which class goes into which package, and the code comes after that. Nobody has to ask "where does this class go?" when the file is already open.
I also added a shell script that runs on every file write. If a service imports an entity, if a Controller is still public, if a class reaches into another module's repository, the script exits with code 2 and the error goes straight back to the model. It does not wait for the code review.
While I was testing it, I found a bug in my own script, but that is another story.
You only need two commands to move it to another project:
cp -r .claude .
/hexa:bootstrap
bootstrap finds the base package, the build tool (Maven or Gradle) and the test command by itself. When you start a Spring Boot project from zero, the architecture is correct from the first commit.
I took the rules from the README, then checked them on ays-be. It is a real project that uses the architecture, so it was a good test.
🔗 https://github.com/agitrubard/hexalayered-architecture/pull/1
SpecDrivenDevelopment #HexaLayered #HexaLayeredArchitecture #Claude #ClaudeCode #CleanCode #HexagonalArchitecture #LayeredArchitecture #DDD #SpringBoot #Java
Read original: https://dev.to/agitrubard/spec-driven-development-kit-whexalayered-architecture-578i
← Previous
Mapping Page Ranges to Output Files: A Data-Driven Decision Tree for PDF Splits
Next →
Haykel Web tool - Comic to HTML5
Related
Semantic tag vs Non-Semantic tag
General
51
Dev.to (EN Zone)
How LinkedIn "Bold" Text Actually Works (It's Not Bold At All)
General
43
Dev.to (EN Zone)
Google ADK Callbacks Are a Policy Plane, Not Just Hooks
General
44
DEV Community 周榜
How I Modelled My Power BI Data — Data Modelling, Relationships & Joins (Kenya Crops Dataset)
General
41
DEV Community 周榜
Comments0
No comments yet — be the first