# AI Agent Rules for Go Projects

**⚠️ READ AGENTS_RULES.md FOR COMPLETE DOCUMENTATION**

This is a quick reference. Full rules are in `AGENTS_RULES.md`.

## Quick Reference

### Workflow
1. **Plan** → Discuss with user
2. **Test** → Write failing tests first (TDD)
3. **Develop** → Implement with Go best practices
4. **Test** → `go test ./... -cover` (90% coverage minimum)
5. **Commit** → Get user approval first

### Go Best Practices
- **Error handling**: Always check errors, wrap with context
- **Interfaces**: Accept interfaces, return structs
- **Concurrency**: Use goroutines, channels, context.Context
- **Zero values**: Design for useful zero values
- **Defer**: Use for cleanup (files, locks, etc.)

### Code Quality
- ❌ No default values to hide errors
- ✅ Fail fast and explicit
- ✅ Consistent error handling
- ✅ Extract reusable functions

### Testing
```bash
go test ./... -v -cover -coverprofile=coverage.out
go tool cover -html=coverage.out
```

### Git Rules
- ❌ NEVER `git stash`
- ❌ NEVER `git push` or `git push --force`
- ✅ ALWAYS ask user approval before commit

### Commit Format
```
<type>(agt): <description>

Types: feat, fix, refac, chore, doc, test
Example: feat(agt): add user authentication with JWT
```

### Tools
```bash
go build          # Build
go test ./...     # Test
go fmt ./...      # Format
go vet ./...      # Static analysis
golangci-lint run # Lint
go mod tidy       # Clean dependencies
```

---

**📖 For complete rules, examples, and detailed guidelines:**
**Read `AGENTS_RULES.md` in this directory**
