kernel-workflow

A workflow for generating, checking, and optimizing GPU kernels from a task description or existing code. A kernel is a GPU function designed to process data in parallel.

In plain words
What is it for?
Turning operation requirements into task code, checking PyTorch model definitions, selecting a kernel-generation method, optimizing existing kernel code, and returning the completed result.
Why use it?
It separates task validation, implementation choice, generation, and optimization so the agent uses the right path for the input it receives. It supports several GPU programming styles, including Triton, CUDA C++, and TileLang.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/mindspore-ai/akg/kernel-workflow
Any agent
npx skills add mindspore-ai/akg --skill kernel-workflow
Clone the repo
git clone --depth 1 https://github.com/mindspore-ai/akg

Made for: Claude Code, Codex.

Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 752 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00050 $0.00752
Opus 5 $0.00025 $0.00376
Sonnet 5 $0.00010 $0.00150
Haiku 4.5 $0.00005 $0.00075

Measured 3d ago against content hash 0f19eb30150b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

kernel-workflow 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 3d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/check_torch_code.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

akg_agents/python/akg_agents/op/resources/skills/kernel-workflow/SKILL.md · 82 lines

What it actually says

Kernel 算子生成与优化工作流程

流程概述

  1. 分析用户输入 → 只有要求描述还是有 task 代码?
  2. 验证/生成 task 代码 → 详见 references/torch_task_verify.md
  3. 选择生成/优化方式 → 详见 references/tool-selection.md
  4. 执行生成/优化 → 调用子Agent(如用户有额外需求,传递 user_requirements
  5. 返回结果 → 使用 finish

注意:user_requirements 是可选参数。

输入类型判断

  1. 只有需求描述(无代码)→ 直接 call_op_task_builder
  2. task 代码(包含 class Model(nn.Module))→ 加载 references/torch_task_verify.md 进行验证
  3. Kernel 代码需优化(包含 @triton.jit / __global__ 等)→ 验证 task 代码后加载 references/tool-selection.md

基本流程示例

示例 1:用户只有需求描述

用户: 生成一个 ReLU 算子

Think: 用户没有提供代码,直接生成 task。
Action: call_op_task_builder(user_request="生成一个 ReLU 算子")
Observation: {status: "READY", task_code: "...", op_name: "relu"}

Think: task 已生成,加载 tool-selection 指导选择生成方式。
Action: read_file(file_path="resources/skills/kernel-workflow/references/tool-selection.md")
...

示例 2:用户提供 Torch task 代码

用户: 帮我生成这段代码的 kernel: class Model(nn.Module)...

Think: 用户提供了代码,加载验证指南。
Action: read_file(file_path="resources/skills/kernel-workflow/references/torch_task_verify.md")
Observation: <验证指南>

Think: 按指南验证代码格式。
Action: execute_script(script_path="resources/skills/kernel-workflow/scripts/check_torch_code.py", args="--stdin --json", stdin_input="<代码>")
...

示例 3:用户提供 kernel 代码要求优化

用户: 帮我优化这段 Triton kernel: @triton.jit def kernel(...): ...
      对应的 task 是: class Model(nn.Module)...

Think: 用户提供了 kernel 和 task,先验证 task。
Action: read_file(file_path="resources/skills/kernel-workflow/references/torch_task_verify.md")
...验证通过后...
Action: read_file(file_path="resources/skills/kernel-workflow/references/tool-selection.md")
...

参考文档

  1. references/torch_task_verify.md - task 代码验证与补全流程
  2. references/tool-selection.md - 子Agent 选择与二次确认流程

Scripts

  1. scripts/check_torch_code.py - 验证 task 代码格式(参数:--stdin --json

禁止行为

  1. 不验证 task 代码直接调用子Agent
  2. 用户未指定生成方式时自动选择
  3. task 已生成后再调用 call_op_task_builder
  4. 调用子Agent 前不进行二次确认
Files

What ships with it

3 files 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. 3d ago First seen · 82 lines · 50 tokens per session scan A 0f19eb30150b

Subscribe to this mod's changes

kernel-workflow is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 23d ago), licensed Apache-2.0. It adds 50 tokens to every session and 752 once invoked, about $0.0003 per session on Opus 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-30.

Related

Other skills, from other repositories

add-macos-statusbar

Add a macOS menu bar status indicator for NanoClaw. Shows a bolt icon with a green/red dot indicating whether NanoClaw is running, with Start, Stop, and Restart controls. macOS only.

nanocoai/nanoclaw · 49 tokens

cli-anything-3mf

3MF mesh geometry editor — detect and resize cylindrical holes, repair meshes, compare 3D printing files. Works with BambuStudio and PrusaSlicer 3MF files.

HKUDS/CLI-Anything · 44 tokens

platform-port

Guide porting FastLED to new MCU platforms, including int.h types, clockless drivers, SPI implementations, and platform detection. Use when adding support for a new microcontroller family or board.

FastLED/FastLED · 42 tokens

doca-compress

Use this skill for hands-on DOCA Compress programming on a BlueField DPU, ConnectX NIC, or host with DOCA — enabling compress-deflate, decompress-deflate, decompress-lz4-stream, or decompress-lz4-block tasks on a docacompress context (the hardware supports DEFLATE both directions plus LZ4 decompress; LZ4 encode is NOT…

NVIDIA/skills · 242 tokens

pcbway

PCBWay PCB fabrication and assembly — turnkey/consigned assembly, design rules, ordering workflow. Alternative to JLCPCB for manufacturing. Use with KiCad. Use this skill when the user mentions PCBWay, needs turnkey assembly (PCBWay sources parts by MPN), has parts not available on LCSC, needs assembled boards with…

aklofas/kicad-happy · 119 tokens

anta-validation

Validate Arista EOS network state with structured pass/fail verdicts using ANTA. Use for "is this switch healthy", "did my change break anything", "verify BGP/interfaces/hardware are correct", "run a health check on this device". Read-only. A test for a feature the device does not run reports notapplicable — never a…

automateyournetwork/netclaw · 84 tokens