code-optimization

code-optimization is a skill for Claude Code, Codex from bytedance/agentkit-samples. It costs 47 tokens per session (2,954 once invoked), scanned A, original, Apache-2.0.

A code-performance improvement skill for languages such as C++, Python, Java, and Rust. It measures execution time and memory use, then compares an improved version with the original.

In plain words
What is it for?
Use it to find bottlenecks, improve existing code, benchmark it against a baseline, and produce a report describing the changes and results.
Why use it?
It replaces guesswork about whether a code change is faster or uses less memory with measured comparisons. It also limits the work to at most two optimisation rounds.

Skill for Claude CodeCodex ✓ vendor

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

Good fit Use it to find bottlenecks, improve existing code, benchmark it against a baseline, and produce a report describing the changes and results.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bytedance/agentkit-samples/code-optimization
About the project

bytedance/agentkit-samples is a collection of examples and tutorials for Volcengine AgentKit, an AI-agent development platform for building, deploying, and operating agent applications. Developers use the samples to learn agent creation, multi-agent collaboration, memory, retrieval, MCP integrations, media generation, customer service, and other workflows. The catalogue skills provide agent workflows based on these examples.

bytedance/agentkit-samples · 474 stars · on GitHub

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 bytedance/agentkit-samples --skill code-optimization
Clone the repo
git clone --depth 1 https://github.com/bytedance/agentkit-samples

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/bytedance/agentkit-samples/code-optimization/github.svg)](https://agentmods.dev/skills/bytedance/agentkit-samples/code-optimization)
Your own site
<a href="https://agentmods.dev/skills/bytedance/agentkit-samples/code-optimization"><img src="https://agentmods.dev/badge/skills/bytedance/agentkit-samples/code-optimization/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 code-optimization

Your own site · 80×15
<a href="https://agentmods.dev/skills/bytedance/agentkit-samples/code-optimization"><img src="https://agentmods.dev/badge/skills/bytedance/agentkit-samples/code-optimization.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,954 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00047 $0.02954
Opus 5.5 $0.00019 $0.01182
Sonnet 5.5 $0.00009 $0.00591
Haiku 4.5 $0.00005 $0.00295

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

Security

Grade A, and why

code-optimization scanned grade A with 0 findings 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/agentkit/code-optimization/SKILL.md · 389 lines

How it starts

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

Code Optimization Skill

You are an expert code optimization assistant focused on improving code performance beyond standard library implementations.

When to Use This Skill

Use this skill when users need to:

  • Optimize existing code to achieve better performance than standard library implementations
  • Benchmark and measure code execution time and memory usage
  • Iteratively improve code performance through multiple optimization rounds (maximum 2 iterations)
  • Compare optimized code performance against baseline implementations
  • Generate detailed optimization reports documenting improvements

Optimization Constraints

IMPORTANT:

  • Maximum optimization iterations: 2 rounds
  • Stop optimization after 2 versions (v1, v2) even if further improvements are possible
  • Focus on high-impact optimizations in each iteration
  • If significant improvement (>50% speedup) is achieved earlier, you may stop before reaching the limit

Optimization Workflow

Step 1: Read and Analyze Code

Use file-related tools to:

  • Read the user's code file from local filesystem
  • Understand the function to be optimized
  • Identify performance bottlenecks
  • Implement the optimization

Example:

# Read code file
content = read_file("topk_benchmark.cpp")

# Analyze and implement optimization
# Fill in the my_topk_inplace function with optimized implementation

Step 2: Compile and Execute

Execute code via command line to measure performance:

For C++ code:

# Compile with optimization flags
g++ -O3 -std=c++17 topk_benchmark.cpp -o topk_benchmark

# Run and capture output
./topk_benchmark

For Python code:

python3 optimization_benchmark.py

For other languages:

# Java
javac MyOptimization.java && java MyOptimization

# Rust
rustc -O optimization.rs && ./optimization

# Go
go build optimization.go && ./optimization

Step 3: Extract Performance Metrics

From execution output, extract:

  • Execution time: Wall-clock time, CPU time
  • Memory usage: Peak memory, memory delta
  • Comparison with baseline: Speedup factor, time difference
  • Correctness verification: Test results, accuracy checks

Read the full file on GitHub · 389 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 389 lines · 47 tokens per session scan A 10564ac4c0c2

Subscribe to this mod's changes

code-optimization is a skill published in the GitHub repository bytedance/agentkit-samples (474 stars, last pushed 3d ago), licensed Apache-2.0. It adds 47 tokens to every session and 2,954 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.