From caa37cd64addea89e65a487bde64104f6ff7e3be Mon Sep 17 00:00:00 2001 From: James Cox Date: Tue, 24 Mar 2026 15:36:46 -0500 Subject: [PATCH] docs(agents): add repository agent workflow guide - Agent workflow: - add a root `AGENTS.md` focused on agent execution rather than general contributor onboarding - document the expected command surface, branch target, and staged verification order - Repo boundaries: - map the backend and frontend layout with the key source, resource, test, i18n, and asset paths - call out ownership boundaries for deploy, packaging, tools, docs, and shared assets - Project rules: - capture backend and frontend conventions that agents should follow before editing or validating work - include repo-specific PR expectations such as linked issues, test output, and UI evidence --- AGENTS.md | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..2a9997475 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,74 @@ +# Repository Guidelines + +## Agent Workflow + +- Start from the root `Justfile` unless you have a clear reason to drop into a subproject. +- Prefer `just api ...` and `just ui ...` over ad hoc commands. +- Keep changes scoped to the relevant project instead of mixing backend, frontend, deployment, and release edits in one pass. +- Target `develop`, not `main`. +- First prove the change with targeted tests around the edited surface, then run the wider suite for that surface before handing off. +- If you cannot run the wider suite, say exactly what you ran, what you skipped, and why. + +## Project Structure + +- **Backend (`booklore-api/`)** + - Application code: `src/main/java` + - Resources and Flyway migrations: `src/main/resources` + - Tests: `src/test/java` +- **Frontend (`booklore-ui/`)** + - Application code: `src/app/{core,features,shared}` + - Translations: `src/i18n/` + - Assets: `src/assets/` + +## Ownership Boundaries + +- `deploy/`, `packaging/`, `tools/`, `docs/`, and `assets/` are support surfaces. Do not change them unless the task actually touches deployment, packaging, release automation, or shared docs/assets. +- Keep backend, frontend, deployment, and release work separated unless the task genuinely crosses those boundaries. +- When a change spans multiple surfaces, validate each one explicitly. + +## Command Surface + +Use these first: + +```bash +just check # run backend + frontend verification +just test # run backend + frontend tests +just api run # start Spring Boot with the dev profile +just api test # run backend tests +just ui dev # start the Angular dev server +just ui check # run frontend verification +``` + +## Backend Rules + +- Use 4-space indentation and match surrounding Java style. +- Prefer constructor injection via Lombok patterns already used in the codebase. Do not introduce `@Autowired` field injection. +- Use MapStruct for entity/DTO mapping. +- Keep JPA entities on the `*Entity` suffix. +- Add Flyway migrations as new files named `V__.sql`. +- Do not edit released migrations in place. +- Prefer focused unit tests; use `@SpringBootTest` only when the Spring context is required. + +## Frontend Rules + +- Use 2-space indentation in TypeScript, HTML, and SCSS. +- Keep Angular code on standalone components. Do not add NgModules. +- Prefer `inject()` over constructor injection. +- Follow `booklore-ui/eslint.config.js`: component selectors use `app-*`, directive selectors use `app*`, and `any` is disallowed. +- Put user-facing strings in Transloco files under `booklore-ui/src/i18n/`. +- Keep responsive behavior intact. +- Use Vitest for tests. + +## Validation + +- Use staged verification: prove the behavior locally with targeted tests first, then run the wider suite for that surface. +- Typical backend path: `just api test` and then `just api check`. +- Typical frontend path: targeted Vitest coverage for the changed area and then `just ui check`. +- If the change crosses frontend and backend boundaries, finish with a repo-level pass such as `just test` or `just check`. +- Do not claim completion from a narrow test when a broader runnable suite exists. + +## PR Expectations + +- If UI behavior changes, capture screenshots or a short recording for the PR. +- PRs in this repo are expected to link an approved issue and include local test output. +- Follow Conventional Commits with scopes, for example `feat(devex): ...` or `fix(entrypoint): ...`.