neuron-nki-writing

neuron-nki-writing is a skill for Claude Code, Codex from aws-neuron/neuron-agentic-development. It costs 172 tokens per session (6,038 once invoked), scanned A, original, Apache-2.0.

A guide for creating and changing NKI kernels, programs that run computations on AWS Trainium or Inferentia hardware. It covers translating operations from PyTorch or NumPy, adding shape and data-type support, and changing tiling strategies.

In plain words
What is it for?
It is used to write a new NKI kernel, convert an existing PyTorch or NumPy operation, add supported shapes or data types, refactor tiling, or implement a kernel feature.
Why use it?
It provides rules for writing code that matches NKI's language and hardware constraints, including constraints that can otherwise cause compilation failures.

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/aws-neuron/neuron-agentic-development/neuron-nki-writing
Any agent
npx skills add aws-neuron/neuron-agentic-development --skill neuron-nki-writing
Clone the repo
git clone --depth 1 https://github.com/aws-neuron/neuron-agentic-development

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 neuron-nki-writing

README.md
[![agentmods](https://agentmods.dev/badge/skills/aws-neuron/neuron-agentic-development/neuron-nki-writing.svg)](https://agentmods.dev/skills/aws-neuron/neuron-agentic-development/neuron-nki-writing)
Your own site
<a href="https://agentmods.dev/skills/aws-neuron/neuron-agentic-development/neuron-nki-writing"><img src="https://agentmods.dev/badge/skills/aws-neuron/neuron-agentic-development/neuron-nki-writing.svg" alt="Measured on agentmods" height="20"></a>
Per session 172 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,038 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.00172 $0.06038
Opus 5 $0.00086 $0.03019
Sonnet 5 $0.00034 $0.01208
Haiku 4.5 $0.00017 $0.00604

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

Security

Grade A, and why

neuron-nki-writing 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 5d ago.

The scan reads SKILL.md. This mod also ships 28 executable files (examples/associative_scan.py, examples/elementwise_exp.py, examples/simple_matmul.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.

skills/neuron-nki-writing/SKILL.md · 468 lines

How it starts

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

Writing NKI Kernels

This skill guides writing and modifying NKI (Neuron Kernel Interface) kernels — from new kernel creation (PyTorch/NumPy/natural language translation) to editing existing kernels (adding shape/dtype support, refactoring tiling, implementing new features). Focus on correctness using documented APIs.

Critical: NKI Language Constraints

BEFORE writing any NKI code, read references/nki-language-constraint.md for the complete list of required and forbidden API patterns covering Beta 1 → Beta 2, Beta 2 → NKI 0.3.0, and NKI 0.3.0 → NKI 0.4.0 migration rules. Violating ANY rule is a compilation failure.

Hardware limits: don't hardcode the PSUM free dim

The PSUM free-dimension limit is generation- and dtype-gated and has changed across releases. Current values:

  • gen2 / gen3: 512 (one PSUM bank)
  • gen4: 4096 for a float32 dst, 8192 for a bfloat16 dst (entire PSUM)

This is not a queryable tile_size field — nl.tile_size.psum_bank_fmax is a fixed 512 (fp32 elements per bank) and is neither dtype- nor generation-aware, so do not use it as the free-dim limit. Authoritative source: the nc_matmul, nc_matmul_mx, and dma_transpose API blocks via /neuron-nki-docs. Treat any PSUM free-dim number inlined in this skill's reference files as illustrative; confirm against those API blocks.

tile_size does authoritatively report other limits — use it for those: nl.tile_size.pmax (128), nl.tile_size.psum_num_banks (bank cycling), nl.tile_size.gemm_moving_fmax (matmul moving-operand SBUF free dim), and nl.tile_size.sbuf_fmax / sbuf_fmax_bytes (SBUF capacity).

Quick Start

Minimal working kernel structure:

import nki
import nki.isa as nisa
import nki.language as nl

@nki.jit
def my_kernel(input_hbm: nl.ndarray) -> nl.ndarray:
    """One-line description of kernel operation."""
    # 1. Allocate SBUF tile
    tile = nl.ndarray(input_hbm.shape, dtype=input_hbm.dtype, buffer=nl.sbuf)

    # 2. Load from HBM to SBUF
    nisa.dma_copy(dst=tile, src=input_hbm[0:input_hbm.shape[0], 0:input_hbm.shape[1]])

    # 3. Compute (example: element-wise exp)
    result = nl.ndarray(tile.shape, dtype=tile.dtype, buffer=nl.sbuf)
    nisa.activation(dst=result, data=tile, op=nl.exp)

    # 4. Allocate and store to HBM
    output = nl.ndarray(input_hbm.shape, dtype=input_hbm.dtype, buffer=nl.shared_hbm)
    nisa.dma_copy(dst=output, src=result)

    return output

Read the full file on GitHub · 468 lines

Files

What ships with it

49 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. 5d ago First seen · 468 lines · 172 tokens per session scan A 5140d6d68fae

Subscribe to this mod's changes

neuron-nki-writing is a skill published in the GitHub repository aws-neuron/neuron-agentic-development (56 stars, last pushed 16d ago), licensed Apache-2.0. It adds 172 tokens to every session and 6,038 once invoked, about $0.0009 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

integrated-browser

Use this when working on the VS Code integrated browser ("browserView") to understand its architecture and mental model. Covers the embedded Chromium browser, its editor tab, navigation, overlay/layout, sessions, and agent browser tools under src/vs/platform/browserView and src/vs/workbench/contrib/browserView.

microsoft/vscode · 68 tokens

gke-compute-classes

Configures, optimizes, and troubleshoots GKE ComputeClasses. Use when configuring Spot VMs with on-demand fallback, targeting specific accelerators (GPUs/TPUs) or machine families, restricting ComputeClass access, or debugging pending pods related to node pool auto-creation. Do not use for cluster-level Node Auto…

google/skills · 83 tokens

jetson-diagnostic

Read-only Jetson health snapshot for identity, memory, GPU, thermal, power, storage, services, and top processes.

NVIDIA/skills · 30 tokens

doca-socket-relay

Use this skill when the operator is driving the DOCA Socket Relay to bridge a socket-oriented host application onto a BlueField DPU peer without rewriting it — picking the deployment shape (in-process, sidecar, or BlueField service container), configuring the host-side socket and the DPU-side forwarding endpoint…

NVIDIA/skills · 236 tokens

offensive-z-wave

Z-Wave attack methodology — sniffing with Z-Force / EZ-Wave / RTL-SDR + ZniffMobile, S0 (legacy) network-key derivation flaw and key reuse, S2 (modern) ECDH commissioning analysis, replay/injection on unauthenticated nodes, default-key brute-force on test deployments, and home-automation hub pivots. Use when targeting…

SnailSploit/Claude-Red · 113 tokens

hsb-flash

Flash the FPGA on an HSB board connected to an NVIDIA devkit. Supports HSB Lattice boards (FPGA versions 2407, 2412, 2507, 2510) and Leopard Imaging VB1940 "all-in-one" cameras (FPGA versions 2507, 2510). Uses release-specific YAML manifests and board-type-specific program commands. Lattice and VB1940 commands must…

NVIDIA/skills · 94 tokens