Tinyml Microcontroller Ai
Skill Profile
(Select at least one profile to enable specific modules)
Overview
TinyML Microcontroller AI enables deployment of machine learning models on resource-constrained microcontrollers (MCUs) with limited memory, compute, and power. This capability is essential for edge AI applications requiring offline operation, low latency, and energy efficiency in industrial IoT, smart devices, and embedded systems.
Why This Matters
- Offline Intelligence: Enables AI capabilities without cloud connectivity, critical for remote or offline applications
- Low Latency: Sub-millisecond inference for real-time applications where every millisecond counts
- Energy Efficiency: Battery-powered devices with months/years of operation through power optimization
- Cost Reduction: Eliminates cloud infrastructure and data transfer costs by processing on-device
- Privacy: Data processing on-device without leaving the edge, ensuring data privacy and compliance
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
- Inputs:
- Trained TensorFlow/Keras model
- Representative dataset for quantization
- Target hardware specifications (RAM, Flash, compute)
- Performance requirements (latency, power)
- Entry Conditions:
- TensorFlow/Keras model trained and validated
- Target microcontroller selected and available
- Development environment set up (PlatformIO, STM32CubeIDE, etc.)
- Hardware constraints understood and documented
- Outputs:
- Quantized TFLite model file (.tflite)
- C header file with model data
- Inference implementation code
- Performance metrics (latency, memory, power)
- Artifacts Required (Deliverables):
- TFLite model file
- C header file (model_data.cc/h)
- Inference class implementation
- Main application code
- Performance benchmark results
- Acceptance Evidence:
- Inference latency measurement (< 100ms)
- Memory usage report (RAM/Flash)
- Power consumption measurement (< 10mW)
- Accuracy comparison with original model (> 95%)
- Success Criteria:
- Model size fits in flash memory
- Tensor arena fits in RAM
- Inference latency meets requirements (< 100ms)
- Power consumption within budget (< 10mW)
- Accuracy within acceptable range (> 95% of cloud model)
Skill Composition
Quick Start / Implementation Example
- Review requirements and constraints
- Set up development environment
- Implement core functionality following patterns
- Write tests for critical paths
- Run tests and fix issues
- Document any deviations or decisions
# Example implementation following best practices
def example_function():
# Your implementation here
pass
Assumptions / Constraints / Non-goals
- Assumptions:
- Development environment is properly configured
- Required dependencies are available
- Team has basic understanding of domain
- Constraints:
- Must follow existing codebase conventions
- Time and resource limitations
- Compatibility requirements
- Non-goals:
- This skill does not cover edge cases outside scope
- Not a replacement for formal training
Compatibility & Prerequisites
- Supported Versions:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Required AI Tools:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
- Dependencies:
- Language-specific package manager
- Build tools
- Testing libraries
- Environment Setup:
.env.example keys: API_KEY, DATABASE_URL (no values)
Test Scenario Matrix (QA Strategy)
| Type |
Focus Area |
Required Scenarios / Mocks |
| Unit |
Core Logic |
Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration |
DB / API |
All external API calls or database connections must be mocked during unit tests |
| E2E |
User Journey |
Critical user flows to test |
| Performance |
Latency / Load |
Benchmark requirements |
| Security |
Vuln / Auth |
SAST/DAST or dependency audit |
| Frontend |
UX / A11y |
Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns / Pitfalls
- ⛔ Don't: Log PII, catch-all exception, N+1 queries
- ⚠️ Watch out for: Common symptoms and quick fixes
- 💡 Instead: Use proper error handling, pagination, and logging
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: tinyml-microcontroller-ai3description: TinyML Microcontroller AI enables deployment of machine learning models Use when this capability is needed.4---56# Tinyml Microcontroller Ai78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17TinyML Microcontroller AI enables deployment of machine learning models on resource-constrained microcontrollers (MCUs) with limited memory, compute, and power. This capability is essential for edge AI applications requiring offline operation, low latency, and energy efficiency in industrial IoT, smart devices, and embedded systems.1819## Why This Matters20- **Offline Intelligence**: Enables AI capabilities without cloud connectivity, critical for remote or offline applications21- **Low Latency**: Sub-millisecond inference for real-time applications where every millisecond counts22- **Energy Efficiency**: Battery-powered devices with months/years of operation through power optimization23- **Cost Reduction**: Eliminates cloud infrastructure and data transfer costs by processing on-device24- **Privacy**: Data processing on-device without leaving the edge, ensuring data privacy and compliance2526---2728## Core Concepts & Rules2930### 1. Core Principles31- Follow established patterns and conventions32- Maintain consistency across codebase33- Document decisions and trade-offs3435### 2. Implementation Guidelines36- Start with the simplest viable solution37- Iterate based on feedback and requirements38- Test thoroughly before deployment394041## Inputs / Outputs / Contracts42* **Inputs**:43 - Trained TensorFlow/Keras model44 - Representative dataset for quantization45 - Target hardware specifications (RAM, Flash, compute)46 - Performance requirements (latency, power)47* **Entry Conditions**:48 - TensorFlow/Keras model trained and validated49 - Target microcontroller selected and available50 - Development environment set up (PlatformIO, STM32CubeIDE, etc.)51 - Hardware constraints understood and documented52* **Outputs**:53 - Quantized TFLite model file (.tflite)54 - C header file with model data55 - Inference implementation code56 - Performance metrics (latency, memory, power)57* **Artifacts Required (Deliverables)**:58 - TFLite model file59 - C header file (model_data.cc/h)60 - Inference class implementation61 - Main application code62 - Performance benchmark results63* **Acceptance Evidence**:64 - Inference latency measurement (< 100ms)65 - Memory usage report (RAM/Flash)66 - Power consumption measurement (< 10mW)67 - Accuracy comparison with original model (> 95%)68* **Success Criteria**:69 - Model size fits in flash memory70 - Tensor arena fits in RAM71 - Inference latency meets requirements (< 100ms)72 - Power consumption within budget (< 10mW)73 - Accuracy within acceptable range (> 95% of cloud model)7475## Skill Composition76* **Depends on**: [edge-model-compression](../edge-model-compression/SKILL.md) (Model optimization techniques)77* **Compatible with**: [hybrid-inference-architecture](../hybrid-inference-architecture/SKILL.md), [on-device-model-training](../on-device-model-training/SKILL.md)78* **Conflicts with**: None79* **Related Skills**: [edge-ai-development-workflow](../edge-ai-development-workflow/SKILL.md), [model-optimization-quantization](../../78-inference-model-serving/model-optimization-quantization/SKILL.md)8081---8283## Quick Start / Implementation Example84851. Review requirements and constraints862. Set up development environment873. Implement core functionality following patterns884. Write tests for critical paths895. Run tests and fix issues906. Document any deviations or decisions9192```python93# Example implementation following best practices94def example_function():95 # Your implementation here96 pass97```9899100## Assumptions / Constraints / Non-goals101102* **Assumptions**:103 - Development environment is properly configured104 - Required dependencies are available105 - Team has basic understanding of domain106* **Constraints**:107 - Must follow existing codebase conventions108 - Time and resource limitations109 - Compatibility requirements110* **Non-goals**:111 - This skill does not cover edge cases outside scope112 - Not a replacement for formal training113114115## Compatibility & Prerequisites116117* **Supported Versions**:118 - Python 3.8+119 - Node.js 16+120 - Modern browsers (Chrome, Firefox, Safari, Edge)121* **Required AI Tools**:122 - Code editor (VS Code recommended)123 - Testing framework appropriate for language124 - Version control (Git)125* **Dependencies**:126 - Language-specific package manager127 - Build tools128 - Testing libraries129* **Environment Setup**:130 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)131132133## Test Scenario Matrix (QA Strategy)134135| Type | Focus Area | Required Scenarios / Mocks |136| :--- | :--- | :--- |137| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |138| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |139| **E2E** | User Journey | Critical user flows to test |140| **Performance** | Latency / Load | Benchmark requirements |141| **Security** | Vuln / Auth | SAST/DAST or dependency audit |142| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |143144145## Technical Guardrails & Security Threat Model146147### 1. Security & Privacy (Threat Model)148* **Top Threats**: Injection attacks, authentication bypass, data exposure149- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII150- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager151- [ ] **Authorization**: Validate user permissions before state changes152153### 2. Performance & Resources154- [ ] **Execution Efficiency**: Consider time complexity for algorithms155- [ ] **Memory Management**: Use streams/pagination for large data156- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks157158### 3. Architecture & Scalability159- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection160- [ ] **Modularity**: Decouple logic from UI/Frameworks161162### 4. Observability & Reliability163- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`164- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`165- [ ] **Error Handling**: Standardized error codes, no bare except166- [ ] **Observability Artifacts**:167 - **Log Fields**: timestamp, level, message, request_id168 - **Metrics**: request_count, error_count, response_time169 - **Dashboards/Alerts**: High Error Rate > 5%170171172## Agent Directives & Error Recovery173*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*174175- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.176- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.177- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.178- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.179180181## Definition of Done (DoD) Checklist182183- [ ] Tests passed + coverage met184- [ ] Lint/Typecheck passed185- [ ] Logging/Metrics/Trace implemented186- [ ] Security checks passed187- [ ] Documentation/Changelog updated188- [ ] Accessibility/Performance requirements met (if frontend)189190191## Anti-patterns / Pitfalls192193* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries194* ⚠️ **Watch out for**: Common symptoms and quick fixes195* 💡 **Instead**: Use proper error handling, pagination, and logging196197198## Reference Links & Examples199200* Internal documentation and examples201* Official documentation and best practices202* Community resources and discussions203204205## Versioning & Changelog206207* **Version**: 1.0.0208* **Changelog**:209 - 2026-02-22: Initial version with complete template structure210211---212> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.213<!-- tomevault:4.0:skill_md:2026-04-13 -->