device-drivers

device-drivers is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 72 tokens per session (2,025 once invoked), scanned B, original, MIT.

A guide to writing Linux device drivers that connect the kernel to hardware. It covers common hardware buses, character devices, interrupts, direct memory access, register access, power management, and device-node permissions.

In plain words
What is it for?
Creating platform, I2C, or SPI drivers; handling interrupts and DMA; exposing character devices; managing device power; and configuring udev permissions.
Why use it?
It explains the kernel interfaces needed to make hardware available safely and predictably to Linux programs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Creating platform, I2C, or SPI drivers; handling interrupts and DMA; exposing character devices; managing device power; and configuring udev permissions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/device-drivers
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mohitmishra786/low-level-dev-skills --skill device-drivers
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for device-drivers

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/device-drivers/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/device-drivers)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/device-drivers"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/device-drivers/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for device-drivers

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/device-drivers"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/device-drivers.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,025 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00072 $0.02025
Opus 5 $0.00036 $0.01012
Sonnet 5 $0.00014 $0.00405
Haiku 4.5 $0.00007 $0.00202

Measured 8d ago against content hash af40bb1fc16d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade B, and why

device-drivers scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo udevadm control --reload-rules
skills/kernel/device-drivers/SKILL.md · 277 lines

How it starts

The opening of the file, as written. The whole thing — 277 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Device Drivers

Purpose

Guide agents through Linux kernel device driver development: the driver model (platform_driver, i2c_driver, spi_driver), character device lifecycle, IRQ handling including threaded IRQs, DMA engine API, regmap for register abstraction, runtime power management, and udev rules for userspace device nodes.

When to Use

  • Writing a platform driver for memory-mapped hardware
  • Implementing a character device with read/write/ioctl
  • Handling hardware interrupts (hard IRQ vs threaded)
  • Setting up DMA coherent or streaming mappings
  • Abstracting register access with regmap
  • Configuring udev rules for /dev node permissions

Workflow

1. Driver model overview

Device tree / ACPI → bus (platform, i2c, spi, pci)
    → struct device → struct device_driver
        → probe() / remove()
// platform_driver.c — minimal platform driver
#include <linux/module.h>
#include <linux/platform_device.h>

static int my_probe(struct platform_device *pdev)
{
    struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    void __iomem *base = devm_ioremap_resource(&pdev->dev, res);
    if (IS_ERR(base))
        return PTR_ERR(base);
    dev_info(&pdev->dev, "probed at %pa\n", &res->start);
    return 0;
}

static void my_remove(struct platform_device *pdev)
{
    dev_info(&pdev->dev, "removed\n");
}

static struct platform_driver my_driver = {
    .probe  = my_probe,
    .remove = my_remove,
    .driver = { .name = "my-device", .owner = THIS_MODULE },
};

module_platform_driver(my_driver);
MODULE_LICENSE("GPL");

2. Character device lifecycle

#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/uaccess.h>

#define DEVICE_NAME "mydev"
#define MINOR_BASE  0
#define MINOR_COUNT 1

static dev_t dev_num;
static struct cdev my_cdev;
static struct class *dev_class;

static ssize_t my_read(struct file *filp, char __user *buf,
                       size_t count, loff_t *ppos)
{
    char kbuf[64] = "hello from kernel\n";
    size_t len = strlen(kbuf);
    if (*ppos >= len)
        return 0;
    if (count > len - *ppos)
        count = len - *ppos;
    if (copy_to_user(buf, kbuf + *ppos, count))
        return -EFAULT;
    *ppos += count;
    return count;
}

static const struct file_operations my_fops = {
    .owner = THIS_MODULE,
    .read  = my_read,
};

static int __init mydev_init(void)
{
    int ret;
    ret = alloc_chrdev_region(&dev_num, MINOR_BASE, MINOR_COUNT, DEVICE_NAME);
    if (ret)
        return ret;

    cdev_init(&my_cdev, &my_fops);
    my_cdev.owner = THIS_MODULE;
    ret = cdev_add(&my_cdev, dev_num, MINOR_COUNT);
    if (ret)
        goto err_cdev;

    dev_class = class_create(DEVICE_NAME);
    device_create(dev_class, NULL, dev_num, NULL, DEVICE_NAME);
    return 0;

err_cdev:
    unregister_chrdev_region(dev_num, MINOR_COUNT);
    return ret;
}

Read the full file on GitHub · 277 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 277 lines · 72 tokens per session scan B af40bb1fc16d

Subscribe to this mod's changes

device-drivers is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (203 stars, last pushed 2mo ago), licensed MIT. It adds 72 tokens to every session and 2,025 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.