enforce-business-rules
Installation
SKILL.md
Enforce Business Rules
Use this skill BEFORE writing complex logic or AFTER generating code to ensure it adheres to the projects "Ironclad Business Laws".
1. Tenancy Laws (Multi-Tenancy)
Context: Single Database, Tenant-per-record (tenant_id).
- Rule T1 (Scoped Queries): NEVER query models directly without considering the Tenant Scope. Filament does this automatically, but custom Controllers/Jobs must manually apply
where('tenant_id', $tenant->id). - Rule T2 (Team Resolver): We use
spatie/laravel-permissionwith Teams.- The
team_idIS thetenant_id. - DO NOT use global roles for tenant-specific users. Use
RoleType::USERorRoleType::OWNERscoped to the tenant.
- The
2. Authorization Laws (RBAC)
Context: Hierarchical Access (Admin > Owner > User).