Imported from JasonYANG170/wch-dev-skill (
SKILL.md). Install upstream withnpx skills add JasonYANG170/wch-dev-skill. Copyright stays with the author (MIT).
wch-dev-skill
Use this skill when developing, porting, debugging, or reviewing WCH MCU firmware. The entrypoint is intentionally short: route first, then load only the family and scenario references needed for the exact chip.
Route First
- Identify the exact chip marking, board, SDK/EVT package, toolchain, and requested peripheral or protocol.
- Read
resources/chip_matrix.mdto choosechips/<family>/. - Read
resources/scenario_routing.mdif the user asks for a feature or peripheral and the correct recipe is not obvious. - For implementation, read the selected family recipe under
chips/<family>/recipes/and the closestchips/<family>/resources/EXAM/example. - For API details, read the selected family's
chips/<family>/resources/peripheral_api.md,pitfalls.md,memory_layout.md, or BLE/config references as needed.
Evidence Order
Before emitting code or build steps, verify names in this order:
- User's existing project files.
- Exact family headers/source and startup/linker files.
- Closest EVT/example project under
chips/<family>/resources/EXAM/. - Family recipe and API reference.
- Generic embedded knowledge only for architecture-neutral reasoning.
If sources conflict, follow the files matching the user's selected chip and SDK/EVT package. State the mismatch instead of blending examples.
Coding Rules
- Do not guess APIs, register names, interrupt handlers, linker symbols, flash page sizes, USB endpoints, or BLE configuration values.
- Keep RISC-V, ARM Cortex-M, ARM7TDMI, and 8051 conventions separate.
- Enable peripheral clocks and configure GPIO/pin mux before peripheral initialization.
- Copy the closest working example structure when creating new firmware.
- For BLE, keep the stack initialization order and memory configuration aligned with the selected example.
BLE_MEMHEAP_SIZEis project-dependent; CH57x templates commonly use 6KB, and smaller heaps require proof. - For IAP/OTA, verify bootloader offset, application linker script, vector relocation, and erase/write granularity.
Key References
resources/chip_matrix.md- chip-to-family routing.resources/scenario_routing.md- feature-to-recipe routing.resources/development_workflow.md- shared implementation workflow.resources/source_strategy.md- how to search the large example/source tree without cross-family leakage.resources/recipe_quality.md- required metadata and evidence standard for recipes.scripts/validate_mcu_skill.py- structural and recipe-quality smoke check.scripts/check_recipe_symbols.py- optional symbol-evidence scan for a selected family or recipe.chips/<family>/recipes/*.md- scenario guides.chips/<family>/resources/- API references, pitfalls, memory layout, and example indexes.
Stop Conditions
Ask for the exact part number when the family cannot be inferred. If an API or feature cannot be found in the selected project, headers, examples, or references, say that it is unverified for that selected chip instead of inventing a portable-looking substitute.
