Teaches Claude to diagnose and fix cache performance issues in C/C++ and Rust using perf counters, data layout transformations, and false sharing detection. You'd reach for this when your program shows high cache miss rates or when multithreaded code inexplicably runs slower than single-threaded. It walks through AoS to SoA conversions, cache line alignment, prefetching strategies, and loop blocking for matrix operations. The perf stat examples are immediately useful, showing exactly which counters matter and what thresholds indicate trouble. Honest take: cache optimization is one of those areas where measurement comes first, and this skill front-loads the profiling commands before suggesting fixes, which is the right order.

skills.sh installs
709
GitHub stars
279
last updated
Aug 21, 2026

Install

$ npx -y skills add mohitmishra786/low-level-dev-skills --skill cpu-cache-opt --agent claude-code

Installs into .claude/skills of the current project.

Files

CPU Cache Optimization

Purpose

Guide agents through cache-aware programming: diagnosing cache misses with perf, data layout transformations (AoS→SoA), false sharing detection and fixes, prefetching, and cache-friendly algorithm design.

Triggers

  • "My program has high cache miss rates — how do I fix it?"
  • "What is false sharing and how do I detect it?"
  • "Should I use AoS or SoA data layout?"
  • "How do I measure cache performance with perf?"
  • "How do I use __builtin_prefetch?"
  • "My multithreaded program is slower than single-threaded due to cache"

Workflow

1. Measure cache performance

# Basic cache counters
perf stat -e cache-references,cache-misses,cycles,instructions ./prog

# L1/L2/L3 miss breakdown
perf stat -e \
    L1-dcache-load-misses,\
    L1-dcache-loads,\
    L2-dcache-load-misses,\
    LLC-load-misses,\
    LLC-loads \
    ./prog

# Cache miss rate = L1-dcache-load-misses / L1-dcache-loads
# > 5% is concerning; > 20% is severe

# False sharing detection
perf stat -e \
    machine_clears.memory_ordering,\
    mem_load_l3_hit_retired.xsnp_hitm \
    ./prog

2. Cache line basics

Sponsors

Details

Repository
github.com/mohitmishra786/low-level-dev-skills
Categories
Frontend Development, Debugging, Rust
First seen
Jun 3, 2026

More from mohitmishra786/low-level-dev-skills

All 54
1mohitmishra786 avatarelf-inspectionmohitmishra786/low-level-dev-skillsELF binary inspection skill for Linux. Use when examining ELF executables or shared libraries with readelf, objdump, nm, or ldd to understand symbol visibility,702skills.sh installs
2patricio0312rev avatarpostman-collection-generatorpatricio0312rev/skillsGenerates Postman collection JSON files from Express, Next.js, Fastify, Hono, or other API routes. Scans route definitions, extracts endpoints, methods, params,699skills.sh installs
3ruvnet avatarbrowser-extractruvnet/rufloExtract structured data via stored browser-templates or one-shot DOM queries, with mandatory AIDefence PII + prompt-injection gates before content reaches the m698skills.sh installs
4ruvnet avatarbrowser-screenshot-diffruvnet/rufloVisual + DOM diff between two recorded sessions at matching trajectory step ids; used for visual regression and replay verification697skills.sh installs
5duc01226 avatarmarkdown-to-pdfduc01226/easyplatform[Document Processing] Use when you need to convert markdown files to PDF with syntax highlighting and custom CSS support.693skills.sh installs
6rstackjs avatarrspack-best-practicesrstackjs/agent-skillsRspack best practices for config, CLI workflow, type checking, CSS, bundle optimization, assets and profiling. Use when writing, reviewing, or troubleshooting R689skills.sh installs