Skip to content
  • Beginner

Your first architecture definition

If you are not yet convinced that you need katachi, read Motivation first.

  1. Start the AI agent you use and give it this prompt.

    Set up katachi in this project.
    - Follow https://tbsten.github.io/katachi/install/en/index.md to do it.
    • Putting the project under git first is recommended.
    • The page the AI agent reads tells it to set katachi up together with you.
    Additional options
    • If your architecture documentation lives outside the codebase (in Notion, for example), include a link to it in the prompt.
    • By default the AI agent creates an architecture-test module and writes the architecture definition there.
      • To use a different module, add a prompt such as Create the test in <module>.
    • As a matter of context hygiene, start a fresh session dedicated to setting up katachi.
      • For Claude Code or Codex CLI: clear the session with /clear, then enter the prompt.
  2. Review the changes the AI agent made to your project and adjust them as needed.

    What to look at:

    • architecture-test/src/test/kotlin/<package>/ProjectArchitecture.kt is the entry point.
    • The AI agent splits the architecture definition into one file per group and per Role, and puts them in packages under ProjectArchitecture.kt. Review those files too.
    • If you work in a team, have your teammates (especially whoever leads it) review this closely as well.
  3. Run the architecture test and confirm that it is all green.

    Terminal window
    ./gradlew :architecture-test:test

    That completes the setup.

Hand the AI agent a real task and see that it no longer produces files that break the architecture rules.

If you have implementation tasks coming up

If you have tasks that are actually coming up, running one of them as a trial is the best way to measure whether katachi does its job. Hand the task to the AI agent and let it run.

If the task is tracked in JIRA, Notion, or similar, passing those along works well too.

If you have nothing in particular

Have the AI agent invent a hypothetical task and check whether katachi works as a guardrail.

Come up with a few hypothetical tasks that are likely to come up in this project.

To keep the quality up, run the katachi architecture test regularly by wiring it into CI.

Add a workflow file like this one.

.github/workflows/architecture.yml
name: Architecture
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
architecture:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '17'
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew :architecture-test:test