kernel-workflow

kernel-workflow is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 50 tokens per session (752 once invoked), scanned A, original, Apache-2.0.

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

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

Good fit Turning operation requirements into task code, checking PyTorch model definitions, selecting a kernel-generation method, optimizing existing kernel code, and returning the completed result.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindspore-ai/akg/kernel-workflow
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 mindspore-ai/akg --skill kernel-workflow
Clone the repo
git clone --depth 1 https://github.com/mindspore-ai/akg

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 kernel-workflow

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindspore-ai/akg/kernel-workflow/github.svg)](https://agentmods.dev/skills/mindspore-ai/akg/kernel-workflow)
Your own site
<a href="https://agentmods.dev/skills/mindspore-ai/akg/kernel-workflow"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/kernel-workflow/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 kernel-workflow

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/kernel-workflow"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/kernel-workflow.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. 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.00050 $0.00752
Opus 5.5 $0.00020 $0.00301
Sonnet 5.5 $0.00010 $0.00150
Haiku 4.5 $0.00005 $0.00075

Measured 1mo ago against content hash 0f19eb30150b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 (263 stars, last pushed yesterday), licensed Apache-2.0. It adds 50 tokens to every session and 752 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-30.