{"id":"a5aca961-9eca-4a79-a65b-9b10902115af","shortId":"GfjEtM","kind":"skill","title":"kernel-services","tagline":"Advanced Zephyr RTOS kernel services. Covers inter-thread communication using Zbus (pub/sub), behavioral management with the State Machine Framework (SMF), background processing via work queues, and persistent configuration with the Settings subsystem. Trigger when building modul","description":"# Zephyr Kernel Services\n\nMove beyond basic threading and logging to build modular, event-driven, and robust Zephyr applications.\n\n## Core Workflows\n\n### 1. Event-Driven Communication (Zbus)\nDecouple your modules using a lightweight publish-and-subscribe bus.\n- **Reference**: **[zbus.md](references/zbus.md)**\n- **Key Tools**: `ZBUS_CHAN_DEFINE`, `ZBUS_SUBSCRIBER_DEFINE`, `zbus_chan_pub`.\n\n### 2. Behavioral Logic (SMF)\nManage complex system states and transitions using the State Machine Framework.\n- **Reference**: **[smf.md](references/smf.md)**\n- **Key Tools**: `smf_set_state`, `SMF_CREATE_STATE`, Hierarchical states.\n\n### 3. Background Processing (Work Queues)\nDefer long-running or non-critical tasks to prevent blocking interrupts or high-priority threads.\n- **Reference**: **[settings_workqueue.md](references/settings_workqueue.md)**\n- **Key Tools**: `k_work_submit`, `k_work_delayable`, Custom work queues.\n\n### 4. Persistence (Settings)\nSave and restore configuration data and state across reboots.\n- **Reference**: **[settings_workqueue.md](references/settings_workqueue.md#settings-subsystem)**\n- **Key Tools**: `settings_load`, `settings_save_one`, NVS backends.\n\n## Quick Start (Zbus)\n```c\n// Define a channel for sensor data\nZBUS_CHAN_DEFINE(sensor_data_chan, struct sensor_msg, NULL, NULL, ZBUS_OBSERVERS_EMPTY, ZBUS_CHAN_DEFAULTS);\n\n// Publish from a thread\nzbus_chan_pub(&sensor_data_chan, &msg, K_NO_WAIT);\n```\n\n## Professional Patterns (Asset Tracker Style)\n- **Modularity**: Use Zbus as the backbone for inter-module communication.\n- **Predictability**: Use SMF to define clear lifecycle states for each module (e.g., Uninitialized -> Ready -> Active -> Error).\n- **Responsiveness**: Use custom work queues for sensor data ingestion to keep the main thread responsive for cloud communication.\n- **Sensor Integration**: For sensor data ingestion patterns, see the **[hardware-io](../hardware-io/SKILL.md)** skill.\n\n## Automation Tools\n- **[zbus_channel_lint.py](scripts/zbus_channel_lint.py)**: Detect duplicate `ZBUS_CHAN_DEFINE` names across source files.\n\n## Examples & Templates\n- **[smf_state_table_template.c](assets/smf_state_table_template.c)**: Starter SMF state table and lifecycle wiring.\n\n## Validation Checklist\n- [ ] Zbus publishers and subscribers exchange messages without deadlock or missed updates.\n- [ ] SMF transitions follow expected state graph under normal and error conditions.\n- [ ] Deferred work executes on intended queue context with bounded execution time.\n- [ ] Settings values persist across reboot and reload successfully at startup.\n\n## Resources\n\n- **[References](references/)**:\n  - `zbus.md`: Publish/Subscribe patterns and subscriber types.\n  - `smf.md`: Finite and Hierarchical state machine implementation.\n  - `settings_workqueue.md`: Background work and persistent storage.\n- **[Scripts](scripts/)**:\n  - `zbus_channel_lint.py`: Zbus channel name collision checker.\n- **[Assets](assets/)**:\n  - `smf_state_table_template.c`: State-machine template.","tags":["kernel","services","zephyr","agent","skills","beriberikix","agent-skills","agentic-coding","zephyr-rtos"],"capabilities":["skill","source-beriberikix","skill-kernel-services","topic-agent-skills","topic-agentic-coding","topic-zephyr-rtos"],"categories":["zephyr-agent-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/beriberikix/zephyr-agent-skills/kernel-services","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add beriberikix/zephyr-agent-skills","source_repo":"https://github.com/beriberikix/zephyr-agent-skills","install_from":"skills.sh"}},"qualityScore":"0.462","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 25 github stars · SKILL.md body (3,014 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T07:01:42.358Z","embedding":null,"createdAt":"2026-04-18T23:04:58.405Z","updatedAt":"2026-04-24T07:01:42.358Z","lastSeenAt":"2026-04-24T07:01:42.358Z","tsv":"'/hardware-io/skill.md':288 '1':62 '2':93 '3':121 '4':158 'across':168,300,355 'activ':256 'advanc':4 'applic':59 'asset':228,392,393 'assets/smf_state_table_template.c':309 'autom':290 'backbon':236 'backend':184 'background':25,122,379 'basic':46 'behavior':17,94 'beyond':45 'block':137 'bound':349 'build':39,51 'bus':78 'c':188 'chan':85,91,196,200,210,217,221,297 'channel':191,388 'checker':391 'checklist':318 'clear':247 'cloud':274 'collis':390 'communic':13,66,241,275 'complex':98 'condit':340 'configur':32,164 'context':347 'core':60 'cover':9 'creat':117 'critic':133 'custom':155,260 'data':165,194,199,220,265,280 'deadlock':326 'decoupl':68 'default':211 'defer':126,341 'defin':86,89,189,197,246,298 'delay':154 'detect':294 'driven':55,65 'duplic':295 'e.g':253 'empti':208 'error':257,339 'event':54,64 'event-driven':53,63 'exampl':303 'exchang':323 'execut':343,350 'expect':333 'file':302 'finit':372 'follow':332 'framework':23,107 'graph':335 'hardwar':286 'hardware-io':285 'hierarch':119,374 'high':141 'high-prior':140 'implement':377 'ingest':266,281 'integr':277 'intend':345 'inter':11,239 'inter-modul':238 'inter-thread':10 'interrupt':138 'io':287 'k':149,152,223 'keep':268 'kernel':2,7,42 'kernel-servic':1 'key':82,111,147,176 'lifecycl':248,315 'lightweight':73 'load':179 'log':49 'logic':95 'long':128 'long-run':127 'machin':22,106,376,400 'main':270 'manag':18,97 'messag':324 'miss':328 'modul':40,70,240,252 'modular':52,231 'move':44 'msg':203,222 'name':299,389 'non':132 'non-crit':131 'normal':337 'null':204,205 'nvs':183 'observ':207 'one':182 'pattern':227,282,367 'persist':31,159,354,382 'predict':242 'prevent':136 'prioriti':142 'process':26,123 'profession':226 'pub':92,218 'pub/sub':16 'publish':75,212,320 'publish-and-subscrib':74 'publish/subscribe':366 'queue':29,125,157,262,346 'quick':185 'readi':255 'reboot':169,356 'refer':79,108,144,170,363,364 'references/settings_workqueue.md':146,172 'references/smf.md':110 'references/zbus.md':81 'reload':358 'resourc':362 'respons':258,272 'restor':163 'robust':57 'rtos':6 'run':129 'save':161,181 'script':384,385 'scripts/zbus_channel_lint.py':293 'see':283 'sensor':193,198,202,219,264,276,279 'servic':3,8,43 'set':35,114,160,174,178,180,352 'settings-subsystem':173 'settings_workqueue.md':145,171,378 'skill':289 'skill-kernel-services' 'smf':24,96,113,116,244,305,311,330,394 'smf.md':109,371 'sourc':301 'source-beriberikix' 'start':186 'starter':310 'startup':361 'state':21,100,105,115,118,120,167,249,306,312,334,375,395,399 'state-machin':398 'storag':383 'struct':201 'style':230 'submit':151 'subscrib':77,88,322,369 'subsystem':36,175 'success':359 'system':99 'tabl':307,313,396 'task':134 'templat':304,401 'template.c':308,397 'thread':12,47,143,215,271 'time':351 'tool':83,112,148,177,291 'topic-agent-skills' 'topic-agentic-coding' 'topic-zephyr-rtos' 'tracker':229 'transit':102,331 'trigger':37 'type':370 'uniniti':254 'updat':329 'use':14,71,103,232,243,259 'valid':317 'valu':353 'via':27 'wait':225 'wire':316 'without':325 'work':28,124,150,153,156,261,342,380 'workflow':61 'zbus':15,67,84,87,90,187,195,206,209,216,233,296,319,387 'zbus.md':80,365 'zbus_channel_lint.py':292,386 'zephyr':5,41,58","prices":[{"id":"c38cfb6e-0de6-4f07-a104-8929b1b689a2","listingId":"a5aca961-9eca-4a79-a65b-9b10902115af","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"beriberikix","category":"zephyr-agent-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T23:04:58.405Z"}],"sources":[{"listingId":"a5aca961-9eca-4a79-a65b-9b10902115af","source":"github","sourceId":"beriberikix/zephyr-agent-skills/kernel-services","sourceUrl":"https://github.com/beriberikix/zephyr-agent-skills/tree/main/skills/kernel-services","isPrimary":false,"firstSeenAt":"2026-04-18T23:04:58.405Z","lastSeenAt":"2026-04-24T07:01:42.358Z"}],"details":{"listingId":"a5aca961-9eca-4a79-a65b-9b10902115af","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"beriberikix","slug":"kernel-services","github":{"repo":"beriberikix/zephyr-agent-skills","stars":25,"topics":["agent-skills","agentic-coding","zephyr-rtos"],"license":"apache-2.0","html_url":"https://github.com/beriberikix/zephyr-agent-skills","pushed_at":"2026-04-20T21:40:18Z","description":"A complete catalog of Agent Skills (agentskills.io) for Zephyr RTOS development.","skill_md_sha":"ddf1bb3da4fbbb24ff111941b53b780c162a1317","skill_md_path":"skills/kernel-services/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/beriberikix/zephyr-agent-skills/tree/main/skills/kernel-services"},"layout":"multi","source":"github","category":"zephyr-agent-skills","frontmatter":{"name":"kernel-services","description":"Advanced Zephyr RTOS kernel services. Covers inter-thread communication using Zbus (pub/sub), behavioral management with the State Machine Framework (SMF), background processing via work queues, and persistent configuration with the Settings subsystem. Trigger when building modular application architectures, complex state-driven logic, or requiring persistent data storage."},"skills_sh_url":"https://skills.sh/beriberikix/zephyr-agent-skills/kernel-services"},"updatedAt":"2026-04-24T07:01:42.358Z"}}