This file documents preferences for how Claude should assist with this project.
Active Output Style: Learning
When implementing features:
- Use "Learn by Doing" format for implementation tasks involving design decisions
- Add
TODO(human)markers in code before requesting implementation - Provide Context, Task, and Guidance structure
- Wait for implementation before proceeding
Provide complete code examples for:
- Answering architectural/conceptual questions
- Explaining patterns and best practices
- Reference implementations during discussions
Use "Learn by Doing" guidance for:
- Active feature implementation
- Code involving design decisions (error handling, data structures, algorithms)
- Functions/methods 20+ lines with meaningful choices
- Business logic with multiple valid approaches
Always ask first before transitioning from discussion to implementation:
- "Would you like to implement this yourself with guidance?"
- Wait for explicit confirmation before using "Learn by Doing" format
CRITICAL: Always prioritize idiomatic Go patterns in every response.
When providing suggestions, code examples, or discussing architecture:
- Reference Go standard library patterns first - If stdlib does it, that's the idiomatic way
- Favor simplicity over cleverness - Go values clarity and readability
- Use descriptive names over abbreviations - Except for well-known conventions (ctx, err, etc.)
- Provide the "Go way" as the primary recommendation - Mention alternatives only if asked
Specific Go Idioms to Follow:
- Interfaces: Small, focused interfaces (often single-method); named with
-ersuffix - Constants: Prefix with type name when there are multiple similar types (
http.MethodGet,TypeSprinkler) - Errors: Return errors as last return value; use
errors.New()orfmt.Errorf() - Concurrency: Use channels for communication, mutexes for state;
sync.RWMutexfor read-heavy operations - Naming: Exported (PascalCase), unexported (camelCase); avoid stuttering (
fleet.Managernotfleet.FleetManager) - File organization: Name files after primary type or concern; flat structure until complexity demands subdirectories
- Nil checks: Two-value map lookups (
val, ok := map[key]), type assertions, channel receives - Resource cleanup: Use
deferfor cleanup operations immediately after acquisition - Dependency injection: Use interfaces, not concrete types; constructor functions return concrete types
When Unsure:
- Check Go standard library for similar patterns
- Favor the approach used in
net/http,database/sql,contextpackages - Prioritize readability and maintainability over brevity
IMPORTANT: Do NOT create git commits on my behalf
- I will handle all git commits myself
- You may suggest what should be committed
- You may help draft commit messages
- But you should NEVER run
git commitcommands
- Strategy Pattern for polymorphic behavior (self-injection)
- Three-layer pattern: Domain → Orchestration → Routing
- Context-based cancellation for long-running operations
- Channel-based async communication
Current Architecture:
- Fleet Management System (FMS) for IoT devices
- Pub/sub messaging with MessageBroker
- Task-based command system with ACK/NACK tracking
- Device agents with self-injection pattern
Naming Conventions:
DeviceAgentfor base fleet device infrastructureTaskHandlerinterface for polymorphic task handlingTaskStatefor broker-side tracking,TaskAckfor device feedback
All Core Features Complete!
- Phase 1: ✅ Complete (ACK/NACK Infrastructure)
- Phase 2: ✅ Complete (Completion Tracking)
- Phase 3: ✅ Complete (Retry Logic with Exponential Backoff)
- Phase 4: ✅ Complete (Dead Letter Queue)
See specs/completed/TASK_ACK_RETRY_SPEC_COMPLETE.md for implementation details.
Active Specs:
CONSTRUCTION_PATTERNS_SPEC.md- Construction patterns for device initializationDATABASE_MODELING_SPEC.md- Database schema and modeling
Completed Specs: (in specs/completed/)
TASK_ACK_RETRY_SPEC_COMPLETE.md- ACK/retry/DLQ implementation phasesMULTI_TOPIC_SUBSCRIPTION_SPEC_COMPLETE.md- Multi-topic subscription patternPUBSUB_IMPROVEMENTS_COMPLETE.md- Pub/sub system enhancements
Reference Documentation:
SELF_INJECTION_PATTERN.md- Strategy pattern explanationREADME.md- Project overview and learning journey