Development
Prerequisites
Section titled “Prerequisites”| Tool | Needed for |
|---|---|
| Docker (Docker Desktop, OrbStack, Colima, Linux Docker Engine; Podman with caveats, see below) | everything: PostgreSQL, Testcontainers, the SDK container |
| .NET 10 SDK on the host | aspire run and the Aspire E2E test (ADR-0008). Build, tests and the dev-container flow work without it, through the SDK container |
Aspire CLI 13.5 or later: dotnet tool install -g Aspire.Cli |
aspire run / aspire publish. A separate install from the SDK; the AppHost is on Aspire 13.6, and aspire --version shows what you have. Without it, dotnet run --project tools/ starts the same app |
PowerShell (pwsh) |
installing the Playwright browsers for the optional UI tests |
./scripts/doctor.sh checks this machine against the table, PowerShell aside, and changes nothing:
the SDK on PATH against global.json (its version and rollForward band), Docker and the SDK image
./scripts/dotnet.sh runs, the Aspire CLI, the development certificate, the AppHost's ports in
tools/Trellis.AppHost/Properties/launchSettings.json, the engine endpoint the tests get
(DOCKER_HOST and the Testcontainers overrides, below),
git, and jq where a script needs it. Each check is one line, ok, missing (with the fix, and
optional when a first run does without it) or skip, and the script exits 1 only when something a
first run needs is missing. ./scripts/doctor.sh --self-test runs every check against fakes, as CI does.
No .NET SDK on the host? Build the SDK image once (base SDK + docker CLI, needed by
Testcontainers/Aspire) and run every command through ./scripts/dotnet.sh:
docker build -t trellis-sdk:10.0 scripts/sdk-imageIDE: open in the dev container (no host SDK)
Section titled “IDE: open in the dev container (no host SDK)”Without a .NET SDK on the host an IDE cannot resolve types locally.
.devcontainer/devcontainer.json fixes that by running the IDE backend inside the same SDK
image the scripts use. With a host SDK you can skip this section and open the solution directly.
Rider: open the solution → Rider detects .devcontainer and offers "Reopen in Dev Container"
(or use File → Remote Development → Dev Containers). VS Code: Dev Containers: Reopen in Container.
You then get full IntelliSense, build, debug, and test in the IDE, while nothing is installed on the
host. The container mounts the Docker socket, so Testcontainers integration tests and the Aspire
orchestrator work from inside it too, and it shares the trellis-nuget package volume with
./scripts/dotnet.sh (same /workspace path, so build output stays valid across both).
Without the dev container the IDE will show unresolved-type errors for the whole BCL. That is expected on a host with no SDK — it is not a problem with the code.
Everyday commands
Section titled “Everyday commands”./scripts/dotnet.sh build Trellis.slnx # build./scripts/dotnet.sh test Trellis.slnx # all tests (Aspire E2E skips unless RUN_ASPIRE_E2E=1)./scripts/dotnet.sh format Trellis.slnx # apply formatting./scripts/ef.sh migrations add <Name> --project src/Infrastructure/Trellis.PersistenceDocker engines other than Docker Desktop
Section titled “Docker engines other than Docker Desktop”The SDK container starts the Testcontainers PostgreSQL as a sibling container through the
engine's socket, then reaches its published port via host.docker.internal. Docker Desktop
resolves that name by itself; everywhere else scripts/dotnet.sh, scripts/ef.sh and the dev
container map it to the host gateway (--add-host=host.docker.internal:host-gateway).
scripts/dotnet.sh picks the socket to mount like this:
| Setup | What to set |
|---|---|
| Docker Desktop, OrbStack, Linux Docker Engine | nothing: / |
| Colima (macOS) | nothing, with or without DOCKER_HOST: on macOS the engine runs in a VM and resolves mount sources there, so the script always mounts the VM's / |
| Rootless Docker (Linux) | DOCKER_HOST=unix:/, which the rootless setup tells you to set anyway; the script mounts that path |
| Podman 5+ (Linux) | DOCKER_HOST=unix:/ (after systemctl --user enable --now podman.); the docker CLI then drives Podman, or set DOCKER_BIN=podman. Rootless Podman also needs TESTCONTAINERS_RYUK_DISABLED=true, as Testcontainers recommends |
| Podman machine (macOS) | a rootful machine (podman machine set --rootful), its API socket in DOCKER_HOST (or DOCKER_BIN=podman), and TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/, the socket's path inside the VM |
A TCP endpoint (DOCKER_HOST=tcp://…) |
nothing: the script passes DOCKER_HOST through and mounts no socket. The address must be reachable from inside a container, so not 127.0.0.1 |
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE is the socket path as the engine sees it. When set it
overrides all of the above: the script mounts it and hands it to Testcontainers for its resource
reaper. Every other TESTCONTAINERS_* variable in your shell is forwarded into the container, so
the Testcontainers recipes apply
unchanged. The dev container mounts /var/run/docker.sock; for rootless Docker or Podman, change
the source= of that mount in .devcontainer/devcontainer.json to your socket. This
repository's own runs exercise two of these paths: Docker Desktop, and Linux Docker Engine in the
sdk-container CI job (scripts/dotnet.sh on ubuntu-latest). The others follow the engines'
and Testcontainers' documentation.
Secrets
Section titled “Secrets”Authentication:SigningKey gates API startup — missing or under 32 characters and the API
refuses to boot. appsettings.Development.json ships a dev-only key so F5 works out of the box;
to use your own, set a user secret (the API csproj has a UserSecretsId):
dotnet user-secrets set "Authentication:SigningKey" "<random 32+ chars>" \ --project src/Presentation/Api/Trellis.ApiUnder aspire run the API's e-mail goes to Mailpit, a local mail catcher the AppHost starts in run
mode only (below). Run any other way, it is logged, not sent, until you point the API at an SMTP relay
the same way (port 587 with STARTTLS is the default; leave out the last two lines for a relay without
authentication):
api=src/Presentation/Api/Trellis.Apidotnet user-secrets set "Email:Provider" "Smtp" --project $apidotnet user-secrets set "Email:Smtp:Host" "smtp.example.com" --project $apidotnet user-secrets set "Email:Smtp:FromAddress" "billing@example.com" --project $apidotnet user-secrets set "Email:Smtp:UserName" "<relay user>" --project $apidotnet user-secrets set "Email:Smtp:Password" "<relay password>" --project $apiTo see the mail without a relay, start the app with aspire run: the AppHost starts Mailpit and
points the API's Email section at it (Smtp, its SMTP endpoint, UseStartTls off, no credentials,
billing@example.com as the sender), and every message, the receipt of a paid invoice among them,
appears behind the mailpit resource's Inbox link in the dashboard. The AppHost's settings reach
the API as environment variables, which outrank user secrets, so a relay configured as above is used
only when the API runs from its own launch profile. Without the AppHost (the dev container flow), run
the catcher yourself (docker run --rm -p 1025:1025 -p 8025:8025 axllent/mailpit) and set
Email:Smtp:Host to localhost (host.docker.internal from the dev container), Email:Smtp:Port to
1025 and Email:Smtp:UseStartTls to false, with no credentials; messages appear at
http://localhost:8025.
Run these where the app runs (dev container or local SDK) — user secrets live under that
environment's home directory, so setting them through the ephemeral ./scripts/dotnet.sh
container does not persist. Never commit a real key; production takes it from the
environment/secret store (see deployment.md).
Running the app
Section titled “Running the app”Seeded admin for every option below: admin@example.com / Admin123!.
From the IDE, in the dev container (no local SDK)
Section titled “From the IDE, in the dev container (no local SDK)”aspire run cannot drive the app from inside a container — the orchestrator would run the
projects in the container while starting PostgreSQL as a sibling on the host, and the two cannot
reach each other (ADR-0008). Run the dependencies with Compose and the projects from the IDE:
docker compose up -d # PostgreSQL on host port 5433Then in Rider/VS Code, using the http (dev container) launch profiles — they point at
host.docker.internal:5433, because inside the dev container localhost is the container itself:
- Run Trellis.MigrationService (profile
migrate (dev container)) once — applies migrations and seeds. - Run Trellis.Api (profile
http (dev container)) → http://localhost:5171, which opens Scalar (/scalar/v1). - Run Trellis.UI.Web (profile
http (dev container)) → http://localhost:5170.
Any run configuration works, because devcontainer.json sets ASPNETCORE_ENVIRONMENT and the
connection string via containerEnv — every process in the container inherits them. That matters
because Rider generates two configurations per project and they look almost identical:
| Configuration | Type | Port |
|---|---|---|
Trellis.Api: http (dev container) |
.NET Launch Settings Profile | 5171 (5170 for the UI) |
Trellis.Api |
.NET Project — ignores launchSettings. entirely |
8080 (the SDK image default) |
The bare one runs the built binary with no arguments and none of the profile's environment, so
before the containerEnv fix it died with Connection string 'trellis-db' is not configured.
Prefer the profile configurations: only they give the API and the UI distinct ports.
Ports reach the host browser because Rider forwards them (the client binds 127.0.0.1:<port>) —
it forwards what forwardPorts declares, which is why 8080 is listed too. Never add appPort:
docker -p would bind the same host ports and collide with that forwarder.
Two gotchas worth knowing. The connection string is also passed as a command-line argument in the profiles, because the env form
ConnectionStrings__trellis-dbcontains a dash — not a valid POSIX shell identifier — sosh-wrapped launchers silently drop it. Andappsettings.Development.jsonpoints athost.docker.internal, with the hosthttp/httpsprofiles overriding back tolocalhost.
Port 5433, not 5432: a native PostgreSQL install commonly owns 5432, and the clash fails confusingly — it connects, then rejects the password. Override with
POSTGRES_PORTand match it in the launch profile. The cache for--use-redis, Valkey, is behind a profile:docker compose --profile redis up -d.
With a local SDK
Section titled “With a local SDK”aspire run # needs the Aspire CLI (Prerequisites)dotnet run --project tools/Trellis.AppHost # the same app, no CLI neededPostgreSQL, the migration worker, the API, the Blazor web app, and the Aspire dashboard, all
wired together (with --use-redis, the Valkey cache too), plus pgAdmin as a dashboard tile that
opens without a login and Mailpit, which catches the API's e-mail (its Inbox link opens it; see
Secrets); open the dashboard URL either command prints. This is the best loop when a host
SDK is available. The Aspire CLI reads the AppHost path from the committed aspire.config.json
(appHost.path), the project settings file it would otherwise create on first use.
PostgreSQL runs in a persistent container that keeps running after the app stops, so the next start
finds it ready; its data lives in a named volume. For a fresh database, stop the app and remove both:
docker rm -f the postgres-… container and docker volume rm the …-postgres-data volume
(docker ps -a and docker volume ls show their names).
From Rider or Visual Studio, run the Trellis.AppHost project. Visual Studio makes it the startup
project when it first opens the solution (DefaultStartup="true" in Trellis.slnx; a startup project
you choose later is remembered instead); in Rider, pick it in the run configurations yourself. Its
Properties/launchSettings.json has an https profile (the dashboard at https://localhost:17171)
and an http profile (http://localhost:15171, no certificate involved); the ports are picked free
when the solution is created, so this document names yours. The IDE's Aspire run configuration needs
one of them; without a launch profile it refuses to start, while dotnet run and aspire run fall
back to a dynamic dashboard URL. The https profile wants a trusted development certificate: run
dotnet dev-certs https --trust once (macOS and Windows prompt for confirmation), or use http.
The AppHost's own profile is the only one Aspire reads: the API, web and migration projects run
with ExcludeLaunchProfile = true and get their endpoints and connection string from Aspire
(the comment in tools/Trellis.AppHost/Program.cs says why). The AppHost reads its appsettings.json
from the project folder; it only sets log levels, so the dashboard's request logs stay out of the console.
On the first start against an empty database the migrations resource logs one red EF Core line,
Failed executing DbCommand … SELECT "MigrationId", "ProductVersion" FROM "__EFMigrationsHistory",
and PostgreSQL logs relation "__EFMigrationsHistory" does not exist. EF Core probes the history
table by querying it, then creates it and applies the migrations; the resource still exits with
code 0 and the API starts, because the API waits for exactly that. A real migration failure leaves
the API waiting, with the exception in the migrations console log.
Containerized smoke
Section titled “Containerized smoke”See the run-app skill — Postgres + migration worker + API (+ web) as sibling containers on one network.
Multi-tenancy (optional)
Section titled “Multi-tenancy (optional)”Generate with --use-multitenancy to add the tenant seam: ITenantContext, resolved from the
tenant claim only — minted at login from the user's persisted membership
(AspNetUsers.TenantId); there is no tenant header, and a token without the claim is rejected.
Every aggregate root automatically gets a TenantId shadow column stamped by TenantInterceptor
and a named "Tenant" EF query filter (opt out with IgnoreQueryFilters(["Tenant"])), and each
unique index it declares is unique per tenant: TenantId leads it, under the name it had. The seeded
admin and the demo data are in tenant default (Seed__TenantId); a self-registered user gets a
fresh tenant. See ADR-0019 and ADR-0022.
Because this adds a column, regenerate the initial migration in the generated project:
env -u TRELLIS_DESIGNTIME_DB ./scripts/ef.sh migrations remove --force --project src/Infrastructure/Trellis.Persistence./scripts/ef.sh migrations add InitialCreate --project src/Infrastructure/Trellis.Persistence--force because migrations remove otherwise asks a database whether the migration was applied and
stops when none answers. With it, the command reverts the migration on the database the design-time
connection reaches, when that database applied it (InitialCreate's Down drops every table), then
removes the files; when no database answers, it warns that it could not check and removes the files.
env -u TRELLIS_DESIGNTIME_DB makes sure none answers: scripts/ef.sh forwards that variable into the
SDK container, where the design-time factory's localhost default is the container itself. Use it only
on a migration no database you keep has applied.
UI tests (optional)
Section titled “UI tests (optional)”Generate with --include-ui-tests to add tests/Trellis.UiTests (Playwright). The project always
builds, but the browser tests are opt-in at run time — they need real browsers and a running app
at a known address. UI_TESTS_BASE_URL names it (default https://localhost:7170, the web host's
https launch profile). aspire run gives the web host a port of its own choosing, so either copy the
web URL from the dashboard into UI_TESTS_BASE_URL, or run the projects from their launch profiles
(migration job, then the API's and the web host's https profiles) so the default fits:
dotnet build tests/Trellis.UiTests # creates playwright.ps1pwsh artifacts/bin/Trellis.UiTests/debug/playwright.ps1 install chromium # onceRUN_UI_TESTS=1 UI_TESTS_BASE_URL=http://localhost:5170 dotnet test tests/Trellis.UiTests # the http profileWithout RUN_UI_TESTS=1 they skip, so the normal suite stays fast and browser-free
(the same opt-in pattern as the Aspire E2E test).
This section has a page of its own on the site: Testing. What each test project proves about which layer, what it needs to run, and when a test of yours belongs in it.
When the build fails
Section titled “When the build fails”RSLT001: This Result is discarded(a warning in Debug, an error in Release and CI). A statement computed aResult, aResult<T>or an ASP.NET Core IdentityIdentityResultand dropped it (ADR-0030):invoice.Issue(now);beforereturn Result.Success();commits a transition the aggregate refused, andawait handler.Handle(command, ct);in a test never checks the outcome. In this order: use it (return it,BindorMapit into the method's own result, or branch onIsFailure); in a test, assert it ((await handler.Handle(command, ct)).ShouldBeSuccess(), orresult.Error.ShouldBe(...)for an expected failure; an Identity call in a fixture goes throughIdentitySeed.EnsureSucceeded); drop it on purpose only when nothing can act on it, as_ = …;with a one-line comment saying why. Never a#pragmaor a severity line in.editorconfig. The same applies to a droppedError(a forgottenreturn), the UI'sApiResult<T>in a.razor@codeblock, and an array or tuple of results (await Task.WhenAll(...)over handlers).RSLT001: This Task<Result> is converted to Task, which drops its result. A member, lambda, variable or argument typedTaskwas handed aTask<Result>:public Task Handle(…) => port.PushAsync(…);finishes "successfully" when the push failed. Keep theTask<Result>(change the return type), or make the methodasync, await the call and act on theResult(an outbox handler throws on a failure it wants retried).CS9057naming the analyzer ("references version … of the compiler, which is newer than the currently running version"): the compiler is older than the Roslyntools/Trellis.Analyzersreferences. Build with the SDKglobal.jsonnames (dotnet --versionfrom the repository root shows which one runs); an IDE that hosts an older Roslyn only loses the squiggle, while the command-line build still enforces the rule. Bumping the SDK below says how far the pin may move.
When a request fails
Section titled “When a request fails”Every problem response carries traceId and code. Start from the traceId, not the correlationId,
which may be a value the caller chose: in the Aspire dashboard (or your OTLP backend) it finds the
request's trace, the use-case span with trellis.usecase.outcome, trellis.usecase.error_code and
trellis.usecase.error_type, and the outcome line logged inside it (events 1001–1006, docs/deployment.md
has the telemetry reference). A report without a traceId ("it failed for me this morning") starts from
the user's id instead: a signed-in caller's lines carry it in the CallerUserId scope and their request
spans as enduser.id. Then let the code name the stage that refused the request (the stage table is in
architecture.md):
code |
Refused by |
|---|---|
Http.* |
the host, before any endpoint: an unknown route, a wrong method, the 30 s request timeout |
Request.* |
binding: unreadable JSON, a value of the wrong type or a string holding U+0000 (errors[] names the field), a body too large or not JSON |
Auth.Unauthenticated, Auth.Forbidden, RateLimit.Exceeded |
authentication, authorization, rate limiting; the other Auth.* codes are the Auth use cases' own |
Idempotency.* |
the idempotency filter; Idempotency. also comes from the commit, when two first requests raced |
Validation.General |
a validator, or a value object the handler attributed with AtField: each errors[] entry's own code says which (Validation. against EmailAddress.) |
Concurrency.Conflict |
the commit: someone else changed the aggregate since it was loaded |
Invoice.*, Money.*, EmailAddress.*, any feature's area |
the handler and the aggregate: the feature doc's code list says what each means |
Four failures do not explain themselves:
Server.Failure(500). The body is opaque on purpose (ADR-0024). Under the sametraceIdlook for the Error lineUse case … threw(event 1006) with the exception; without one, the fault happened outside a use case (binding, a filter, work after the commit) and the exception handler logged it.- The migration job exits 1. It logs why: a
Seedvalue refused at boot, the default admin password outside Development, or a scoped service it cannot build, such as a new port with no system stand-in for a host without a request (deployment.md, and the MigrationService rules in.claude/rules/tools.md). - A retry keeps answering 409
Idempotency.InFlight. The first request committed and the process died before it stored the response; the command did apply. Read the resource, or see Idempotency keys for when the key frees itself. - A reaction has not happened (no receipt, no metric). The event waits in
OutboxMessages: in back-off after a failure (Attempts,Error), leased by a processor, or dead-lettered; Outbox operations reads the row and re-drives it.
Vulnerable packages (NuGetAudit)
Section titled “Vulnerable packages (NuGetAudit)”Restore audits the whole package graph, transitive packages included, against the GitHub Advisory
Database (NuGetAudit, NuGetAuditMode all, NuGetAuditLevel low in Directory.Build.props).
An advisory surfaces as warning NU1901–NU1904 (low to critical), which Release and CI builds treat
as an error, so an advisory published overnight can turn a green main red with no code change.
That is the point; respond in this order:
- Find the path. The warning names the package and links the advisory;
dotnet nuget why Trellis.slnx <package>shows which reference pulls it in. - Upgrade the direct reference in
Directory.Packages.propswhen a newer version of it (or of the package that depends on the vulnerable one) brings the fix. - Pin the transitive package otherwise: a
<PackageVersion Include="<package>" Version="<patched>" />inDirectory.Packages.propswith a comment naming the advisory (theMicrosoft.OpenApientry is the worked example).CentralPackageTransitivePinningEnabledapplies the pin to the transitive reference; delete it once the parent package depends on a fixed version itself. - Suppress only when no fixed version exists, or the vulnerable code provably cannot be
reached:
<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-xxxx-xxxx-xxxx" />in anItemGroupofDirectory.Build.props, with a comment saying why it does not apply here and when to look again. One advisory per entry, never a whole package. - Raise the level (
NuGetAuditLeveltomoderate) only as a recorded decision (an ADR) for a project that reviews low-severity advisories on a schedule rather than on the build that finds them; keepNuGetAuditModeall. The template's own CI stays atlow+all.
NU1900 is different: the advisory data could not be downloaded (offline, feed outage). It is not an advisory; retry once the feed is reachable.
Bumping the SDK
Section titled “Bumping the SDK”global.json pins the SDK with rollForward: latestFeature, and Dependabot proposes its feature-band
and patch updates (a new major version is a migration, not a bump). With a bump:
- CI installs exactly the version in
global.json(.github/actions/setup-dotnetreads it and installs that one from the release feed, so a release Microsoft is still publishing cannot fail a build); a contributor needs that version or a later feature band of the same major. - The SDK image (
scripts/sdk-image/Dockerfile, pinned by digest and moved by Dependabot's docker updates) must carry an SDK thatglobal.jsonaccepts, or./scripts/dotnet.shcannot build. Microsoft.CodeAnalysis.CSharpinDirectory.Packages.propsmay be raised up to the new compiler's version, never above (ADR-0030): the analyzer project references it, and a compiler older than the referenced version cannot load the analyzer.dotnet <dotnet root>/sdk/<version>/Roslyn/bincore/csc.dll -versionprints the compiler's version. Raising it is optional.
A new .NET major moves more than the SDK: the target framework, the SDK image's tag, and every package
numbered after .NET (Microsoft.AspNetCore.*, Microsoft.EntityFrameworkCore*, Microsoft.Extensions.*,
the Npgsql EF Core provider, dotnet-ef, Asp.Versioning.Http, Serilog.AspNetCore). Dependabot
proposes none of those majors (.github/dependabot.yml ignores them, as it ignores the SDK's), so the
move is one change you make on purpose; their patches and minors keep arriving before and after it.
Agent hooks
Section titled “Agent hooks”Claude Code runs the scripts in .claude/hooks/ around an agent's tool calls: .claude/settings.json
wires them, docs/INDEX.md lists them. Each backs a rule AGENTS.md already states, and none is the only
guard. They are rungs of the ladder ADR-0014 describes: a soft reminder, an ask before an edit the
conventions reserve to a generator or to someone's judgement, the AGENTS.md instruction, and the CI
check, which is the only guarantee.
| Hook | Runs on | Decides |
|---|---|---|
guard-edits.sh |
PreToolUse, Edit and Write |
asks before an edit under src/ or of docs/ (the reason names the command that regenerates it), a new ., an edit that adds a package to Directory. or a ., and an edit that adds a <Project> to the .; a version bump, a moved project and every other file pass without a prompt |
guard-commit.sh |
PreToolUse, Bash |
for a git commit: denies it when gitleaks is installed and finds a secret in the staged changes of the checkout the commit happens in; asks when the -m subject is not type(scope): subject (AGENTS., Commits); when gitleaks fails without a finding, the commit goes on and a message tells you the changes were not scanned |
stop-tests.sh |
Stop |
blocks the agent's stop once when the session changed a . or . file under src/ or tools/ and ran no dotnet test, asking for the run or a line saying why none is needed |
docs-drift.sh |
PostToolUse, Edit and Write |
reminds (context for the agent, never a block) when code changed without the doc that describes it, once per session for a given report |
An ask puts the reason in front of you, and you allow or refuse the call. The hooks follow Claude
into a worktree: the edit and commit hooks and the docs-drift reminder work in the git checkout that
holds the session's current folder, not only in the folder the session started in. What the hooks do
not see: guard-commit.sh reads the command before it runs, so git add … && git commit is scanned as
staged before the add, a message from a file (-F), an editor or --amend without -m is not
checked, and a git commit only quoted or echoed (grep "git commit -m") is not a commit;
stop-tests.sh counts a test run anywhere in the session, the subagents' transcripts included, and
only a Bash command that starts dotnet test or ./scripts/dotnet.sh test is a run (a quoted mention,
as in grep -rn "dotnet test" docs/, is not). ./scripts/check-hooks.sh is their self-test: it feeds
each hook the JSON Claude Code sends for every decision above, and for the silence next to each, checks
that every command in .claude/settings.json starts from a project path with a space, and fails on
any other answer. CI runs it on every push.
The hooks are Bash scripts. On Windows they need Git for Windows, whose Git Bash Claude Code runs them
with; without it, the two PreToolUse hooks fail, and "onFailure": "continue" in
.claude/settings.json lets the edit or the command go ahead rather than blocking it.
To add a hook, or a decision to one:
- A
casein the hook that owns the event and the tool, or a new script beside them that sourcescommon.sh(read_input,json_string,decide,json_escape) and exits 0 with no output whenever it is unsure. Nojq, only POSIXawk,sedandgrep, so it runs on macOS, Linux and Git Bash. - A row in
scripts/check-hooks.shfor the decision, and one for the nearby edit that must stay silent. - A line in
docs/INDEX.md(Hooks) with its event and decision and, for a new script, its entry in.claude/settings.json, the placeholder quoted ("\"${CLAUDE_PROJECT_DIR}\"/.claude/hooks/<name>.sh").scripts/check-adr-links.shfails when the INDEX line is missing or whensettings.jsonnames a script that does not exist; nothing checks that a new script is wired, so readsettings.jsonback.
In the template's repository a new script also joins the +x list of the "make scripts executable"
post-action in .template.config/template.json; without it a generated project gets the script without
its executable bit, which Template CI's generated hook self-test reports.
To turn the hooks off for yourself, set "disableAllHooks": true in .claude/settings.local.json
(git-ignored, so only your sessions change). A team that squash-merges commits each pull request's
title, which no hook sees; a three-line step in a ci.yml job that runs on pull_request checks it:
- name: Pull request title env: { TITLE: "${{ github.event.pull_request.title }}" } run: printf '%s\n' "$TITLE" | grep -Eq '^(feat|fix|docs|test|refactor|perf|build|ci|chore|style|revert)(\([a-z0-9][a-z0-9./-]*\))?!?:[ ][^[:space:]]'Conventions
Section titled “Conventions”Layer rules live in .claude/rules/ (they also guide AI agents). The short version: dependencies point inward, failures are Results not exceptions, migrations are generated not hand-edited, and no commercially-licensed packages (see the ceilings in Directory.Packages.props).
The documentation of Trellis.Templates 0.2.0 · release notes