Agent skill

Quark Create Shapeshifter Pass

by amd in amd/Quark

Author a new ShapeShifter graph-transformation pass for AMD Quark (ONNX or PyTorch) so it conforms to the pass framework's conventions and auto-registers.

MITAuto-check passedAI & LLM Engineering

Install Quark Create Shapeshifter Pass

skills CLI
$ npx skills add amd/Quark --skill quark-create-shapeshifter-pass -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install amd/Quark quark-create-shapeshifter-pass --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/amd/Quark.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/_legacy_impl/l1-atomic/shared/quark-create-shapeshifter-pass .claude/skills/quark-create-shapeshifter-pass && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
quark-create-shapeshifter-pass
GitHub stars
181
Token cost
~2.9k tokens
SKILL.md length
945 words
Files
1
Skills in repo
37
Repo updated
First seen
Licence
MIT

At a glance

Author a new ShapeShifter graph-transformation pass for AMD Quark (ONNX or PyTorch) so it conforms to the pass framework's conventions and auto-registers.

  • Works in 5 steps: Intake — capture the transformation, the… → Route — confirm backend (ONNX vs… → Plan — present the file path, class… → …
  • A developer says add a ShapeShifter pass
  • SKILL.md covers Purpose, Inputs, Outputs: shapeshifter_pass.py and Interaction Flow, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Quark Create Shapeshifter Pass is an agent skill from amd/Quark. Author a new ShapeShifter graph-transformation pass for AMD Quark (ONNX or PyTorch) so it conforms to the pass framework's conventions and auto-registers. Use when a developer says "add a ShapeShifter pass", "create a new onnx or pytorch pass", "write a custom Quark graph transform", or "contribute a community ShapeShifter pass". Walks through choosing backend and name, subclassing ONNXPass/PytorchPass with the registerpass decorator, implementing defaultconfig and runforconfig, adding a per-pass test, and…

Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Deep learning and LLM inference and serving. It works with ONNX and PyTorch. The licence is MIT.

When your agent uses it

  • A developer says add a ShapeShifter pass
  • Create a new onnx
  • Write a custom Quark graph transform
  • Contribute a community ShapeShifter pass

Example prompts

  • “s conventions and auto-registers. Use when a developer says”
  • “create a new onnx or pytorch pass”
  • “write a custom Quark graph transform”
  • “/quark-create-shapeshifter-pass”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Intake — capture the transformation, the backend, the pass name, and any config params.
  2. Route — confirm backend (ONNX vs PyTorch) and core-vs-community placement; derive the
  3. Plan — present the file path, class skeleton, _default_config params, and the
  4. Confirm — get explicit approval before writing source files under quark/.
  5. Execute or Summarize — write the pass, the test, and the doc entry; run the test and

What it can do on your machine

Read from SKILL.md and the folder at commit 313cb0b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python and yaml).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Quark Create Shapeshifter Pass loads about 2.9k tokens when it runs. Until then it costs about 159 tokens; SKILL.md has 945 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~159
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from amd/Quark at commit 313cb0b, republished under its MIT licence (© amd). 945 words, ~2,936 tokens.

