# Cursor AI Agent Rules for PHP Projects

**⚠️ IMPORTANT: This file is specifically for Cursor IDE**

For complete AI agent rules that work with any AI assistant (Cursor, GitHub Copilot, ChatGPT, Claude, etc.), please read:

## 📚 Complete Rules

**[AGENTS_RULES.md](./AGENTS_RULES.md)** - Complete AI agent rules (works with all AI assistants)

This file contains all the detailed rules, workflows, and guidelines for PHP projects.

---

## Quick Summary for Cursor

### Workflow
1. **Learning** → Read README.md and CONTRIBUTING.md
2. **Planning** → Discuss and get approval for todo-list
3. **Test** → Write tests first (TDD)
4. **Development** → Implement with PHP best practices
5. **Commit** → Only after tests pass (90% coverage) and user approval

### Key Principles
- ✅ Test-Driven Development (TDD) - 90% minimum coverage
- ✅ Domain-Driven Design (DDD) - Business vocabulary first
- ✅ Result pattern - Railway-Oriented Programming
- ✅ Fail-fast error handling - No default values to mask issues
- ✅ Type safety - Wrap primitives in readonly classes
- ✅ Strict types - `declare(strict_types=1)` in EVERY file
- ✅ Readonly properties - For immutable value objects
- ✅ Enums - For closed sets of values (PHP 8.1+)
- ✅ Named arguments - For clarity
- ✅ PSR standards - Follow PHP-FIG standards

### Build & Test
```bash
# Composer
composer install

# PHPUnit
./vendor/bin/phpunit --coverage-html coverage/

# Code quality
./vendor/bin/phpstan analyse
./vendor/bin/php-cs-fixer fix
```

### Git Commit Format
All commits must use the `(agt)` prefix:
- `feat(agt):` - New feature
- `fix(agt):` - Bug fix
- `refac(agt):` - Refactoring
- `chore(agt):` - Cleanup
- `doc(agt):` - Documentation
- `test(agt):` - Tests only

**Remember**: Always ask permission before committing!

---

## 📖 For Complete Details

Read **[AGENTS_RULES.md](./AGENTS_RULES.md)** for the complete set of rules, examples, and guidelines.

This approach allows:
- ✅ Cursor to use this lightweight file
- ✅ Other AI agents to use AGENTS_RULES.md
- ✅ All documentation in one place
- ✅ Easy maintenance and updates
