ir-inspect

Inspect Mooncake.jl IR transformations at each stage of the AD pipeline. Use when the user wants to view, debug, or understand IR at any compilation stage.

388 stars

Best use case

ir-inspect is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Inspect Mooncake.jl IR transformations at each stage of the AD pipeline. Use when the user wants to view, debug, or understand IR at any compilation stage.

Teams using ir-inspect should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ir-inspect/SKILL.md --create-dirs "https://raw.githubusercontent.com/chalk-lab/Mooncake.jl/main/.claude/skills/ir-inspect/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ir-inspect/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How ir-inspect Compares

Feature / Agentir-inspectStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Inspect Mooncake.jl IR transformations at each stage of the AD pipeline. Use when the user wants to view, debug, or understand IR at any compilation stage.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Mooncake IR Inspection

You are helping the user inspect IR (Intermediate Representation) transformations in Mooncake.jl's automatic differentiation pipeline.

## Setup

The IR inspection functions are part of Mooncake.jl. Start a Julia session and load the package:

```julia
using Mooncake
using Mooncake.SkillUtils
```

All functions below are defined in the `Mooncake.SkillUtils` module.

## Gathering user intent

Ask the user what they want to inspect. Offer these choices:

1. **Function to inspect** — ask which function and arguments (e.g. `sin, 1.0` or a custom function)
2. **Mode** — reverse mode (default) or forward mode
3. **What to view**:
   - All stages at once
   - A specific stage
   - A diff between two stages
   - World age info

Do not assume — ask the user to pick.

## Pipeline stages

### Reverse mode stages (default)
| Stage | Symbol | Description |
|-------|--------|-------------|
| Raw IR | `:raw` | optimised, type-infered SSAIR from Julia's compiler |
| Normalized | `:normalized` | After Mooncake's normalization passes |
| BBCode | `:bbcode` | BBCode representation with stable IDs |
| Forward IR | `:fwd_ir` | Generated forward-pass IR |
| Reverse IR | `:rvs_ir` | Generated pullback (reverse-pass) IR |
| Optimized Forward | `:optimized_fwd` | Forward pass after optimization |
| Optimized Reverse | `:optimized_rvs` | Pullback after optimization |

### Forward mode stages
| Stage | Symbol | Description |
|-------|--------|-------------|
| Raw IR | `:raw` | optimised, type-infered SSAIR from Julia's compiler |
| Normalized | `:normalized` | After Mooncake's normalization passes |
| BBCode | `:bbcode` | Inspection-only — forward mode does not use BBCode internally |
| Dual IR | `:dual_ir` | Generated dual-number IR |
| Optimized | `:optimized` | After optimization passes |

## Commands reference

```julia
using Mooncake
using Mooncake.SkillUtils

# Full inspection
ins = inspect_ir(f, args...; mode=:reverse)  # or mode=:forward

# View stages
show_ir(ins)                          # all stages
show_stage(ins, :raw)                 # one stage

# Diffs between stages
show_diff(ins; from=:raw, to=:normalized)
show_all_diffs(ins)

# World age debugging
show_world_info(ins)

# Write everything to files
write_ir(ins, "/tmp/ir_output")

# Shorthand helpers
ins = inspect_fwd(f, args...)         # forward mode
ins = inspect_rvs(f, args...)         # reverse mode
ins = quick_inspect(f, args...)       # inspect + display immediately

# Options
inspect_ir(f, args...;
    mode       = :reverse,
    optimize   = true,
    do_inline  = true,
    debug_mode = false,
)
```

## How to present results

- Run the Julia commands via Bash and capture output.
- Present the IR text in fenced code blocks with context about what each stage represents.
- When showing diffs, highlight what changed and explain why the transformation matters.
- If errors occur, check that Mooncake is loaded and the function signature is valid.

## Limitations

This skill inspects Mooncake's **internal AD pipeline** — the IR it generates for forward/reverse passes. For debugging beyond IR (allocations, world age, compiler boundary), see `docs/src/developer_documentation/advanced_debugging.md`.

Related Skills

Home Inspection Business Operations

3891
from openclaw/skills

Run a profitable home inspection business with real numbers, compliance checklists, and growth playbooks.

redis-inspect

7060
from civitai/civitai

Inspect Redis cache keys, values, and TTLs for debugging. Supports both main cache and system cache. Use for debugging cache issues, checking cached values, and monitoring cache state. Read-only by default.

performing-ssl-tls-inspection-configuration

4032
from mukul975/Anthropic-Cybersecurity-Skills

Configure SSL/TLS inspection on network security devices to decrypt, inspect, and re-encrypt HTTPS traffic for threat detection while managing certificates, exemptions, and privacy compliance.

construction-safety-inspector

3891
from openclaw/skills

施工作业安全督察专家技能。当用户上传施工作业现场图片,要求分析安全隐患、提出整改建议时激活。触发词:安全检查、安全隐患分析、施工现场、特殊作业(动火/高处/受限空间/临时用电/吊装/盲板抽堵/动土/断路)、gb30871、施工作业安全、安全督察、安全隐患。 Also activates when user mentions uploading safety management documents for learning.

prompt-inspector

3891
from openclaw/skills

Detect prompt injection attacks and adversarial inputs in user text before passing it to your LLM. Use when you need to validate or screen user-provided text for jailbreak attempts, instruction overrides, role-play escapes, or other prompt manipulation techniques. Returns a safety verdict, risk score (0–1), and threat categories. Ideal for guarding AI pipelines, chatbots, and any application that feeds user input into a language model.

tls-inspect

3891
from openclaw/skills

Inspect TLS certificate (expiry, SANs, chain, cipher)

macpilot-ui-inspector

3891
from openclaw/skills

Inspect and interact with macOS UI elements using MacPilot accessibility APIs. Find buttons, text fields, labels, and other elements by role, label, or position, then click, read, or modify them.

vertex-engine-inspector

1868
from jeremylongshore/claude-code-plugins-plus-skills

Inspect and validate Vertex AI Agent Engine deployments including Code Execution Sandbox, Memory Bank, A2A protocol compliance, and security posture. Generates production readiness scores. Use when asked to inspect, validate, or audit an Agent Engine deployment. Trigger with "inspect agent engine", "validate agent engine deployment", "check agent engine config", "audit agent engine security", "agent engine readiness check", "vertex engine health", or "reasoning engine status".

inspect-agent-package

1592
from openakita/openakita

Preview the contents of a .akita-agent package file without installing it. Shows manifest, profile, bundled skills, and validation status.

desktop-inspect

1592
from openakita/openakita

Inspect window UI element tree structure for debugging and understanding interface layout. When you need to debug UI automation issues, understand application structure, or find correct element identifiers.

files-inspect

533
from kurtosis-tech/kurtosis

Inspect, download, upload, and debug Kurtosis file artifacts. View artifacts in an enclave, download them locally for inspection, upload local files, and troubleshoot file mounting issues. Use when services can't find expected files or configs are wrong.

enclave-inspect

533
from kurtosis-tech/kurtosis

Inspect and manage Kurtosis enclaves. List enclaves, view services and ports, examine file artifacts, dump enclave state for debugging, and clean up. Use when you need to understand what's running inside an enclave or export its state.