Skip to content

Commit 3077e5b

Browse files
committed
add initial set of prompt files
1 parent b7fa75f commit 3077e5b

3 files changed

Lines changed: 436 additions & 0 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
mode: agent
3+
description: "Implement comprehensive error handling for AimDB components with platform-specific considerations"
4+
---
5+
6+
# AimDB Error Handling Implementation
7+
8+
## Task Definition
9+
10+
Implement comprehensive error handling for a specified AimDB component with the following requirements:
11+
12+
### Requirements
13+
- **Error Types**: Define appropriate error types for the component (network/parsing/validation/timeout/resource_exhaustion)
14+
- **Recovery Strategies**: Implement recovery mechanisms (retry/fallback/circuit_breaker/graceful_degradation)
15+
- **Platform Considerations**: Handle differences between embedded/edge/cloud environments
16+
- **Observability**: Include logging, metrics, and tracing for error scenarios
17+
18+
### Constraints
19+
- Follow AimDB's async-first design principles
20+
- Use `thiserror` for error definitions and `anyhow` for error contexts
21+
- Maintain `no_std` compatibility for embedded targets
22+
- Target <50ms reactivity even during error conditions
23+
- Minimize allocations in error paths for embedded environments
24+
25+
### Success Criteria
26+
- [ ] Comprehensive error type definitions using `thiserror`
27+
- [ ] Proper error chaining and context with `anyhow`
28+
- [ ] Retry logic with exponential backoff and jitter
29+
- [ ] Circuit breaker implementation for network operations
30+
- [ ] Graceful degradation strategies with fallback options
31+
- [ ] Structured logging with appropriate log levels
32+
- [ ] Error metrics collection for monitoring
33+
- [ ] Platform-specific error handling (embedded vs edge vs cloud)
34+
- [ ] Comprehensive unit tests for error scenarios
35+
- [ ] Documentation of error handling strategies
36+
37+
## Implementation Guidelines
38+
39+
### Error Type Structure
40+
```rust
41+
use thiserror::Error;
42+
43+
#[derive(Error, Debug)]
44+
pub enum ComponentError {
45+
#[error("Configuration error: {message}")]
46+
Config { message: String },
47+
48+
#[error("Network operation failed")]
49+
Network(#[from] NetworkError),
50+
51+
#[error("Timeout after {duration:?}")]
52+
Timeout { duration: std::time::Duration },
53+
54+
#[error("Resource exhausted: {resource}")]
55+
ResourceExhausted { resource: String },
56+
57+
#[error("Protocol error: {protocol} - {message}")]
58+
Protocol { protocol: String, message: String },
59+
}
60+
```
61+
62+
### Recovery Strategy Implementation
63+
- Implement retry with exponential backoff for transient failures
64+
- Use circuit breaker pattern for external service calls
65+
- Provide graceful degradation with fallback mechanisms
66+
- Include timeout handling for all async operations
67+
68+
### Platform-Specific Considerations
69+
- **Embedded**: Use heapless data structures, minimal error types
70+
- **Edge**: Balance between functionality and resource constraints
71+
- **Cloud**: Full error handling with comprehensive observability
72+
73+
### Observability Requirements
74+
- Use `tracing` for structured logging
75+
- Implement error metrics collection
76+
- Include error context in all error paths
77+
- Provide clear error messages for debugging
78+
79+
## Output Format
80+
81+
Provide the implementation in the following structure:
82+
1. Error type definitions
83+
2. Recovery strategy implementations
84+
3. Component integration code
85+
4. Unit tests for error scenarios
86+
5. Documentation of error handling approach
Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
---
2+
mode: agent
3+
description: "Break down complex AimDB features into structured, actionable tasks with proper dependencies and platform considerations"
4+
---
5+
6+
# AimDB Task Planning and Breakdown
7+
8+
## Task Definition
9+
10+
Create a structured task breakdown for implementing a specified AimDB feature with proper sequencing, dependencies, and platform considerations.
11+
12+
### Requirements
13+
- **Feature Scope**: Define clear boundaries and deliverables for the feature
14+
- **Task Granularity**: Break down into manageable tasks (4-8 hours each)
15+
- **Platform Coverage**: Consider embedded/edge/cloud implementation differences
16+
- **Dependencies**: Identify task dependencies and critical path
17+
- **Risk Assessment**: Identify potential blockers and mitigation strategies
18+
19+
### Constraints
20+
- Follow AimDB's async-first architecture principles
21+
- Maintain compatibility across all target platforms (MCU/edge/cloud)
22+
- Ensure tasks align with performance requirements (<50ms reactivity)
23+
- Consider memory constraints for embedded targets
24+
- Include testing and documentation tasks
25+
- Respect existing API contracts and interfaces
26+
27+
### Success Criteria
28+
- [ ] Feature broken down into implementable tasks (4-8 hours each)
29+
- [ ] Clear task dependencies and sequencing identified
30+
- [ ] Platform-specific considerations documented
31+
- [ ] Risk assessment with mitigation strategies
32+
- [ ] Acceptance criteria defined for each task
33+
- [ ] Testing strategy integrated into task plan
34+
- [ ] Documentation requirements specified
35+
- [ ] Resource allocation and timeline estimates
36+
37+
## Planning Framework
38+
39+
### Task Categories
40+
41+
#### 1. Core Implementation Tasks
42+
- **Engine/Database**: Core data processing and storage
43+
- **Networking**: Protocol connectors and bridges
44+
- **Adapters**: Runtime integration and platform abstraction
45+
- **Performance**: Optimization and profiling
46+
- **API**: Public interface definition and implementation
47+
48+
#### 2. Platform-Specific Tasks
49+
- **Embedded (MCU)**: `no_std` implementation with Embassy
50+
- **Edge**: Resource-constrained optimization
51+
- **Cloud**: Scalability and distributed features
52+
53+
#### 3. Quality Assurance Tasks
54+
- **Unit Testing**: Component-level test coverage
55+
- **Integration Testing**: End-to-end workflow validation
56+
- **Performance Testing**: Benchmark and profiling
57+
- **Documentation**: API docs, guides, and examples
58+
59+
### Task Structure Template
60+
```
61+
Task ID: [COMPONENT]-[FEATURE]-[SEQUENCE]
62+
Title: [Descriptive task title]
63+
Category: [Core/Platform/QA]
64+
Priority: [High/Medium/Low]
65+
Effort: [Hours estimate]
66+
Dependencies: [List of prerequisite tasks]
67+
Platform: [All/Embedded/Edge/Cloud]
68+
69+
Description:
70+
[Clear description of what needs to be implemented]
71+
72+
Acceptance Criteria:
73+
- [ ] [Specific, testable outcome]
74+
- [ ] [Performance requirement if applicable]
75+
- [ ] [Platform compatibility verification]
76+
77+
Technical Notes:
78+
- [Implementation approach]
79+
- [Performance considerations]
80+
- [Platform-specific requirements]
81+
82+
Risks:
83+
- [Potential blockers or challenges]
84+
- [Mitigation strategies]
85+
```
86+
87+
## Implementation Guidelines
88+
89+
### Feature Analysis Process
90+
1. **Requirements Gathering**
91+
- Define feature scope and boundaries
92+
- Identify user stories and use cases
93+
- Determine platform requirements
94+
- Assess performance implications
95+
96+
2. **Architecture Design**
97+
- Design component interactions
98+
- Define data flow and state management
99+
- Plan async operation patterns
100+
- Consider error handling strategies
101+
102+
3. **Task Decomposition**
103+
- Break down into atomic, testable units
104+
- Sequence tasks based on dependencies
105+
- Estimate effort and complexity
106+
- Identify critical path and milestones
107+
108+
4. **Risk Assessment**
109+
- Identify technical challenges
110+
- Assess platform compatibility risks
111+
- Plan mitigation strategies
112+
- Define fallback options
113+
114+
### Task Sequencing Principles
115+
116+
#### Phase 1: Foundation
117+
- Core data structures and types
118+
- Basic component scaffolding
119+
- Interface definitions
120+
- Configuration setup
121+
122+
#### Phase 2: Core Logic
123+
- Main algorithm implementation
124+
- State management
125+
- Business logic
126+
- Error handling
127+
128+
#### Phase 3: Integration
129+
- Component integration
130+
- Protocol implementation
131+
- Platform adapters
132+
- Performance optimization
133+
134+
#### Phase 4: Quality Assurance
135+
- Comprehensive testing
136+
- Performance validation
137+
- Documentation
138+
- Examples and demos
139+
140+
### Platform Considerations
141+
142+
#### Embedded/MCU Tasks
143+
- `no_std` compatibility verification
144+
- Memory usage optimization
145+
- Interrupt safety validation
146+
- Embassy runtime integration
147+
- Hardware abstraction layer
148+
149+
#### Edge Device Tasks
150+
- Resource constraint optimization
151+
- Local storage implementation
152+
- Network resilience features
153+
- Power management considerations
154+
- Field update mechanisms
155+
156+
#### Cloud Deployment Tasks
157+
- Containerization setup
158+
- Scalability testing
159+
- Distributed coordination
160+
- Monitoring integration
161+
- Multi-tenant support
162+
163+
## Example Task Breakdown
164+
165+
### Feature: MQTT Protocol Bridge Implementation
166+
167+
#### Task 1: MQTT-001-FOUNDATION
168+
**Title**: MQTT Protocol Bridge Core Structure
169+
**Category**: Core
170+
**Priority**: High
171+
**Effort**: 6 hours
172+
**Dependencies**: None
173+
**Platform**: All
174+
175+
**Description**: Implement the basic MQTT bridge structure with connection management and message routing.
176+
177+
**Acceptance Criteria**:
178+
- [ ] MQTT client connection establishment
179+
- [ ] Basic pub/sub message handling
180+
- [ ] Connection state management
181+
- [ ] Error handling for connection failures
182+
- [ ] Configuration structure defined
183+
184+
**Technical Notes**:
185+
- Use `rumqttc` for MQTT client implementation
186+
- Implement async connection management
187+
- Design for reconnection resilience
188+
189+
**Risks**:
190+
- Network connectivity issues in embedded environments
191+
- Mitigation: Implement robust retry logic with exponential backoff
192+
193+
#### Task 2: MQTT-002-INTEGRATION
194+
**Title**: AimDB Message Integration
195+
**Category**: Core
196+
**Priority**: High
197+
**Effort**: 8 hours
198+
**Dependencies**: MQTT-001-FOUNDATION
199+
**Platform**: All
200+
201+
**Description**: Integrate MQTT bridge with AimDB's internal message system and data synchronization.
202+
203+
**Acceptance Criteria**:
204+
- [ ] Bidirectional message translation (MQTT ↔ AimDB)
205+
- [ ] Topic mapping configuration
206+
- [ ] QoS level handling
207+
- [ ] Message serialization/deserialization
208+
- [ ] Throughput meets performance requirements (>1000 msg/s)
209+
210+
**Technical Notes**:
211+
- Implement zero-copy message translation where possible
212+
- Use efficient serialization format (MessagePack/CBOR)
213+
- Design for low-latency processing (<10ms per message)
214+
215+
**Risks**:
216+
- Serialization overhead impacting performance
217+
- Mitigation: Use binary protocols and implement message pooling
218+
219+
### Risk Management
220+
221+
#### Common Risk Categories
222+
1. **Technical Risks**
223+
- Platform compatibility issues
224+
- Performance bottlenecks
225+
- Third-party dependency problems
226+
- Memory constraints on embedded targets
227+
228+
2. **Integration Risks**
229+
- API breaking changes
230+
- Component interface mismatches
231+
- Async runtime conflicts
232+
- Protocol version incompatibilities
233+
234+
3. **Timeline Risks**
235+
- Task underestimation
236+
- Dependency delays
237+
- Scope creep
238+
- Testing complexity
239+
240+
#### Mitigation Strategies
241+
- **Prototyping**: Build minimal viable implementations early
242+
- **Platform Testing**: Validate on target hardware frequently
243+
- **Incremental Integration**: Integrate components progressively
244+
- **Performance Monitoring**: Continuous benchmarking during development
245+
246+
## Output Format
247+
248+
Provide the task breakdown in the following structure:
249+
1. **Feature Overview**: Scope, objectives, and success metrics
250+
2. **Task List**: Structured task breakdown with dependencies
251+
3. **Timeline**: Estimated schedule with milestones
252+
4. **Risk Assessment**: Identified risks and mitigation plans
253+
5. **Resource Requirements**: Skills, tools, and infrastructure needed
254+
6. **Testing Strategy**: Quality assurance approach
255+
7. **Documentation Plan**: Required documentation deliverables

0 commit comments

Comments
 (0)