$npx -y skills add easyzoom/aix-skills --skill nr-micro-shell-integrationUse when integrating, porting, configuring, or debugging nr_micro_shell command consoles, UART shell input, command tables, or tiny embedded CLI behavior
| 1 | # nr_micro_shell Integration |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Use this skill to integrate nr_micro_shell as a compact command console. Keep the first port minimal: verified character I/O, one read-only command, bounded buffers, and explicit handling for destructive commands. |
| 6 | |
| 7 | ## When To Use |
| 8 | |
| 9 | Use this skill when: |
| 10 | |
| 11 | - The user wants a tiny shell/CLI on an MCU and mentions nr_micro_shell. |
| 12 | - Commands are not recognized, input is garbled, completion/history fails, or shell processing blocks firmware. |
| 13 | - The target needs a lower-footprint alternative to larger embedded shells. |
| 14 | |
| 15 | Do not use this skill when raw UART is not proven. Use `embedded-serial-log-debug` first. |
| 16 | |
| 17 | ## First Questions |
| 18 | |
| 19 | Ask for: |
| 20 | |
| 21 | - Target MCU/RTOS/compiler and nr_micro_shell version/source. |
| 22 | - Transport: UART, USB CDC, RTT, TCP, or custom stream. |
| 23 | - Polling, interrupt, DMA, or task-based input model. |
| 24 | - Command table/registration approach. |
| 25 | - Maximum command length, argument count, and stack/RAM budget. |
| 26 | - Whether shell is enabled in production builds. |
| 27 | |
| 28 | ## Integration Checklist |
| 29 | |
| 30 | 1. Verify raw I/O. |
| 31 | Confirm single-character RX/TX before attaching shell parsing. |
| 32 | |
| 33 | 1. Configure buffers. |
| 34 | Set command line, history, and output buffers within RAM limits. |
| 35 | |
| 36 | 1. Register one safe command. |
| 37 | Start with `help`, `version`, or `status`. |
| 38 | |
| 39 | 1. Validate argument parsing. |
| 40 | Commands must reject missing, too many, or invalid arguments. |
| 41 | |
| 42 | 1. Bound output. |
| 43 | Avoid long blocking output that starves watchdogs or RTOS tasks. |
| 44 | |
| 45 | 1. Guard risky commands. |
| 46 | Reset, erase, format, calibration, flash writes, or network writes need build guards or authentication. |
| 47 | |
| 48 | ## Common Failures |
| 49 | |
| 50 | - RX callback stores characters but shell process function is never called. |
| 51 | - Command table is not linked or is optimized out. |
| 52 | - Backspace/newline behavior mismatches terminal settings. |
| 53 | - Long command output blocks system timing. |
| 54 | - Debug shell remains enabled in production without restrictions. |
| 55 | |
| 56 | ## Verification |
| 57 | |
| 58 | Before claiming nr_micro_shell works: |
| 59 | |
| 60 | - State transport, scheduling model, buffer sizes, and command registration method. |
| 61 | - Confirm raw RX/TX, `help`, one custom read-only command, invalid command, and argument error behavior. |
| 62 | - Confirm risky commands are absent, disabled, or guarded. |
| 63 | |
| 64 | ## Example |
| 65 | |
| 66 | User: |
| 67 | |
| 68 | ```text |
| 69 | 想用 nr_micro_shell 做一个串口调试命令行。 |
| 70 | ``` |
| 71 | |
| 72 | Agent: |
| 73 | |
| 74 | 1. Asks for UART path, scheduler model, buffer size, and production policy. |
| 75 | 1. Verifies raw serial, then registers `status`. |
| 76 | 1. Tests command parsing and guards destructive commands. |