Agent skill

Extending Ocannl

by ahrefs in ahrefs/ocannl

Touch-lists for common OCANNL extension tasks: adding a primitive operation, adding or extending a backend, extending shape inference, and diagnosing output differences between backends.

BSD-2-ClauseAuto-check passedAI & LLM Engineering

Install Extending Ocannl

skills CLI
$ npx skills add ahrefs/ocannl --skill extending-ocannl -a claude-code

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

GitHub CLI
$ gh skill install ahrefs/ocannl extending-ocannl --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/ahrefs/ocannl.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/extending-ocannl .claude/skills/extending-ocannl && 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
extending-ocannl
GitHub stars
118
Token cost
~728 tokens
SKILL.md length
287 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
BSD-2-Clause

At a glance

Touch-lists for common OCANNL extension tasks: adding a primitive operation, adding or extending a backend, extending shape inference, and diagnosing output differences between backends.

  • Works in 5 steps: Add primitive operation to… → Implement interpretation in the same file → Add syntax support in tensor/ppx_*.ml if… → …
  • Adding an op to ops.ml
  • SKILL.md covers Adding New Primitive Operations, Debugging Backend Discrepancies, Backend Extensions and Shape Inference Extensions
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Extending Ocannl is an agent skill from ahrefs/ocannl. Touch-lists for common OCANNL extension tasks: adding a primitive operation, adding or extending a backend, extending shape inference, and diagnosing output differences between backends. Use when adding an op to ops.ml, implementing a new backend, changing projection/constraint logic, or when the same computation gives different results on cc vs cuda vs metal.

Its SKILL.md is about 730 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. It works with CUDA. The repository describes itself as: OCANNL: OCaml Compiles Algorithms for Neural Networks Learning. The licence is BSD-2-Clause.

When your agent uses it

  • Adding an op to ops.ml
  • Implementing a new backend
  • Changing projection/constraint logic
  • The same computation gives different results on cc vs cuda vs metal

Example prompts

  • “/extending-ocannl”

Workflow steps

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

  1. Add primitive operation to arrayjit/lib/ops.ml
  2. Implement interpretation in the same file
  3. Add syntax support in tensor/ppx_*.ml if needed
  4. Add high-level wrappers in tensor/operation.ml
  5. For neural network blocks, see lib/nn_blocks.ml for patterns

What it can do on your machine

Read from SKILL.md and the folder at commit 003e177. 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.

    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

Extending Ocannl loads about 728 tokens when it runs. Until then it costs about 95 tokens; SKILL.md has 287 words of instructions outside code blocks.

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

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 ahrefs/ocannl at commit 003e177, republished under its BSD-2-Clause licence (© ahrefs). 287 words, ~728 tokens.