Download SKILL.mdSave it as .claude/skills/quark-create-shapeshifter-pass/SKILL.md (or your agent's skills folder).
name
quark-create-shapeshifter-pass
description
Author a new ShapeShifter graph-transformation pass for AMD Quark (ONNX or PyTorch) so it conforms to the pass framework's conventions and auto-registers. Use when a developer says "add a ShapeShifter pass", "create a new onnx_ or pytorch_ pass", "write a custom Quark graph transform", or "contribute a community ShapeShifter pass". Walks through choosing backend and name, subclassing ONNXPass/PytorchPass with the register_pass decorator, implementing _default_config and _run_for_config, adding a per-pass test, and documenting it. Developer-facing authoring tool, not an end-user quantization step.
layer
l1-atomic
backend
shared
primary_artifact
shapeshifter_pass.py
source_knowledge
docs/source/quark_shapeshifter.rst, docs/source/quark_shapeshifter_onnx_passes.rst, docs/source/quark_shapeshifter_torch_passes.rst…

quark-create-shapeshifter-pass

Purpose

Author a new ShapeShifter transformation pass that is correct on the first try. ShapeShifter is Quark's pass-based graph-transformation framework (quark/shapeshifter/): each pass is a self-contained unit that takes a model, applies one transformation, and returns it. Passes auto-register by filename via a @register_pass decorator, so a new pass is usable from the CLI, the Python API, and the ONNX quantizer's ShapeShifterYaml with zero manual wiring — if it follows the naming, subclassing, and config conventions exactly. This skill replays those conventions in authoring order and flags the non-obvious traps (defaults are not auto-applied; class/file naming is load-bearing) so the developer focuses on the transformation logic.

Inputs

  • Required: the transformation the pass performs (one sentence); the backend it targets (ONNX onnx.ModelProto or PyTorch callable — a pass is one or the other, never both).
  • Required: a pass name in snake_case, prefixed onnx_ or pytorch_ (this becomes the filename, the registry key, and the YAML key — pick it carefully).
  • Optional: config parameters the pass exposes (name, type, default, whether required); whether it is a core pass (quark/shapeshifter/passes/) or a community pass (quark/contrib/shapeshifter_community_passes/); a minimal model that exercises it (for the test).

Outputs: shapeshifter_pass.py

The primary artifact is the new pass module, written to quark/shapeshifter/passes/<pass_name>.py (core) or quark/contrib/shapeshifter_community_passes/<pass_name>.py (community). <pass_name> matches the chosen name (e.g. onnx_drop_identity.py). Side-effect artifacts:

  • test/test_for_cli/test_shapeshifter_<pass_name>.py — one test per pass (project convention).
  • A documentation entry in docs/source/quark_shapeshifter_onnx_passes.rst (ONNX) or docs/source/quark_shapeshifter_torch_passes.rst (PyTorch).

No JSON schema — this artifact is Quark source code, not a cross-skill handoff artifact.

Interaction Flow

  1. Intake — capture the transformation, the backend, the pass name, and any config params. If the developer described the transform in prior conversation, extract these first.
  2. Route — confirm backend (ONNX vs PyTorch) and core-vs-community placement; derive the file path, class name, and YAML key from the name.
  3. Plan — present the file path, class skeleton, _default_config params, and the _run_for_config outline before writing. Confirm the name does not collide with an existing registry entry (ls quark/shapeshifter/passes/).
  4. Confirm — get explicit approval before writing source files under quark/.
  5. Execute or Summarize — write the pass, the test, and the doc entry; run the test and confirm the pass registers. Summarize what was created and how to invoke it.

Backend & Placement Decision

QuestionChoose
Operates on onnx.ModelProto (a graph)?ONNX pass → subclass ONNXPass, prefix onnx_
Operates on a PyTorch callable (nn.Module, function)?PyTorch pass → subclass PytorchPass, prefix pytorch_
Officially maintained / production?Core → quark/shapeshifter/passes/
Contributed / experimental?Community → quark/contrib/shapeshifter_community_passes/

A workflow must be all-ONNX or all-PyTorch; the Engine raises ValueError on mixing.

Naming Rules (load-bearing)

  • Filename = pass name = registry key = YAML key. onnx_drop_identity.py → pass name onnx_drop_identity, used verbatim under passes: in YAML. There is no separate name string.
  • Prefix onnx_ or pytorch_.
  • Files starting with _ (e.g. __init__.py) are skipped by discovery.
  • Class name must end in Pass (only such classes are discovered / exported). Convention: ONNX<Thing>Pass / Pytorch<Thing>Pass.
  • Duplicate pass names raise ValueError at import (with a core-vs-community conflict message).

Authoring the Pass

Two required methods (see quark/shapeshifter/pass_base.py):

  • _default_config(self) -> dict[str, PassConfigParam] — declare each config param with PassConfigParam(type_, default_value, required, description); end with config.update(self.config) (the convention every pass follows).
  • _run_for_config(self, model, config) -> model — the transformation. ONNX: takes/returns onnx.ModelProto. PyTorch: takes/returns any Callable.

ONNX skeleton (quark/shapeshifter/passes/onnx_drop_identity.py):

python
#
# Copyright (C) 2025 - 2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#

from typing import Any

import onnx
from onnx import ModelProto
from onnxruntime.quantization.onnx_model import ONNXModel  # helpers: remove_nodes, etc.

from quark.common.utils.log import ScreenLogger
from quark.shapeshifter.pass_base import ONNXPass, register_pass
from quark.shapeshifter.pass_config import PassConfigParam

logger = ScreenLogger(__name__)


@register_pass
class ONNXDropIdentityPass(ONNXPass):
    """Remove Identity nodes from the graph."""

    def _default_config(self) -> dict[str, PassConfigParam]:
        config = {
            "drop_identity": PassConfigParam(
                type_=bool,
                default_value=True,
                required=True,
                description="Whether to remove Identity nodes.",
            ),
        }
        config.update(self.config)
        return config

    def _run_for_config(self, model: ModelProto, config: dict[str, Any]) -> ModelProto:
        # config is the RAW user dict from YAML — read values directly and
        # supply your own default (see Critical Gotcha below).
        if not config.get("drop_identity", True):
            logger.warning("onnx_drop_identity: drop_identity is False, skipping.")
            return model
        onnx_model = ONNXModel(model)
        # ... transform onnx_model.model, then clean up ...
        onnx_model.topological_sort()
        return onnx_model.model

PyTorch skeleton mirrors this: subclass PytorchPass, _run_for_config(self, model, config) returns the (possibly mutated) callable. See quark/shapeshifter/passes/pytorch_remove_dropout.py.

Show full SKILL.md (403 more words)Show less

Critical Gotcha: defaults are NOT auto-applied

The Engine calls _run_for_config directly with the raw YAML dict — it never calls run() or _default_config() (see quark/shapeshifter/engine.py, the pass-execution loop: pass_instance._run_for_config(model, pass_config)). Consequences the pass author MUST handle:

  • The config argument is exactly what the user wrote (e.g. {"drop_identity": True}), not a dict of PassConfigParam objects.
  • Apply defaults yourself inside _run_for_config, e.g. config.get("drop_identity", True). Do not assume _default_config() populated anything.
  • Read flat values: config["drop_identity"] — not config.get("x", {}).get("value", ...). (_default_config still documents the schema and is good practice; it is just not the runtime source of defaults today.)

Registration & Usage (zero-config)

No manual registration. quark/shapeshifter/passes/__init__.py imports every non-_ module via pkgutil, triggering @register_pass, which adds the class to the global REGISTRY. Importing quark.shapeshifter registers the pass. Then it works everywhere:

CLI — quark-cli shapeshifter config.yaml:

yaml
input_model_path: /path/in.onnx
passes:
  onnx_drop_identity:
    drop_identity: true
output_model_path: /path/out.onnx

Python API:

python
from pathlib import Path
from quark.shapeshifter import shapeshifter, RunConfig, ONNXModelConfig

cfg = RunConfig(
    input_model_config=ONNXModelConfig(input_model_path=Path("in.onnx")),
    passes={"onnx_drop_identity": {"drop_identity": True}},
    output_model_path="out.onnx",
)
shapeshifter(cfg)                                  # file-based → returns None
new_model = shapeshifter(RunConfig(passes={"onnx_drop_identity": {}}), model=proto)  # in-memory

Inside the ONNX quantizer — add it to a ShapeShifterYaml under preprocess_passes: (runs on the float model before quantization) or postprocess_passes: (runs on the quantized Q/DQ model), passed via extra_options={"ShapeShifterYaml": "config.yaml"}.

Test & Docs (required to ship)

  • Test: test/test_for_cli/test_shapeshifter_<pass_name>.py. Follow test_shapeshifter_onnx_convert_clip_to_relu_pass.py: build a tiny model with onnx.helper, write a YAML, run cli(["shapeshifter", yaml_path]), assert on the output graph. Use @use_temporary_directory from quark.common.utils.testing_utils.
  • Docs: add an option-by-option entry to docs/source/quark_shapeshifter_onnx_passes.rst (ONNX) or ..._torch_passes.rst (PyTorch), matching the existing style. CI (.github/workflows/ci_build_and_unittest_cli.yml) already triggers on quark/shapeshifter/** and these doc paths.

Recovery

  • "Pass not registered" / KeyError on pass name — filename ≠ YAML key, file starts with _, the class name does not end in Pass, or @register_pass is missing. Check all four.
  • ValueError: ... already registered — name collides with a core or community pass. Rename.
  • ValueError: ... is not an ONNX/PyTorch pass — the workflow mixes backends, or the class subclasses the wrong base. All passes in one run must share a backend.
  • Config value ignored / pass is a silent no-op — you relied on _default_config() for defaults, or read config["x"]["value"]. Read flat values with an explicit default in _run_for_config (see Critical Gotcha).
  • register_pass could not find __file__ — the class was defined in a REPL/exec context; it must live in a real .py file under a discovered directory.

Notes

  • Framework source: quark/shapeshifter/pass_base.py (bases, REGISTRY, register_pass), quark/shapeshifter/engine.py (execution loop — proves defaults are not auto-applied), quark/shapeshifter/pass_config.py (PassConfigParam), quark/shapeshifter/passes/__init__.py (discovery). Worked examples: onnx_convert_clip_to_relu.py, pytorch_remove_dropout.py.
  • Adding conventions live in docs/source/quark_shapeshifter.rst ("Adding New Passes").
  • primary_artifact is .py source (not a canonical handoff artifact), so validate_skill.py emits a non-blocking WARN for it — expected.
  • Do not silently skip the test or doc entry; both are required by CI and project convention.

© amd, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/_legacy_impl/l1-atomic/shared/quark-create-shapeshifter-pass of amd/Quark.

Open the folder on GitHubat commit 313cb0b

Compare with similar skills

Quark Create Shapeshifter Pass next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Quark Create Shapeshifter Pass compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Quark Create Shapeshifter Pass this skillamd/Quark181—~2.9kAutomated safety check: PassMIT
Model Builderqualcomm/qai-appbuilder246—~4.1kAutomated safety check: PassBSD-3-Clause
Tao Port Huggingface ModelNVIDIA/skills3.5k—~4.5kAutomated safety check: NotesApache-2.0
Model Inference Optimizemajiayu000/spellbook286—~1.1kAutomated safety check: PassMIT
Graphsignalgraphsignal/graphsignal257—~6.2kAutomated safety check: PassApache-2.0
Embedded AI Deploymentmatlab/agent-skills-playground1811 repos~3.4kAutomated safety check: PassCustom licence

Similar skills

  • Model Builder

    qualcomm/qai-appbuilder

    QAI ModelBuilder. An agent skill from qualcomm/qai-appbuilder.

    246 GitHub stars~4.1k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Official

    Integrate a HuggingFace Computer Vision model into the NVIDIA TAO Toolkit ecosystem (tao-core config, tao-pytorch trainer, tao-deploy TensorRT pipeline).

    3.5k GitHub stars~4.5k tokensUpdated today
    AI & LLM EngineeringAuto-check: notes
  • Model Inference Optimize

    majiayu000/spellbook

    优化实际模型推理链路,将正确性对齐、分段 profiling、显存与数据搬运、TensorRT/ONNX/PyTorch 后端、attention/kernel、FP8/compile、缓存与少步采样、质量回归、GPU 成本和服务验收串成同一实验闭环。当用户要求推理提速、降低显存或 GPU 成本、复现模型效果、定位 GPU 利用率低、优化图像/视频/扩散模型或自托管 LLM 时使用,提供…

    286 GitHub stars~1.1k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Graphsignal

    graphsignal/graphsignal

    Profile AI inference workloads (vLLM, SGLang, TensorRT-LLM, PyTorch, any GPU application) with the Graphsignal profiler and read the results from its local /signals JSON endpoint.

    257 GitHub stars~6.2k tokensUpdated 10 days ago
    AI & LLM EngineeringAuto-check passed
  • Embedded AI Deployment

    matlab/agent-skills-playground

    Deploy AI models to embedded hardware using MathWorks tools (MATLAB, Simulink, Embedded Coder).

    181 GitHub starsUsed in 1 repo~3.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Perforatedai

    PerforatedAI/PerforatedAI

    Expert in PerforatedAI library for adding artificial dendrites to PyTorch neural networks.

    237 GitHub stars~17k tokensUpdated today
    AI & LLM EngineeringAuto-check passed

More from amd/Quark

All 37 skills in this repo
  • Author or restructure a Quark Agent Skill so it conforms to this project's template, contracts, and layer rules.

    181 GitHub stars~3.1k tokensUpdated 10 days ago
    Auto-check passed
  • Run, resume, monitor, diagnose, and report Quark Quant-Perf workflows for PyTorch and HuggingFace transformers models.

    181 GitHub stars~3k tokensUpdated 10 days ago
    Auto-check passed
  • Collect and normalize environment facts (OS, Python, GPU, CUDA/ROCm, container state) before Quark installation or PTQ planning.

    181 GitHub stars~1.4k tokensUpdated 10 days ago
    Auto-check passed
  • Quark Install

    amd/Quark

    Install or verify the AMD Quark package and its dependencies.

    181 GitHub stars~1.8k tokensUpdated 10 days ago
    Auto-check: notes
  • L3 recipe that runs quark.onnx.AutoSearchPro end-to-end on a user .onnx model: intake → preset selection (or custom search space) → calibration / eval data reader → standalone autosearch script…

    181 GitHub stars~3.4k tokensUpdated 10 days ago
    Auto-check passed
  • Diagnose failed Quark ONNX installation, calibration, quantization, custom-op compilation, or export attempts.

    181 GitHub stars~4.8k tokensUpdated 10 days ago
    Auto-check passed

Works with

Questions about Quark Create Shapeshifter Pass

What does Quark Create Shapeshifter Pass do?

Author a new ShapeShifter graph-transformation pass for AMD Quark (ONNX or PyTorch) so it conforms to the pass framework's conventions and auto-registers. Quark Create Shapeshifter Pass is an agent skill from amd/Quark. Author a new ShapeShifter graph-transformation pass for AMD Quark (ONNX or PyTorch) so it conforms to the pass framework's conventions and auto-registers.

When should I use Quark Create Shapeshifter Pass?

Quark Create Shapeshifter Pass fits situations like: A developer says add a ShapeShifter pass; create a new onnx; write a custom Quark graph transform; contribute a community ShapeShifter pass.

How do I install Quark Create Shapeshifter Pass in Claude Code?

Run `npx skills add amd/Quark --skill quark-create-shapeshifter-pass -a claude-code`. Or copy the skill folder (skills/_legacy_impl/l1-atomic/shared/quark-create-shapeshifter-pass in amd/Quark) into .claude/skills/quark-create-shapeshifter-pass in your project. Claude Code loads it when a task matches its description.

How do I install Quark Create Shapeshifter Pass in Codex?

Run `npx skills add amd/Quark --skill quark-create-shapeshifter-pass -a codex`. Or copy the skill folder (skills/_legacy_impl/l1-atomic/shared/quark-create-shapeshifter-pass in amd/Quark) into .agents/skills/quark-create-shapeshifter-pass in your project. Codex loads it when a task matches its description.

Can I use Quark Create Shapeshifter Pass in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add amd/Quark --skill quark-create-shapeshifter-pass -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/quark-create-shapeshifter-pass, .gemini/skills/quark-create-shapeshifter-pass, .github/skills/quark-create-shapeshifter-pass and .opencode/skills/quark-create-shapeshifter-pass in your project.

What does Quark Create Shapeshifter Pass need to run?

SKILL.md names no scripts, command-line tools or credentials: Quark Create Shapeshifter Pass is instructions for the agent only. Our summary lists: Python 3.

Does Quark Create Shapeshifter Pass access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Quark Create Shapeshifter Pass safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Quark Create Shapeshifter Pass use?

Quark Create Shapeshifter Pass is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Quark Create Shapeshifter Pass use?

About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Quark Create Shapeshifter Pass?

Skills that share tags, products or a category with Quark Create Shapeshifter Pass: Model Builder (qualcomm/qai-appbuilder, 246 stars), Tao Port Huggingface Model (NVIDIA/skills, 3.5k stars), Model Inference Optimize (majiayu000/spellbook, 286 stars) and Graphsignal (graphsignal/graphsignal, 257 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Quark Create Shapeshifter Pass?

amd (a GitHub organization) maintains it in amd/Quark, which has 181 GitHub stars. The repository holds 37 skills in this directory. The repository was last updated on September 28, 2026.

Source: amd/Quark on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.