# Spec Driven Development Kit w/HexaLayered Architecture

> Source: <https://dev.to/agitrubard/spec-driven-development-kit-whexalayered-architecture-578i>
> Published: 2026-09-12 19:07:26+00:00

**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](https://github.com/agitrubard/hexalayered-architecture/pull/1)
