Files
crewli/.claude/commands/review-multitenancy.md
bert.hausmans 05d1a6d31d chore(claude): add sprint-status, review-multitenancy, sync-docs commands
/sprint-status — branch, last package, uncommitted work, next BACKLOG item.
/review-multitenancy <Model> — model+migration+policy+tests checklist.
/sync-docs — runs the dev-docs sync pipeline and reminds to upload .claude-sync/.

Each command's frontmatter declares a least-privilege allowed-tools list.
2026-05-05 23:24:58 +02:00

27 lines
1.2 KiB
Markdown

---
description: Check a model + migration + policy + tests for multi-tenancy correctness
argument-hint: [model-name]
allowed-tools: Read, Grep, Glob
---
Target: $ARGUMENTS
Locate and read all four artefacts:
1. The Eloquent model — `app/Models/$ARGUMENTS.php` (or matching path under `app/Models/`).
2. The most recent migration that creates or modifies the table.
3. The policy class — `app/Policies/${ARGUMENTS}Policy.php`.
4. Pest tests for the model — search `tests/` for the class name.
Verify each item against /dev-docs/SCHEMA.md and /CLAUDE.md, marking PASS / FAIL / N/A with one-line reasoning:
- [ ] Primary key is ULID (`ulid('id')->primary()` in migration; `HasUlids` trait on model)
- [ ] `OrganisationScope` registered in model `booted()` (NOT merely imported)
- [ ] FK chain reaches `organisations.id` within ≤2 hops
- [ ] Policy class exists and is registered in `AuthServiceProvider::$policies`
- [ ] All status/type/category columns use a PHP Enum cast
- [ ] Soft delete decision matches the type's row in /dev-docs/SCHEMA.md
- [ ] Pest tests include a cross-org leak assertion
- [ ] Activity log trait present (if state-changing)
End with a verdict line: `READY` or `NEEDS WORK`.