Download SKILL.mdSave it as .claude/skills/extending-ocannl/SKILL.md (or your agent's skills folder).
name
extending-ocannl
description
Touch-lists for common OCANNL extension tasks: adding a primitive operation, adding or extending a backend, extending shape inference, and diagnosing output differences between backends. Use when adding an op to ops.ml, implementing a new backend, changing projection/constraint logic, or when the same computation gives different results on cc vs cuda vs metal.

Extending OCANNL

Adding New Primitive Operations

  1. Add primitive operation to arrayjit/lib/ops.ml
  2. Implement interpretation in the same file
  3. Add syntax support in tensor/ppx_*.ml if needed
  4. Add high-level wrappers in tensor/operation.ml
  5. For neural network blocks, see lib/nn_blocks.ml for patterns

Debugging Backend Discrepancies

When outputs differ between backends:

  1. Compare runtime logs in <backend>-<device>-<stream>.log files (might require minimizing test tensors)
  2. Check generated code in build_files/<exe-name>/*.c vs *.cu / *.metal for differences
  3. Common issues:
    • Incorrect type conversion in convert_precision overrides
    • Different numerical precision between CPU and GPU operations

Backend Extensions

  1. Implement device-specific module following Backend_impl signatures; backends implement stream-based execution with FIFO queuing, plus events and synchronization between streams/devices
  2. Add compilation logic in arrayjit/lib/backends.ml
  3. Handle memory management and synchronization
  4. Add configuration options in ocannl_config.reference
Code generation architecture
  • c_syntax.ml provides a functor with default C code generation patterns from Low_level.t
  • cc_backend.ml uses the defaults with minimal overrides; cuda_backend.ml overrides more functions for CUDA-specific syntax (e.g. __float2half); metal_backend.ml overrides using MSL-specific syntax; hip_backend.ml mirrors the CUDA backend
  • Backends must provide convert_precision for type conversions
  • Builtin functions (e.g. type conversions) must be implemented in the per-backend builtin modules prepended to generated code: builtins_cc.ml for the C backends, builtins_cuda.ml (CUDA), builtins_hip.ml (HIP), builtins_metal.ml (Metal). builtins.c provides the host-side FFI stubs compiled into the library
  • When adding new precision types, ensure conversion functions exist in all backend builtins
  • A change to a codegen default moves emitted text outside test/ too: dune build @test/operations/runtest-codegen_text_inventory lists every pinning file. A change to Register_tile.default, for one, re-promotes arrayjit/test/test_vectorized_codegen, which a test/operations-only batch never reaches

Shape Inference Extensions

  1. Modify projection logic in arrayjit/lib/indexing.ml
  2. Update shape constraint generation in tensor/shape.ml
  3. Test with various einsum patterns in e.g. test/einsum_trivia.ml

© ahrefs, BSD-2-Clause. 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 .claude/skills/extending-ocannl of ahrefs/ocannl.

Open the folder on GitHubat commit 003e177

Compare with similar skills

Extending Ocannl 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.

Extending Ocannl compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Extending Ocannl this skillahrefs/ocannl118—~728Automated safety check: PassBSD-2-Clause
GPU OptimizerMathews-Tom/armory328—~3.5kAutomated safety check: NotesMIT
The Art of Debuggingstas00/the-art-of-debugging1.7k—~6.1kAutomated safety check: NotesCC-BY-SA-4.0
Cuda Cpp Kernelvipshop/cache-dit1.3k—~2.3kAutomated safety check: PassApache-2.0
Debug Cuda Crashsgl-project/sglang37k2 repos~4.9kAutomated safety check: PassApache-2.0
ONNX Runtime CUDA Attention Patternsmicrosoft/onnxruntime22k—~6.5kAutomated safety check: PassMIT

Similar skills

  • GPU Optimizer

    Mathews-Tom/armory

    GPU optimization for consumer NVIDIA GPUs (8-24GB VRAM) covering mixed precision, gradient checkpointing, XGBoost GPU, CuPy/cuDF migration, and torch.compile.

    328 GitHub stars~3.5k tokensUpdated 3 days ago
    AI & LLM EngineeringAuto-check: notes
  • The Art of Debugging

    stas00/the-art-of-debugging

    Condensed debugging method and tool recipes for Unix, Python and PyTorch programs: crashes, hangs, segfaults, wrong output, CUDA OOM, NaN values and slowness.

    1.7k GitHub stars~6.1k tokensUpdated 3 days ago
    DevelopmentAuto-check: notes
  • Cuda Cpp Kernel

    vipshop/cache-dit

    A skill your agent uses when writing, debugging, porting, reviewing, or optimizing CUDA C++ or PTX kernels; investigating CUDA Runtime or Driver API behavior; profiling kernels with Nsight Systems…

    1.3k GitHub stars~2.3k tokensUpdated 10 days ago
    AI & LLM EngineeringAuto-check passed
  • Debug Cuda Crash

    sgl-project/sglang

    Call this skill when you need to debug CUDA crashes in SGLang using kernel API logging

    37k GitHub starsUsed in 2 repos~4.9k tokens
    AI & LLM EngineeringAuto-check passed
  • Official

    Patterns and pitfalls for the ONNX-domain Attention operator's CUDA implementation in ONNX Runtime: dispatch cascade, eligibility limits, mask and bias kernels, and test routing.

    22k GitHub stars~6.5k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Aoti Debug

    pytorch/pytorch

    Debug AOTInductor (AOTI) errors and crashes. An agent skill from pytorch/pytorch.

    104k GitHub starsUsed in 1 repo~1.7k tokens
    DevelopmentAuto-check passed

More from ahrefs/ocannl

  • Slipshow

    ahrefs/ocannl

    Writing Slipshow presentations, a text-based engine that compiles Markdown to interactive scrolling HTML presentations.

    118 GitHub stars~885 tokensUpdated 2 days ago
    Auto-check passed
  • How to get debug output out of OCANNL: kernel/routine runtime logs, generated code artifacts, and ppxminidebug tracing of library internals such as the shape/row solver.

    118 GitHub stars~637 tokensUpdated 2 days ago
    Auto-check passed

Works with

Questions about Extending Ocannl

What does Extending Ocannl do?

Touch-lists for common OCANNL extension tasks: adding a primitive operation, adding or extending a backend, extending shape inference, and diagnosing output differences between backends. Extending Ocannl is an agent skill from ahrefs/ocannl. Touch-lists for common OCANNL extension tasks: adding a primitive operation, adding or extending a backend, extending shape inference, and diagnosing output differences between backends.

When should I use Extending Ocannl?

Extending Ocannl fits situations like: adding an op to ops.ml; implementing a new backend; changing projection/constraint logic; the same computation gives different results on cc vs cuda vs metal.

How do I install Extending Ocannl in Claude Code?

Run `npx skills add ahrefs/ocannl --skill extending-ocannl -a claude-code`. Or copy the skill folder (.claude/skills/extending-ocannl in ahrefs/ocannl) into .claude/skills/extending-ocannl in your project. Claude Code loads it when a task matches its description.

How do I install Extending Ocannl in Codex?

Run `npx skills add ahrefs/ocannl --skill extending-ocannl -a codex`. Or copy the skill folder (.claude/skills/extending-ocannl in ahrefs/ocannl) into .agents/skills/extending-ocannl in your project. Codex loads it when a task matches its description.

Can I use Extending Ocannl 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 ahrefs/ocannl --skill extending-ocannl -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/extending-ocannl, .gemini/skills/extending-ocannl, .github/skills/extending-ocannl and .opencode/skills/extending-ocannl in your project.

What does Extending Ocannl need to run?

SKILL.md names no scripts, command-line tools or credentials: Extending Ocannl is instructions for the agent only.

Does Extending Ocannl 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 Extending Ocannl 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 Extending Ocannl use?

Extending Ocannl is published under the BSD-2-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Extending Ocannl use?

About 728 tokens (SKILL.md is roughly 2.9k 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 Extending Ocannl?

Skills that share tags, products or a category with Extending Ocannl: GPU Optimizer (Mathews-Tom/armory, 328 stars), The Art of Debugging (stas00/the-art-of-debugging, 1.7k stars), Cuda Cpp Kernel (vipshop/cache-dit, 1.3k stars) and Debug Cuda Crash (sgl-project/sglang, 37k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Extending Ocannl?

ahrefs (a GitHub organization) maintains it in ahrefs/ocannl, which has 118 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 7, 2026.

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