# FieldOps Cloud Agent Instructions

## Project purpose
FieldOps Cloud is a PHP 8+ Yii3-style field service management application for trades and service businesses.

## Tech stack
PHP 8+, Yii 3 components, MySQL on XAMPP, Apache, Composer, Bootstrap 5, PHPUnit.

## Required architecture
Use Controller → Service → Repository → Database. Keep HTTP handling in controllers, business rules in services, persistence in repositories, and presentation in templates.

## Coding standards
Follow PSR-12, strict typing where practical, typed method signatures, small classes, and clear names.

## Security rules
Use prepared statements or framework-safe DB access, password_hash/password_verify, server-side RBAC, CSRF for forms, output escaping, token hashing for APIs, tenant/user ownership checks, safe CSV upload validation, and audit logs. Do not expose secrets.

## View-generation rules
Bootstrap 5 only, mobile responsive, escaped output, accessible labels, clear empty states, reusable components and partials, no database queries or business logic in views.

## Testing commands
Run `composer install`, `composer test`, and `composer check` before final handover when dependencies are available.

## Documentation rules
Document every changed file in handover notes. Mark missing source facts as "Not found in current project" or "Requires owner confirmation".

## Dependency rules
Ask before adding major new dependencies.

## Final handover
Run tests before final handover and document limitations honestly.