Skip to main content
skill CX Codex

performant-code — Claude Code skill: what it does, how to install

performant-code guides Claude Code to write fast routines for large files and strict memory caps. Helps prevent runtime timeouts on heavy workloads.

MIT ★ 1,125 updated 2026-10-27

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add vstorm-co/pydantic-deepagents --skill performant-code -a claude-code
Open on GitHub

What performant-code does

This skill guides Claude Code when handling large datasets and tight execution bounds. It splits data processing into clear tiers: files under 100 MB fit into memory with efficient algorithms, while anything above 100 MB requires streaming or mmap. Datasets exceeding 1 GB are restricted to chunk-based processing.

The instructions focus on practical I/O and complexity fixes for C and Python. It flags nested loops for conversion to hash lookups, swaps manual counting for collections.Counter or numpy, and enforces buffered binary writes with sys.stdout.buffer.write().

Toy inputs hide memory bottlenecks, so running benchmarks against realistic file sizes before finishing is mandatory.

What it helps with

  • convert quadratic nested loops into linear hash map lookups
  • stream files larger than 100 MB with mmap or buffered chunks
  • speed up binary record parsing via struct.unpack
  • keep code execution within strict memory and file size limits

Example prompts for the agent

  • Refactor this Python file reader to stream a 3 GB dataset in chunks
  • Rewrite the nested loops into an O(n) hash table lookup
  • Optimize this C loop using mmap and pre-allocated buffers

How to install performant-code

1Skills CLI (Vercel)

npx skills add vstorm-co/pydantic-deepagents --skill performant-code -a claude-code

2Manually: put the files in place

~/.claude/skills/performant-code/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/performant-code/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about performant-code

How to install performant-code in Claude Code?

Run npx skills add vstorm-co/pydantic-deepagents --skill performant-code -a claude-code in your terminal. You can also place the file directly at ~/.claude/skills/performant-code/SKILL.md.

What does performant-code do?

It teaches the agent architecture patterns for high-throughput code. The skill sets rules for streaming large files, picking efficient algorithms, and applying language-level tweaks.

What optimizations does it suggest for Python?

It recommends using numpy for numeric workloads, collections.Counter instead of custom loops, list comprehensions, and struct.unpack() for binary parsing.

Source text

SKILL.md · MIT
---
name: performant-code
description: "Writing efficient code that handles large data and tight constraints"
tags: [performance, optimization, benchmark]
version: "1.0.0"
---

# Performant Code

How to write code that won't timeout on large inputs.

## Think About Scale First

Before writing code, ask: how big is the data?

| Data size | Approach |
|-----------|----------|
| < 1 MB | Load into memory, any approach works |
| 1-100 MB | Load into memory, but use efficient algorithms |
| 100 MB - 1 GB | Stream/mmap, avoid loading entirely into memory |
| > 1 GB | Streaming only, chunk-based processing |

## I/O Optimization

### Large files
- **mmap** (C: `mmap()`, Python: `mmap.mmap()`) — map file into memory, OS handles paging
- **Buffered binary reads** — `fread()` in C, `open(f, 'rb').read(chunk)` in Python
- **NEVER** read a 500MB file line-by-line with `fgets()` when you need random access

### Writing output
- Buffer writes — don't call `write()` for every byte
- Use `fwrite()` or `sys.stdout.buffer.write()` for binary output
- Flush only when needed

## Algorithm Complexity

- **O(n)** beats **O(n log n)** beats **O(n²)** — always
- Nested loops on large data = timeout. Restructure to single pass + hash map
- Sorting is O(n log n) — only sort if you need to
- Use hash maps/sets for lookup instead of linear search
- Pre-compute what you can outside loops

## Language-Specific Tips

### C
- Use `mmap()` for large file access
- `-O2` or `-O3` for compiler optimizations
- Avoid `malloc()`/`free()` in tight loops — pre-allocate
- Use `memcpy()` instead of byte-by-byte copying
- Integer arithmetic > floating point when possible

### Python
- Use `numpy` for numerical work (100x faster than pure Python loops)
- `collections.Counter`, `defaultdict` — avoid manual counting
- List comprehensions > explicit loops
- `struct.unpack()` for binary parsing
- `subprocess.run()` > `os.system()`
- For heavy computation: consider writing a small C program instead

### General
- Profile before optimizing — find the actual bottleneck
- If a program hangs, it's likely: infinite loop, deadlock, or I/O bound on huge data
- If a program is slow, check: algorithm complexity, I/O pattern, memory allocation

## Constraints Awareness

- If the task says "< 5000 bytes" — count your bytes, use `wc -c`
- If there's a time limit — test with actual data, not toy inputs
- If there's a memory limit — don't load everything into RAM
- Always verify constraints BEFORE declaring done

© vstorm-co · MIT · vstorm-co/pydantic-deepagents

Similar skills

All skills for Programming languages →

From the same set14

The whole set →
environment-discovery The environment-discovery skill trains Claude Code to systematically explore unfamiliar environments before making changes. It checks file structure, data formats, available tools, and existing code—saving debugging time. CX Codex +1 ★ 1,125repo stars report-writing report-writing provides guidelines for structuring analytical reports, drafting stand-alone executive summaries, and citing sources. CX Codex +1 ★ 1,125repo stars build-and-compile The build-and-compile skill helps Claude Code choose build commands from a project's files and troubleshoot compiler or dependency errors. Use it when a build fails or the project setup is unclear. CX Codex +1 ★ 1,125repo stars research-methodology research-methodology — a skill with methodology for structured research: three-phase search, source reliability ranking, and note-taking with confidence levels for each finding. CX Codex +1 ★ 1,125repo stars data-formats The data-formats skill guides file inspection before parsing, from checking binary signatures to sampling large structured files. Use it when a file’s format is unclear. CX Codex +1 ★ 1,125repo stars systematic-debugging systematic-debugging walks the agent through five debugging steps, from reproducing the failure to confirming the fix. Useful once random edits stop working. CX Codex +1 ★ 1,125repo stars verification-strategy verification-strategy — a structured checklist skill for Claude Code to audit file outputs, compiler flags, exit codes, and edge cases before declaring a task finished. CX Codex +1 ★ 1,125repo stars diagram-design The diagram-design skill guides research diagram creation on an Excalidraw canvas through MCP. Use it to map comparisons, processes, architectures, or timelines. CX Codex +1 ★ 1,125repo stars

Project sponsors

Companies that keep this analytics open