From 91cc08614d03aaef6e7444c34890d8f6eeffe86d Mon Sep 17 00:00:00 2001 From: yisroel Date: Wed, 6 May 2026 14:37:39 +0300 Subject: [PATCH] init: agent context files --- AGENTS.md | 7 +++++ ai/backend-context.md | 49 ++++++++++++++++++++++++++++++ ai/frontend-context.md | 36 ++++++++++++++++++++++ ai/shared.md | 69 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 161 insertions(+) create mode 100644 AGENTS.md create mode 100644 ai/backend-context.md create mode 100644 ai/frontend-context.md create mode 100644 ai/shared.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..5dea88b --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,7 @@ +# Project context + +Read these on every session. Rules in them override defaults. + +@ai/shared.md +@ai/backend-context.md +@ai/frontend-context.md diff --git a/ai/backend-context.md b/ai/backend-context.md new file mode 100644 index 0000000..3d9201a --- /dev/null +++ b/ai/backend-context.md @@ -0,0 +1,49 @@ +# Backend context + +> Read `ai/shared.md` first. This file only covers backend-specific rules. + +## Project Context + +**Stack:** PHP 8.4, Laravel 12, PHPUnit, Composer. +**Architecture:** Domain-Driven Design. Code is organized by domain entity into +Entities, DTOs, Repositories, Use Cases, and Fakes (in-memory repos for tests). + +## Code patterns + +- Look at similar entities (e.g. `AgendaSlot`, `Event`) for reference +- Entities: constructor with properties, getters +- DTOs: simple data containers for creation +- Repositories: interfaces that define data access +- Use cases: business logic with Request objects + - When throwing exceptions, add `@throws` docblock +- Fakes: in-memory implementations for testing + - Look at `tests/Fakes/` for examples + - Find/lookup methods must return a new instance of the entity, not the + stored reference +- Tests: follow existing patterns in `tests/Unit/[Entity]/UseCases/` + - In `setUp`, only use fake repositories for entities under test - construct + dependency objects directly with `new` (e.g. + `new Event(id: 0, slug: 'test')`) instead of creating them through their + fake repositories + +## PHP rules + +- Imports: always put `use` statements at the top of the file, never use inline + imports (e.g. `\App\Foo\Bar::class`) +- Closures: never use arrow functions (`fn () =>`) - always use regular + anonymous functions (`function () { return ...; }`) +- Defaults: never use default values for function or constructor parameters - + every argument must be passed explicitly at every call site, including + nullable params (write `?Foo $bar` not `?Foo $bar = null`) + +## Seeders + +- Split `database/seeders/` one file per domain entity (e.g. `UserSeeder`, + `StartupUserProfileSeeder`), not one per scenario +- `DatabaseSeeder` stays as the orchestrator - calls sub-seeders via + `$this->call([...])` in dependency order +- Resolve cross-entity coupling with `findByX` lookups in later seeders + +## Pre-commit + +Run `composer cs:fix` on worked-on directories before committing. diff --git a/ai/frontend-context.md b/ai/frontend-context.md new file mode 100644 index 0000000..0517fc6 --- /dev/null +++ b/ai/frontend-context.md @@ -0,0 +1,36 @@ +# Frontend context + +> Read `ai/shared.md` first. This file only covers frontend-specific rules. + +## Project Context + +**Stack:** Vue 3.5 (Composition API, `