sketch-design

sketch-design is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 30 tokens per session (3,169 once invoked), scanned A, original, Apache-2.0.

A small language and method for sketching how a computing operation should work before writing its implementation. It describes tensors, memory actions, loops, and optimization hints in a compact form.

In plain words
What is it for?
Use it to outline GPU, CPU, or NPU operations, including parallel loops, pipelining, vectorization, and hardware-specific work.
Why use it?
It makes the intended data flow and possible parallel work easier for both people and coding agents to understand.

Skill for Claude CodeCodex

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

Good fit Use it to outline GPU, CPU, or NPU operations, including parallel loops, pipelining, vectorization, and hardware-specific work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindspore-ai/akg/sketch-design
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 sketch-design
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 sketch-design

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/sketch-design"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/sketch-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,169 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.00030 $0.03169
Opus 5 $0.00015 $0.01584
Sonnet 5 $0.00006 $0.00634
Haiku 4.5 $0.00003 $0.00317

Measured 10d ago against content hash b61721a6a410, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

sketch-design 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 10d 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.

akg_agents/python/akg_agents/op/resources/skills/designer/sketch-design/SKILL.md · 357 lines

How it starts

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

UnifiedSketch 设计

目标与原则

目标

用最小DSL表达算子设计意图,便于LLM理解和Coder实现。

原则

  • 极简原语:只有少数核心操作(alloc/load/store/compute/...)
  • 统一语法:所有操作都是函数调用风格,无语法差异
  • 标准控制流:使用Python for/range语法,不发明新语法
  • hint分离:复杂优化用hint表达,不影响主逻辑清晰性

核心语法元素

结构声明

sketch <op_name> {
  symbols: M, N, K;                    # 符号变量声明
  tensors: A[M, K]: f16; B[K, N]: f16; C[M, N]: f32;  # 张量声明
  constexpr: m0, k0, n0
}

@llm_hint 装饰器详解

基本语法

@llm_hint 用于给 LLM 提供优化提示,帮助 coder 选择最优的实现策略。

@llm_hint("optimization_type")              # 单一提示
@llm_hint("optimization_type", "context")   # 带上下文的提示
@llm_hint("opt1", "opt2", "opt3")          # 多重提示
优化类型
  • "parallel" - 并行化此循环
  • "pipeline" - 流水线优化
  • "vectorize" - 向量化
  • "unroll" - 循环展开
硬件上下文提示
  • "grididx" - GPU grid 级别并行(对应 blockIdx)
  • "threadidx" - GPU thread 级别并行(对应 threadIdx)
  • "coreidx" - NPU core 级别并行
  • "warp" - GPU warp 级别优化
  • "simd" - CPU/NPU SIMD 向量化

for循环表达

# GPU风格:grid + thread 两级并行
@llm_hint("parallel", "grididx.x")
for i in range(0, M, 128):                  # block级别
    @llm_hint("parallel", "threadidx.x") 
    for j in range(0, N, 32):               # thread级别
        @llm_hint("pipeline")
        for k in range(0, K, k_tile):
            # 计算逻辑

# NPU风格:core级别并行
@llm_hint("parallel", "coreidx")
for core_idx in range(num_cores):
    @llm_hint("pipeline")
    for k in range(0, K, k_tile):
        # 每个core的计算

# CPU风格:SIMD向量化
@llm_hint("parallel")                       # OpenMP并行
for i in range(0, M, tile_size):
    @llm_hint("vectorize", "simd")          # SIMD向量化
    for j in range(tile_size):
        # 向量化计算

核心操作

  1. alloc - 内存分配
  2. load - 数据加载
  3. store - 数据存储
  4. compute函数 - 计算操作

语法概览

sketch matmul {
  symbols: M, N, K;
  tensors: A[M, K]: f16; B[K, N]: f16; C[M, N]: f32;
  
  m0, k0, n0 = 128, 256, 256

  @llm_hint("parallel")
  for i_outer in range(0, ceil(M, m0)):
    @llm_hint("parallel")
    for j_outer in range(0, ceil(N, n0)):

      # 内存分配
      c_tile = alloc([m0, n0], llm_hint=["accumulator", "init_zero"])
      a_tile = alloc([m0, k0], llm_hint=["fast", "input_cache"])
      b_tile = alloc([k0, n0], llm_hint=["fast", "input_cache"])

      @llm_hint("pipeline")
      for k_outer in range(0, ceil(K, k0)):
        # 数据搬移
        load(A[i_outer:i_outer+m0, k_outer:k_outer+k0] -> a_tile)
        load(B[k_outer:k_outer+k0, j_outer:j_outer+n0] -> b_tile)
        
        # 计算操作
        gemm(a_tile, b_tile, dst=c_tile)
        
      # 数据写回
      store(c_tile -> C[i_outer:i_outer+m0, j_outer:j_outer+n0])
}

Read the full file on GitHub · 357 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. 10d ago First seen · 357 lines · 30 tokens per session scan A b61721a6a410

Subscribe to this mod's changes

sketch-design is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 30 tokens to every session and 3,169 once invoked, about $0.0002 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.