We Got Claude to Build CUDA Kernels and teach open models!

This post explores how to use the 'upskill' tool to generate and evaluate agent skills with large models like Claude, then transfer that expertise to smaller, open-source models for complex tasks like writing CUDA kernels.
upskillingyour agents on hard problems. There are two ways to look at that:
- You can take Opus 4.5 or other SOTA models and tackle the hardest problems out there.
- You can take models that run on your laptop and upskill them to harder problems. In this blog post, we’ll show you how to take on the latter.
This blog post walks through the process of using a new tool, upskill , to generate and evaluate agent skills with large models and use them with smaller models. We will benchmark upskill on the task of writing CUDA kernels for diffusers models, but the process is generally useful for cutting costs, or using smaller models on hard and domain-specific problems.
In case you missed it, agent skills are taking the coding agent game by storm. In fact, they’re a straightforward concept to define model context as files, like instructions as markdown and code as scripts. The file format makes them easy to generate, share, and review. In short, they’re a practical medium to share capabilities across models and tools, and they're most useful in specific domains or hard problems. Not stuff the model can do well anyway.
This post showcases this process by using Claude to generate a Skill file that can be used by open source models for a complex and specialized task: write CUDA kernels. We first tried a simple skill based on existing documentation, and we found that it improved performance for some others, but not all. In fact, it could even degrade performance or increase token usage for some models. Check out the plot below to see the performance of the model with and without the basic skill.
Now, let's walk through how you can use upskill to upskill your agents on hard problems, and measure performance.
First, we use Claude Code to build a kernel interactively and export the trace. We worked through the process by instructing, validating, and adding documentation links. This somewhat naive process is important to reveal the models' initial challenges. In fact, you can iterate on this multiple times, by trying to solve the task with draft versions of the skill, and experimenting with smaller models. Each time, you can instruct the agent to improve the skill and test it on the smaller model.
Here's an example of the skill that we created and have been using to build kernels. We started from this agent trace where the agent was able to build a kernel, but not without some help.
Once the teacher model has performed the task, we need them to make a skill. There are a number of effective ways to do this.
- Within the same session, instruct the agent to create a skill file for the task it just completed.
- Use Anthropic ‘skill creator’ skill either within the agent session or with an exported trace and a new agent session.
- Use the
upskilltool to create a skill based on the trace.
In most cases, the first 2 options result in functional skills. However, the performance of an agent with the skill is unknown. That’s where upskill is useful, because it will also generate test cases for your skill based on the trace. It then compares the results under both scenarios: using the trace, or applying the skill. We see below that the original model (Claude Opus) met the same performance with and without the skill. This means the skill captured the task for this model. Great!
Finally, we need to transfer our newly created skill to the tool or model we intend to use. Most tools like codex, cursor, and opencode have settled on a consistent format for skills, which is a directory at {agent}/skills/{skill_name}/SKILL.md, so we just need to copy the skill directory to this location.
With upskill we can pass a skill and a set of models to the eval command and upskill will run the test cases on those models with and without the skill to compare performance. We can see here that the skill increases accuracy on some open models, but not on all.
In this case, we might want to iterate further on the gpt-oss skills by regenerating the skill. We can do upskill generate --from {skill}.
There is more to agent skills than model performance. Often agents can reach a given accuracy with or without a skill, they just need to consume more tokens to get there. For recurring tasks, we want to optimize agents to use less tokens to achieve the same accuracy. The results below reveal another dimension to the skill. Some models are significantly reducing their performance token usage, whilst others are using more tokens with the skill. For example, with moonshotai/Kimi-K2-Thinking the skill is clearly effective in terms of accuracy and token usage. However, for Claude Opus 4.5 there is no clear performance increase and an increase in token usage, so you would not want to use this skill with Claude Opus 4.5.
tldr; try out and evaluate models with the skills you create. Use upskill eval or a similar tool to evaluate the models performance with and without skills.
That’s the high level end to end of upskilling your coding agents on hard problems. Try out upskill now like this:
# install upskill
pip install upskill
# or use uvx
uvx upskill --help
# generate a skill based on an agent trace
upskill generate "write nvidia kernels" --from ./trace.md
# evaluate models on a skill
upskill eval ./skills/my-skill/ --model haiku --model sonnet
# generate skills for local models
upskill generate "parse YAML"
--model opus
--eval-model "unsloth/GLM-4.7-Flash-GGUF:Q4_0"
--eval-base-url http://localhost:8080/v1
We have a high level understanding of how we can upskill an agent. Let’s now look at the use case we solved for writing CUDA kernels.
We didn’t just want to write kernel code, but understand the full kernel-builder workflow: project structure, build.toml configuration, architecture-specific optimizations, and PyTorch bindings. This tutorial shows how upskill creates validated skills that actually work.
The kernel-builder-cuda-kernels skill teaches Claude everything it needs to know about CUDA development: which GPU architecture to target, how to structure a kernel-builder project, when to use shared memory versus registers, and how to write PyTorch bindings.
With this skill, you can tell Claude things like:
Build a fused LayerNorm + GELU kernel optimized for H100.
And Claude will create the complete project structure, CUDA implementation, and build configuration—following the exact conventions that kernel-builder expects.
This isn't about generating boilerplate. The skill encodes domain expertise: H100 uses compute capability 9.0, shared memory should be aligned to 128 bytes, async memory copies require __CUDA_ARCH__ >= 900. Knowledge that would take hours to gather from documentation gets packaged into ~500 tokens that load on demand.
Install upskill:
pip install upskill
# or use uvx for one-off runs
uvx upskill --help
Set your API key:
export ANTHROPIC_API_KEY=sk-ant-...
export HF_TOKEN=hf_...
That's it. Upskill uses Anthropic Claude Opus-4.5 model by default but also supports OpenAI and local models via OpenAI-compatible endpoints as generators. We want to use the more expensive and higher quality models to generate skills, and the smaller ones to use them. Think robin hood.
Let's walk through generating a skill that teaches agents how to build CUDA kernels with HuggingFace's kernels library.
Start with a clear task description:
upskill generate "build optimized CUDA kernels for PyTorch using HuggingFace kernel-builder"
Above we used upskill, but it could in fact be any agent or chat tool and an exported trace.
upskill generate "write kernels" --from <agent-trace>.md
Also, we could start from an existing skill and add to it:
upskill generate "add more error handling and edge cases"
--from ./skills/kernel-builder-cuda-kernels/
upskill loads the existing skill, applies your improvements, and re-evaluates to ensure the changes help.
Source: Hugging Face Blog















