.cursor/skills/battery-adaptive-scheduling/SKILL.md
--- name: battery-adaptive-scheduling description: Guides battery-adaptive BLE scheduling: adaptive scanning, power optimization, foreground services, background modes. Use when implementing BLE features, background operations, or battery optimization. --- # Battery-Adaptive Scheduling ## Core Purpose Optimize BLE operations based on battery level to minimize battery drain while maintaining functionality. ## Adaptive Scanning Pattern ```dart /// Adaptive BLE Scanner /// /// Adjusts scan fr
npx skillsauth add avra-cadavra/avrai .cursor/skills/battery-adaptive-schedulingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Optimize BLE operations based on battery level to minimize battery drain while maintaining functionality.
/// Adaptive BLE Scanner
///
/// Adjusts scan frequency based on battery level
class AdaptiveBLEScanner {
/// Start adaptive scanning
Future<void> startAdaptiveScanning() async {
final batteryLevel = await _getBatteryLevel();
final isCharging = await _isCharging();
// Calculate scan interval based on battery level
final scanInterval = _calculateScanInterval(
batteryLevel: batteryLevel,
isCharging: isCharging,
);
// Start scanning with adaptive interval
await _startScanning(scanInterval: scanInterval);
}
/// Calculate scan interval based on battery
Duration _calculateScanInterval({
required double batteryLevel,
required bool isCharging,
}) {
if (isCharging) {
// More frequent when charging
return Duration(seconds: 3);
} else if (batteryLevel > 50) {
// High battery: Normal frequency
return Duration(seconds: 5);
} else if (batteryLevel > 20) {
// Medium battery: Reduced frequency
return Duration(seconds: 10);
} else {
// Low battery: Minimal frequency
return Duration(seconds: 30);
}
}
}
class BLEForegroundService : Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
// Create notification
val notification = createNotification()
startForeground(NOTIFICATION_ID, notification)
// Start adaptive BLE operations
startAdaptiveBLE()
return START_STICKY
}
private fun startAdaptiveBLE() {
// Monitor battery level
// Adjust scanning frequency
}
}
<!-- Info.plist -->
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
<string>bluetooth-peripheral</string>
</array>
docs/ai2ai/06_network_connectivity/BLE_BACKGROUND.md - Background BLE guidelib/core/ai2ai/battery_adaptive_ble_scheduler.dart - Adaptive schedulerdevelopment
--- name: world-model-development description: Guides world model development patterns: state/action encoders, ONNX inference, feature extraction pipeline, latency budgets. Use when implementing world model components, state encoders, action encoders, feature extractors, or ONNX models. Core skill for Phases 3-6. --- # World Model Development Patterns ## Core Principle All world model components follow LeCun's autonomous machine intelligence framework. State observations flow through a percep
tools
Implements base workflow controller patterns for multi-step processes. Use when creating complex workflows that require orchestration of multiple steps with error handling and rollback.
testing
--- name: widget-test-patterns description: Guides widget test patterns: BLoC testing, user interactions, state changes, material app setup. Use when writing widget tests, testing UI components, or validating widget behavior. --- # Widget Test Patterns ## Core Pattern Widget tests verify UI behavior: user interactions, state changes, and visual display. ## Basic Widget Test Setup ```dart testWidgets('widget displays correctly', (WidgetTester tester) async { // Arrange: Create widget awa
testing
--- name: test-template-generation description: Generates test templates: unit, widget, integration, service tests following project patterns. Use when creating new tests or ensuring tests follow project standards. --- # Test Template Generation ## Available Templates Test templates are located in `test/templates/`: - `unit_test_template.dart` - `widget_test_template.dart` - `integration_test_template.dart` - `service_test_template.dart` ## Unit Test Template ```dart /// SPOTS Component Uni