Syscalls Β· Schedulers Β· Page Tables Β· Traps Β· Locks Β· File System
xv6-riscv-expert is a Claude Code Skill designed for students and developers working with MIT-style xv6-riscv and SNU's xv6-riscv-snu operating system assignments.
| Use Case | Description |
|---|---|
| π Coursework | CSE321 / OS assignments (xv6-riscv) |
| π§ Kernel Dev | System calls, scheduler, virtual memory |
| π Debugging | Traps, page faults, locks |
| π Learning | OS concepts, RISC-V architecture |
npx skills add shafin027/xv6-riscv-skill-git clone https://github.com/shafin027/xv6-riscv-skill-.git ~/.claude/skills/xv6-riscv-expertcd /path/to/your/project
npx skills add shafin027/xv6-riscv-skill- --local/xv6-riscv-expertClaude Code will use the skill when you ask questions like:
I need to add a new syscall to xv6-riscv.
How do I implement a lottery scheduler in xv6?
Debug this xv6 page fault: scause=15, stval=0x0.
| Type | Examples | Status |
|---|---|---|
| System Calls | settickets, getpid, tracing, custom syscalls |
β |
| Scheduler | Lottery scheduler, priority scheduler, round-robin | β |
| Virtual Memory | Page tables, PTEs, vmprint, COW, USYSCALL |
β |
| Traps & Interrupts | usertrap, page faults, timer interrupts |
β |
| Process Management | fork, exit, wait, process states |
β |
| Locks & Concurrency | Spinlocks, sleeplocks, race conditions | β |
| File System | Inodes, logging, buffer cache | β |
| File | Purpose |
|---|---|
kernel/proc.h |
struct proc, process states, fields |
kernel/proc.c |
Process lifecycle, scheduler, fork, exit |
kernel/syscall.c |
Syscall dispatcher and table |
kernel/syscall.h |
Syscall numbers |
kernel/trap.c |
Trap handling, interrupts, exceptions |
kernel/vm.c |
Page tables, virtual memory, mapping |
kernel/riscv.h |
RISC-V registers, PTE flags |
user/user.h |
User-space function declarations |
Implementation Answer:
- Files to change
- Patch / code
- Why this works
- How to test
- Common mistakes
Debugging Answer:
- Likely cause
- What to inspect
- Exact command(s)
- Fix
- Validation
Prompt:
I need to add a syscall called settickets(int n) to xv6-riscv
Skill Response:
- β Lists all files to change
- β Provides exact code patches
- β Explains why each change works
- β
Gives test commands (
make qemu) - β Shows common mistakes to avoid
Prompt:
Implement a lottery scheduler for xv6-riscv where each process
has tickets and the scheduler picks a random winner
Skill Response:
- β Step-by-step implementation plan
- β
Complete code for
proc.h,proc.c,sysproc.c - β Random number generator implementation
- β
Test program (
test_scheduler.c) - β Patch file creation instructions
Prompt:
My xv6 kernel panics with scause=15 (store page fault).
The fault happens in sys_write. Here's my code...
Skill Response:
- β Identifies likely cause (PTE permissions, user pointer)
- β
Shows what to inspect (
copyout,walk(), PTE flags) - β Provides exact fix
- β Gives validation steps
Before using this skill, ensure you have xv6-riscv set up:
# Ubuntu/Debian
sudo apt update
sudo apt install git build-essential gdb-multiarch qemu-system-misc \
gcc-riscv64-linux-gnu binutils-riscv64-linux-gnugit clone https://github.com/mit-pdos/xv6-riscv.git
cd xv6-riscvmake clean
make qemuTerminal 1:
make qemu-gdbTerminal 2:
riscv64-linux-gnu-gdb kernel/kernelWhen working on xv6 assignments, the skill will help you:
- Identify assignment type
- List all files to modify
- Provide minimal correct patches
- Explain why the solution works
- Include test commands
- Warn about common mistakes
- Help create patch files (
git diff --staged > ID.patch)
Found a bug or want to improve the skill? Contributions welcome!
- Fork the repo
- Create your feature branch (
git checkout -b feature/amazing-improvement) - Commit your changes (
git commit -m 'Add some amazing improvement') - Push to the branch (
git push origin feature/amazing-improvement) - Open a Pull Request
MIT License β feel free to use, modify, and distribute.
Having issues?
- Open an issue on GitHub
- Ask in the Claude Code Discord
Made with β€οΈ for OS students, xv6 hackers, and RISC-V enthusiasts
Part of the Claude Code Skills ecosystem