handle-boundary-conditions

handle-boundary-conditions is a skill for Claude Code, Codex from tensormux/kernel-skills. It costs 0 tokens per session (2,927 once invoked), scanned A, original, MIT.

A guide for making tiled GPU kernels handle leftover elements when an input size is not an exact multiple of the tile size. It focuses on preventing invalid memory access and wrong results.

In plain words
What is it for?
Use it when writing or reviewing CUDA or Triton kernels for matrix multiplication, reductions, softmax, attention, elementwise operations, batches with different sizes, or variable-length sequences.
Why use it?
Fixed-size tiles often extend past the real end of an array, which can cause crashes, corrupted data, or silently incorrect output.

Skill for Claude CodeCodex

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

Good fit Use it when writing or reviewing CUDA or Triton kernels for matrix multiplication, reductions, softmax, attention, elementwise operations, batches with different sizes, or variable-length sequences.

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

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 handle-boundary-conditions

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/tensormux/kernel-skills/handle-boundary-conditions"><img src="https://agentmods.dev/badge/skills/tensormux/kernel-skills/handle-boundary-conditions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,927 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.
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.00000 $0.02927
Opus 5 $0.00000 $0.01463
Sonnet 5 $0.00000 $0.00585
Haiku 4.5 $0.00000 $0.00293

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

Security

Grade A, and why

handle-boundary-conditions 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 11d 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.

skills/patterns/handle-boundary-conditions/SKILL.md · 134 lines

How it starts

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

Skill: Handle Boundary Conditions in Tiled Kernels

Purpose

Guide the agent through correctly handling partial tiles — cases where a problem dimension does not evenly divide the tile size — in CUDA and Triton kernels, without introducing out-of-bounds accesses, incorrect output values, or silent data corruption.

Use this when

  • Writing any tiled kernel (GEMM, reduction, softmax, elementwise, attention) where the tile size may not divide the problem dimension evenly.
  • The problem shape is determined at runtime and cannot be guaranteed to be a multiple of the tile size.
  • A kernel processes batched inputs where batch elements may have different sizes.
  • Writing an attention kernel with variable-length sequences.
  • Reviewing a kernel for correctness and needing to audit boundary handling explicitly.

Do not use this when

  • The kernel is exclusively called with shapes that are statically known and guaranteed to be multiples of the tile size (e.g., a highly constrained production kernel with a fixed shape contract). Even then, document this invariant explicitly and add an assertion.
  • The problem dimension is padded externally to a tile multiple before the kernel is called. In this case, verify the padding strategy is correct and document that boundary handling is delegated to the caller.

Inputs the agent should gather first

  • The tile size (or candidate tile sizes) in each dimension.
  • The problem dimensions (M, N, K, or sequence length, batch size, etc.) and whether they are known statically or determined at runtime.
  • The memory layout of the input and output tensors: row-major, column-major, strided.
  • Whether the input is padded externally, and if so, what value the padding contains (zero, -inf, arbitrary).
  • For batched ops: whether all batch elements have the same size or variable sizes.
  • For attention with variable sequence length: whether the sequence lengths are stored in a separate tensor and how they are passed to the kernel.
  • Whether the kernel reads, writes, or both for each tensor involved in the boundary tile.

Read the full file on GitHub · 134 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. 11d ago First seen · 134 lines · 0 tokens per session scan A c615be6b27d2

Subscribe to this mod's changes

handle-boundary-conditions is a skill published in the GitHub repository tensormux/kernel-skills (75 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,927 tokens. 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

diagnose

Disciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. Use when user says "diagnose this" / "debug this", reports a bug, says something is broken/throwing/failing, or describes a performance regression.

MagicKidd/Rokid-agentic-workflow · 66 tokens

agenttrace-session-audit

Audit local AI coding-agent sessions with agenttrace for cost, tool failures, latency, anomalies, health, diffs, and CI gates.

sickn33/agentic-awesome-skills · 34 tokens

sglang-diffusion-benchmark-profile

Use when benchmarking denoise latency or profiling a diffusion bottleneck in SGLang.

sgl-project/sglang · 26 tokens

systematic-debugging

A step-by-step method for finding the underlying cause of technical problems before changing code. It covers reading errors, reproducing failures, checking recent changes, and tracing data across system components.

jnMetaCode/superpowers-zh · 24 tokens

investigate

Systematic debugging with root cause investigation. Four phases: investigate, analyze, hypothesize, implement. Iron Law: no fixes without root cause. Use when asked to "debug this", "fix this bug", "why is this broken", "investigate this error", or "root cause analysis". Proactively invoke this skill (do NOT debug…

GCWing/BitFun · 112 tokens

anti-entropy-governance

Use when touching retiring old logic, collapsing duplicate owners, removing fallbacks, or schema/persistence/source-of-truth boundaries; identify opportunities automatically; destructive execution requires explicit confirmation.

GanyuanRan/Aegis · 42 tokens