op-task-extractor

op-task-extractor is a skill for Claude Code, OpenCode from mindspore-ai/akg. It costs 27 tokens per session (1,158 once invoked), scanned A, original, Apache-2.0.

A task-extraction tool that turns source code or a natural-language operator description into a self-contained Python task file for later generation or testing.

In plain words
What is it for?
It analyzes code, inlines custom dependencies, builds model and input functions, and validates the resulting task file for structure and runtime behavior.
Why use it?
It gathers the operator's inputs, outputs, shapes, data types, and dependencies into a standard format so later steps can work from a consistent file.

Skill for Claude CodeOpenCode

Written for Claude Code and OpenCode: argument-hint in frontmatter, but also installed under .opencode/.

Good fit It analyzes code, inlines custom dependencies, builds model and input functions, and validates the resulting task file for structure and runtime behavior.

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

Made for: Claude Code, OpenCode.

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 op-task-extractor

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/op-task-extractor"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/op-task-extractor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,158 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.00027 $0.01158
Opus 5 $0.00014 $0.00579
Sonnet 5 $0.00005 $0.00232
Haiku 4.5 $0.00003 $0.00116

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

Security

Grade A, and why

op-task-extractor 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 9d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/validate_kernelbench_task.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/workspace/.opencode/skills/op-task-extractor/SKILL.md · 122 lines

How it starts

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

What I do

将用户的输入(代码文件或自然语言描述)转化为标准格式的 {op_name}.py 任务文件,并通过验证脚本确认可执行。

When to use me

需要为后续算子生成工作流准备标准化任务文件时

Workflow

Step 1  判断输入类型
  ├─ 用户提供了符合格式要求的代码文件 → 保存为 {op_name}.py → Step 4(验证)
  │     ├─ 通过 → 返回(任务结束)
  │     └─ 失败 → Step 2(分析并重写)
  └─ 用户提供自然语言描述 → Step 2
Step 2  代码分析 & 依赖追踪
Step 3  构建 {op_name}.py(参考末尾「输出格式」)
Step 4  运行验证脚本(必须执行)
Step 5  用户确认

Step 1: 判断输入类型

  • 用户提供了符合格式要求的代码文件 → 直接保存为 {op_name}.py,跳到 Step 4 运行验证脚本
  • 其他 → 进入 Step 2

Step 2: 代码分析 & 依赖追踪

  • 读取用户确认的 framework, backend, arch 配置
  • 如有源代码:
    • 识别待优化部分,提取 shape/dtype 信息,确定输入/输出签名
    • 分析依赖关系(AST 级别),追踪自定义函数/类,确定需要内联的外部依赖
  • 如为自然语言描述:
    • 从描述中理解算子语义,确定合理的 shape/dtype 默认值

Step 3: 构建 {op_name}.py

按末尾「输出格式」生成文件,用 PyTorch/Python 实现:

  • 将算子逻辑包装到 Model.forward()
  • 如有初始化状态(权重、参数),放入 Model.__init__()
  • 将所有自定义依赖内联到文件中
  • 根据 shape/dtype 信息构建 get_inputs()get_init_inputs()
  • 如用户未提供 shape/dtype,从代码上下文推断合理默认值

Step 4: 运行验证脚本(必须执行)

使用命令模板执行 @scripts/validate_kernelbench_task.py

python <本skill绝对路径>/scripts/validate_kernelbench_task.py \
  /abs/path/{op_name}.py --json

验证脚本同时执行静态检查(4 个组件齐全)和运行时检查(实例化、前向传播、NaN/Inf、一致性)。

结果处理

  • 输出 [VALID] + 来源是 Step 1 的用户原始文件 → 直接返回,任务结束
  • 输出 [VALID] + 来源是 Step 3 新生成的文件 → 进入 Step 5
  • 输出 [INVALID] → 根据错误信息修复代码,重新验证(最多 2 次)
  • 重试 3 次仍失败 → 向用户报告错误,请求协助

Step 5: 用户确认

任务描述文件内容非用户提供的原始代码时,必须执行

将完整的 {op_name}.py 内容展示给用户,使用 question 工具请求确认。 不通过则结合用户反馈返回 Step 3。


关键约束

约束 说明
自包含 所有依赖函数必须内联,禁止 import 项目内模块
可执行 Model(*get_init_inputs()).forward(*get_inputs()) 必须直接运行
确定性 给定相同输入,输出必须一致
无 NaN/Inf forward 输出不能包含 NaN 或 Inf
禁止重写 原始函数可运行就直接复用,一行都不改
返回一致 返回类型/形状必须与原始实现一致
合理输入 get_inputs 应提供合理大小的输入(不能过小或过大)

输出格式

最终文件必须是单一自包含 Python 文件,包含以下 4 个部分:

# 1. Imports 区(只允许标准库和 PyTorch 相关包)
import torch
import torch.nn as nn

# 2. Model 类
class Model(nn.Module):
    def __init__(self, <init_params>):
        super(Model, self).__init__()

    def forward(self, <forward_inputs>) -> torch.Tensor:
        return output

# 3. get_inputs():返回 forward() 的输入参数列表
def get_inputs():
    input1 = torch.randn(batch_size, dim)
    input2 = torch.randn(batch_size, dim)
    return [input1, input2]

# 4. get_init_inputs():返回 __init__() 的初始化参数列表
def get_init_inputs():
    return [dim_value]

Read the full file on GitHub · 122 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. 9d ago First seen · 122 lines · 27 tokens per session scan A ccb3abc0b08f

Subscribe to this mod's changes

op-task-extractor is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 27 tokens to every session and 1,158 once invoked, about $0.0001 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-09-03.

Related

Other skills, from other repositories

matlab

Build, review, migrate, and safely plan MATLAB or GNU Octave numerical workflows, including arrays, tabular/time data, tests, projects, graphics, MAT files, and explicit Python interoperability.

K-Dense-AI/scientific-agent-skills · 42 tokens

pennylane

Hardware-agnostic quantum ML framework with automatic differentiation. Use when training quantum circuits via gradients, building hybrid quantum-classical models, or needing device portability across IBM/Google/Rigetti/IonQ. Best for variational algorithms (VQE, QAOA), quantum neural networks, and integration with…

K-Dense-AI/scientific-agent-skills · 98 tokens

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

rocm-kernels

Provides guidance for writing and benchmarking optimized Triton kernels for AMD GPUs (MI355X, R9700) on ROCm, targeting HuggingFace diffusers (LTX-Video, SD3, FLUX) and transformers. Core kernels: RMSNorm, RoPE 3D, GEGLU, AdaLN. Includes XCD swizzle, autotune, diffusers integration patterns, and LTX-Video pipeline…

huggingface/kernels · 93 tokens

holoscan-install-wheel

Install Holoscan SDK Python wheel via pip into a venv. Use for Python installs; not for native C++/apt or Conda installs.

NVIDIA/skills · 37 tokens

typing-exclusion-worker

Python typing exclusion worker: remove assigned mypy exclusion modules in small scoped batches, fix typing issues, run validation, and produce a structured completion summary. Use when running parallel typing-debt workers or when asked to remove modules from pyproject mypy exclusion overrides.

getsentry/skills · 57 tokens