LESSON 4

The Walking Skeleton: Project Setup and Working Agreements

Create a runnable project skeleton that reflects the architecture, enforces module boundaries, and runs automated checks from the first commit.

Introduction

The first code in a project sets the pattern that all later code, human or generated, will follow. If the first commit has no tests, no boundaries, and no way to run it, assistants will faithfully reproduce that.

A walking skeleton is the thinnest possible implementation that runs end to end and exercises the main architectural components: a request goes in, passes through each layer, touches the database, and returns a result. It is the first deliverable of the architecture and the foundation of the first sprint.

Learning Objectives

  • Define a walking skeleton and explain why it reduces risk.
  • Translate an architecture into a repository structure with enforced module boundaries.
  • Set up formatting, linting, type checking, testing, and a one-command quality gate.
  • Manage configuration and local environments reproducibly.
  • Use AI to scaffold safely, including checking generated dependencies.
  • Write a Definition of Done that the team and the assistant both follow.

1. What the Skeleton Contains

For SignalDesk’s modular monolith with a worker and a relational database (illustrative):

  • A web application with a health endpoint and one trivial API route.
  • A database connection and a first migration.
  • A background worker that picks up and completes one trivial job.
  • One test of each kind you plan to have: unit, integration (with a real database), and a minimal end-to-end check.
  • A quality gate command, and a CI configuration that runs it.
  • A way to start everything locally with one or two commands.

The skeleton does no real business logic. Its purpose is to prove that the pieces connect and that the team can change, test, and run the system. It also tests your architecture’s riskiest assumptions early, matching the spikes and first slice recommended in the architecture course.

2. Repository Structure That Reflects the Architecture

A modular monolith is only modular if the boundaries are visible and enforced.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
signaldesk/
  README.md
  CONTRIBUTING.md
  ASSISTANT_INSTRUCTIONS.md       # the instruction file from lesson 2
  Makefile                        # make run | test | check | migrate
  pyproject.toml
  docker-compose.yml              # local database
  .env.example
  src/signaldesk/
    app.py                        # web entry point
    worker.py                     # background worker entry point
    config.py
    workspaces/    api.py  service.py  repository.py  models.py
    imports/       api.py  service.py  repository.py  models.py
    evidence/      ...
    summaries/     ...
  migrations/
  tests/
    unit/  integration/  e2e/
  docs/
    adr/  prompts/

Each module exposes a small public interface (api.py here) and hides the rest. Other modules call only that interface.

Enforce the boundary with a tool, not a promise. Most ecosystems have dependency-rule checkers (import linters, architecture tests, module systems). Configure one so that a forbidden import fails the build. This is exactly the kind of rule assistants break unintentionally, because the shortcut works at runtime.

3. The Quality Gate

Define one command that every contributor and the CI pipeline run:

1
2
3
4
5
6
7
make check:
  1. format check       (code is formatted consistently)
  2. lint               (common errors and style issues)
  3. type check         (types are consistent)
  4. dependency rules   (module boundaries respected)
  5. tests              (unit, integration)
  6. secret scan        (no committed secrets)

The gate is the assistant’s feedback loop. If your tool can run it, the assistant sees failures and can correct itself. If it cannot, you run it and paste the output. Keep the gate fast, so that people actually run it before every commit.

4. Configuration and Environments

  • Read configuration from environment variables; commit only .env.example.
  • Never commit real credentials. Use separate values per environment.
  • Make local setup reproducible: one command starts the database and dependencies, one command runs migrations, one command starts the app.
  • Pin dependency versions with a lock file so that builds are repeatable.

A newcomer, or you in six months, should be able to run the project from a clean checkout by following the README, without help. Test this: clone to a new directory and follow your own instructions.

5. Scaffolding With AI

Assistants are good at scaffolding, and also at producing subtly wrong, outdated, or over-engineered setups. Direct them carefully.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Context:
- Architecture summary and module list: [paste]
- Stack: [language, web framework, database, test tools]
- ASSISTANT_INSTRUCTIONS.md: [paste]

Task: Propose the repository structure and scaffold the walking
skeleton described below. Do this in steps; first give the plan.

Constraints:
- Use only well-known, actively maintained libraries; list each
  dependency and why it is needed.
- Keep the skeleton minimal: no business logic, no unused abstractions.
- Include a health endpoint, one migration, one worker job, and one
  test each of unit, integration, and end-to-end.
- Provide a Makefile with run, test, check, and migrate targets.

After scaffolding, list everything I should verify by hand.

Then review the result:

  • Check every dependency exists and is the one you intend. Assistants sometimes suggest packages that do not exist or have confusingly similar names to real ones, and attackers register such names. Look up each package, its maintainers, and its recent activity before installing.
  • Check versions. Generated setups often use outdated versions or deprecated APIs.
  • Remove what you do not need. Over-generated scaffolding becomes maintenance burden.
  • Run it from scratch. If it does not start, you have learned something about the generated setup.

6. Working Agreements

Working agreements make the team’s expectations explicit, for people and for assistants. Keep them short and put them in the repository:

  • Definition of Done: code reviewed; make check passes; tests cover the acceptance criteria; documentation updated if behavior or setup changed; no new secrets; requirement referenced.
  • Branching and commit rules (lesson 3).
  • Review expectations: who reviews, how quickly, what is checked.
  • Dependency policy: adding a dependency requires a stated reason and a check of license and maintenance status.
  • AI usage rules: which tools, what data, how involvement is noted.
  • Ownership: who decides when a convention should change.

7. Practical Exercise

For SignalDesk (or your project):

  1. Using your architecture, define the repository structure and module list.
  2. Scaffold the walking skeleton, with or without AI, and verify each dependency.
  3. Configure formatter, linter, type checker, dependency-rule checker, test runner, and secret scan under a single make check.
  4. Add a CI configuration that runs the gate on every pull request.
  5. Prove the boundary rule works: write a deliberate forbidden import and confirm the gate fails.
  6. Clone the repository into a fresh directory and follow the README to run the app, worker, and tests. Fix the README where it is wrong.
  7. Write the Definition of Done and place it in CONTRIBUTING.md.

Verification

You are ready to continue when:

  • The skeleton runs end to end from a clean checkout using only the README.
  • make check (or equivalent) runs all checks locally and in CI.
  • A forbidden cross-module import fails the build.
  • Every dependency has been verified and has a recorded reason.
  • The Definition of Done is written and agreed.

Key Takeaways

  • A walking skeleton proves the architecture connects and gives the team a safe base to build on.
  • Enforce module boundaries with tools, not good intentions.
  • One fast quality gate gives people and assistants the same feedback loop.
  • Verify every generated dependency and version before trusting it.
  • Working agreements make expectations explicit for the whole team.

What’s Next?

With a skeleton and a safety net, we can build real features. Next, we implement the first vertical slice from specification to verified code.