device-driver-development
Skill9 starsChanged 5 months agoMITView on GitHub
Use when developing, reviewing, debugging, porting, or engineering Linux kernel device drivers, kernel modules, device tree bindings, bus clients, subsystem drivers, DMA/IRQ/memory paths, userspace interfaces, or hardware bring-up plans.
In this repository9 other files it gives its agents.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 9 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Treat every driver task as hardware contract engineering: identify the kernel version, hardware bus, subsystem owner, execution context, …
- Very specific: line 19
Use references/knowledge-map.md for the driver domain map and conceptual model.
- Distinctive: line 20
Treat API details as version-sensitive.
- Distinctive: line 40
Prefer an existing kernel subsystem over a private char driver when the device matches a framework.
- Distinctive: line 41
Keep policy in userspace and mechanism in kernel.
- Distinctive: line 42
Never sleep in atomic context.
- Very specific: line 43
Use copy_{to,from}_user() only at ABI boundaries and handle partial copy/error paths.
- Very specific: line 49
Run scripts/driver_static_scan.py <path> for heuristic review of C, Kconfig, Makefile, DTS, and binding files.
- Very specific: line 50
Run scripts/module_smoke_build.sh <module-dir> [kernel-build-dir] for out-of-tree build smoke checks.
- Very specific: line 51
Run scripts/tooling_probe.sh to inspect local build, static-analysis, tracing, fuzzing, QEMU, and KGDB tool availability.
- Distinctive: line 55
Test load/unload, probe/remove failure paths, hot/unplug or unbind where applicable, suspend/resume if resources are power-managed.
- Distinctive: line 57
Use QEMU/KGDB for isolated crash reproduction and Syzkaller for fuzzable ABI surfaces when practical.
- Distinctive: line 58
Do not claim correctness from compilation alone.
- Distinctive: line 61
When answering, name assumptions, selected subsystem, key APIs, file layout, validation commands, and residual hardware risks.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Device Driver Development
Core Rule
Treat every driver task as hardware contract engineering: identify the kernel version, hardware bus, subsystem owner, execution context, lifetime model, and userspace ABI before writing code.
Knowledge Grounding
- Use
references/knowledge-map.mdfor the driver domain map and conceptual model. - Treat API details as version-sensitive; verify callback signatures, helpers, and bindings against the active kernel tree or current kernel docs.
First Pass
- Classify the device: char, platform, I2C, SPI, regmap, IIO, GPIO, IRQ controller, input, RTC, PWM, regulator, framebuffer, or NIC.
- Identify interface surfaces:
/dev, sysfs, debugfs, ioctl, mmap, netdev, IIO buffers, input events, DT binding, or kernel consumer API. - Choose probe/remove lifetime: prefer
devm_*, explicit unwind only when ordering or shared state requires it. - Decide concurrency boundaries: process context, atomic context, IRQ top half, threaded IRQ, workqueue, timer, DMA callback.
- Define evidence needed: datasheet registers, bus transaction examples, DT node, logs, scope/logic-analyzer traces, and test plan.
Required Reads By Task
- New driver or hardware bring-up:
tasks/bringup-workflow.md. - Implementing subsystem callbacks:
tasks/implementation-patterns.mdandreferences/subsystem-matrix.md. - Memory, MMIO, mmap, DMA, IRQ, locking:
references/kernel-engineering-principles.md. - Debugging, validation, or intermittent behavior:
tasks/debugging-testing.md. - Toolchain, QEMU, KGDB, bpftrace, Smatch, Coccinelle, Syzkaller, Bootlin:
references/tooling-matrix.md. - Auditable engineering flow:
tasks/step-verify-workflow.md. - Upstream-ready patches or long-term maintenance:
tasks/upstream-maintenance.md. - Final review before handoff:
references/review-checklist.md.
Design Heuristics
- Prefer an existing kernel subsystem over a private char driver when the device matches a framework.
- Keep policy in userspace and mechanism in kernel; avoid inventing ABI without necessity.
- Never sleep in atomic context; never hold spinlocks across bus calls that may sleep.
- Use
copy_{to,from}_user()only at ABI boundaries and handle partial copy/error paths. - For MMIO use
devm_ioremap_resource()plus accessor APIs; do not dereference__iomem. - For register devices on I2C/SPI, consider regmap before custom read/write helpers.
- For DT, model hardware, not Linux driver internals; document compatibles and supplies/clocks/IRQs/GPIOs.
Script Helpers
- Run
scripts/driver_static_scan.py <path>for heuristic review of C, Kconfig, Makefile, DTS, and binding files. - Run
scripts/module_smoke_build.sh <module-dir> [kernel-build-dir]for out-of-tree build smoke checks. - Run
scripts/tooling_probe.shto inspect local build, static-analysis, tracing, fuzzing, QEMU, and KGDB tool availability.
Verification Gate
- Build with warnings enabled and, when available,
sparse, Smatch, Coccinelle,checkpatch.pl,dt_binding_check, and subsystem selftests. - Test load/unload, probe/remove failure paths, hot/unplug or unbind where applicable, suspend/resume if resources are power-managed.
- Capture runtime evidence:
dmesg,/proc/interrupts, sysfs state, tracepoints/ftrace/bpftrace, bus transactions, and userspace API results. - Use QEMU/KGDB for isolated crash reproduction and Syzkaller for fuzzable ABI surfaces when practical.
- Do not claim correctness from compilation alone; tie each claim to a code path, runtime observation, or documented subsystem contract.
Output Standard
When answering, name assumptions, selected subsystem, key APIs, file layout, validation commands, and residual hardware risks. If source evidence is missing, say what must be measured or read next.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

