performant-code

performant-code is a skill for Claude Code, Codex from vstorm-co/pydantic-deepagents. It costs 14 tokens per session (632 once invoked), scanned A, original, MIT.

Guidance for writing code that remains responsive when processing large amounts of data or working under strict time limits. It covers memory use, input and output handling, and algorithm choice.

In plain words
What is it for?
Use it to choose between loading, streaming, or memory-mapping files; reduce repeated work; and replace slow nested searches with more suitable approaches.
Why use it?
It helps avoid timeouts, excessive memory use, and slow code caused by unsuitable data-processing methods.

Skill for Claude CodeCodex

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

Good fit Use it to choose between loading, streaming, or memory-mapping files; reduce repeated work; and replace slow nested searches with more suitable approaches.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/vstorm-co/pydantic-deepagents/performant-code
About the project

Pydantic Deep Agents is a self-hosted terminal AI assistant and Python framework for building coding, research, and other AI agents. It gives agents tools such as file access, shell commands, planning, memory, sub-agents, sandboxed execution, and MCP connections, and supports different models.

vstorm-co/pydantic-deepagents · 1,103 stars · on GitHub · vstorm-co.github.io

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 vstorm-co/pydantic-deepagents --skill performant-code
Clone the repo
git clone --depth 1 https://github.com/vstorm-co/pydantic-deepagents

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 performant-code

README.md
[![agentmods](https://agentmods.dev/badge/skills/vstorm-co/pydantic-deepagents/performant-code/github.svg)](https://agentmods.dev/skills/vstorm-co/pydantic-deepagents/performant-code)
Your own site
<a href="https://agentmods.dev/skills/vstorm-co/pydantic-deepagents/performant-code"><img src="https://agentmods.dev/badge/skills/vstorm-co/pydantic-deepagents/performant-code/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 performant-code

Your own site · 80×15
<a href="https://agentmods.dev/skills/vstorm-co/pydantic-deepagents/performant-code"><img src="https://agentmods.dev/badge/skills/vstorm-co/pydantic-deepagents/performant-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 14 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 632 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00014 $0.00632
Opus 5.5 $0.00006 $0.00253
Sonnet 5.5 $0.00003 $0.00126
Haiku 4.5 $0.00001 $0.00063

Measured 1mo ago against content hash e6b38be0640b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

performant-code scanned grade A 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 1mo 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

- `subprocess.run()` > `os.system()`
apps/cli/skills/performant-code/SKILL.md · 71 lines

How it starts

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

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

Read the full file on GitHub · 71 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. 1mo ago First seen · 71 lines · 14 tokens per session scan A e6b38be0640b

Subscribe to this mod's changes

performant-code is a skill published in the GitHub repository vstorm-co/pydantic-deepagents (1,103 stars, last pushed today), licensed MIT. It adds 14 tokens to every session and 632 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

pydantic-ai

Build production-ready AI agents with PydanticAI — type-safe tool use, structured outputs, dependency injection, and multi-model support.

davila7/claude-code-templates · 32 tokens

building-pydantic-ai-agents

Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), workspaces, structured output, streaming, testing, and multi-agent patterns. Use when the user mentions Pydantic AI, imports pydanticai, or asks to build an AI agent, add tools/capabilities, attach a workspace, defer capability…

pydantic/pydantic-ai · 92 tokens

pydantic-ai-harness

Extend Pydantic AI agents with capabilities from pydantic-ai-harness -- the Coder coding agent, file and shell tools in local or sandboxed workspaces (Modal, E2B, Sprites, smolvm), Code Mode, sub-agents and planning, memory and skills, context compaction, guardrails and spend limits, web research and browsers, hosted…

pydantic/pydantic-ai · 187 tokens

migrating-langchain-to-pydantic-ai

Migrate Python LangChain, LangGraph, or Deep Agents applications to Pydantic AI and, when the source uses harness features, Pydantic AI Harness. Use for LangChain agents, chains, LCEL, direct LangGraph graphs, persistence, interrupts, streaming, and createdeepagent projects with planning, filesystem or sandbox…

pydantic/pydantic-ai · 100 tokens

migrating-mastra-to-pydantic-ai

Migrate TypeScript Mastra applications to Python with Pydantic AI and, only when needed, Pydantic AI Harness. Use when source code imports @mastra/ or relies on Mastra agents, tools, workflows, memory, processors, streaming, approvals, skills, or subagents.

pydantic/pydantic-ai · 73 tokens

migrating-vercel-ai-sdk-and-eve-to-pydantic-ai

Migrate TypeScript Vercel AI SDK or Eve applications to Python with Pydantic AI and, only when needed, Pydantic AI Harness. Use when source code imports ai, @ai-sdk/, or eve, or relies on generateText, streamText, ToolLoopAgent, useChat, Eve agents, tools, skills, subagents, approvals, sessions, channels, schedules…

pydantic/pydantic-ai · 107 tokens