From 9c9734881f971864abe419b50341e2215e64ca31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Fri, 27 Nov 2026 03:04:50 +0100 Subject: [PATCH 1/3] Engineering standards: link the canonical docs/ENGINEERING.md (golang-template) and summarise the non-negotiables for agents --- AGENTS.md | 16 ++++++++++++++++ CLAUDE.md | 3 +++ 2 files changed, 19 insertions(+) create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..fe41c4b --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,16 @@ +# Instructions for AI coding agents + +## Engineering standards (non-negotiable) + +The full text is `docs/ENGINEERING.md` in the golang-template repository (github.com/jetlio/golang-template; locally `~/Work/golang-template/docs/ENGINEERING.md`). Read it before designing or changing code, and say in the plan how the change meets it. References: golang-template, and in backend-mono `apps/monitor` (layout, wiring, lint-enforced layers, apperr) and `apps/assistant` (huma). **Never copy patterns from older services.** + +1. **One source of truth.** Generate from the owner of a fact: OpenAPI → clients, catalogs → constants, migrations → sqlc. Never hand-edit generated code; CI checks for drift. +2. **Clean layers.** handler → service → repo, with dto and mapper beside them, enforced by lint. +3. **Dependency injection.** Use `Deps`/`Options` in one composition root. No global state, no singletons. +4. **Typed vocabularies.** Enums, statuses, events and error codes are typed constants or generated. No magic strings or numbers. Configuration is declared once. +5. **Secure by design.** Deny by default. Guard every route from the permission catalog; scope tenants in the query itself. Hash or seal secrets, wire up validation, send outbound calls through the SSRF-safe client, redact logs, keep an audit trail. +6. **Reliable.** A deadline on every outside call, bounded retries, atomic changes, an outbox for side effects, supervised workers (never a bare `go func()`), graceful shutdown. +7. **Bounded and scalable.** Sizes, pages and concurrency are capped. Nothing assumes a single replica. +8. **Errors.** Domain errors map to RFC 9457 problems with enumerated codes. Internals never leak. +9. **Tested at the boundaries,** including authorization denials. Every security fix gets a regression test. +10. **Process.** Docs ship with the change. Short-lived branches and PRs, commits with explicit paths, pinned tool versions. Spikes are labelled as spikes. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..cbe4b95 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,3 @@ +# CLAUDE.md + +Read [AGENTS.md](AGENTS.md): it holds the non-negotiable engineering standards (full text: golang-template `docs/ENGINEERING.md`). From ae3ff98766c7e4c9c3a1c177339c59182dbeeea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Fri, 27 Nov 2026 03:11:47 +0100 Subject: [PATCH 2/3] Engineering standards: full testing chapter, operations, change safety, supply chain, privacy, design records; per-repo test commands --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index fe41c4b..2f5d63a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -12,5 +12,5 @@ The full text is `docs/ENGINEERING.md` in the golang-template repository (github 6. **Reliable.** A deadline on every outside call, bounded retries, atomic changes, an outbox for side effects, supervised workers (never a bare `go func()`), graceful shutdown. 7. **Bounded and scalable.** Sizes, pages and concurrency are capped. Nothing assumes a single replica. 8. **Errors.** Domain errors map to RFC 9457 problems with enumerated codes. Internals never leak. -9. **Tested at the boundaries,** including authorization denials. Every security fix gets a regression test. +9. **Tested and automated.** Unit tests, integration tests (the real server against Postgres), contract tests (the authorization matrix including denials, generated-code drift), component and e2e tests (frontend, Playwright against the seeded stack), and smoke tests after every deploy. Every fix starts with a failing test. CI gates are real: never `|| true`. Change safety: additive APIs, expand → contract migrations, flags, rollback. 10. **Process.** Docs ship with the change. Short-lived branches and PRs, commits with explicit paths, pinned tool versions. Spikes are labelled as spikes. From 5799d57e0da606df3861e52e5664cf21316eaa79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0v=C3=A1b=C3=ADk?= Date: Fri, 27 Nov 2026 03:36:38 +0100 Subject: [PATCH 3/3] Engineering standards: no internal references in this public repository --- AGENTS.md | 2 +- CLAUDE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 2f5d63a..1162a33 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ ## Engineering standards (non-negotiable) -The full text is `docs/ENGINEERING.md` in the golang-template repository (github.com/jetlio/golang-template; locally `~/Work/golang-template/docs/ENGINEERING.md`). Read it before designing or changing code, and say in the plan how the change meets it. References: golang-template, and in backend-mono `apps/monitor` (layout, wiring, lint-enforced layers, apperr) and `apps/assistant` (huma). **Never copy patterns from older services.** +These are the Norcube team's non-negotiable engineering standards (the full text is an internal document). Check every design and change against them and say in the plan how it meets them. Never copy patterns from older code that breaks them. 1. **One source of truth.** Generate from the owner of a fact: OpenAPI → clients, catalogs → constants, migrations → sqlc. Never hand-edit generated code; CI checks for drift. 2. **Clean layers.** handler → service → repo, with dto and mapper beside them, enforced by lint. diff --git a/CLAUDE.md b/CLAUDE.md index cbe4b95..4296b11 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,3 +1,3 @@ # CLAUDE.md -Read [AGENTS.md](AGENTS.md): it holds the non-negotiable engineering standards (full text: golang-template `docs/ENGINEERING.md`). +Read [AGENTS.md](AGENTS.md): it holds the non-negotiable engineering standards.