Blazor JavaScript interop
Adds and fixes JavaScript calls in Blazor components with safe timing and disposal, so interop stops leaking.
Claude's review
8/10 Specific Blazor JS interop rules with typed wrapper, batching and disposal patterns.
We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.
In detail
Add, review, or fix JavaScript interop in Blazor components. USE FOR: calling JavaScript from Blazor, calling .NET from JavaScript, collocated .razor.js modules, IJSRuntime, IJSObjectReference lifecycle, DotNetObjectReference, ElementReference, timing rules for when JS is available, IAsyncDisposable disposal of JS references, server-side JS interop safety. DO NOT USE FOR: general Blazor component authoring without JS interop needs (use author-component), forms (use collect-user-input).
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
license: MIT
name: use-js-interop
description: >
Add, review, or fix JavaScript interop in Blazor components.
USE FOR: calling JavaScript from Blazor, calling .NET from JavaScript,
collocated .razor.js modules, IJSRuntime, IJSObjectReference lifecycle,
DotNetObjectReference, ElementReference, timing rules for when JS is available,
IAsyncDisposable disposal of JS references, server-side JS interop safety.
DO NOT USE FOR: general Blazor component authoring without JS interop needs
(use author-component), forms (use collect-user-input).
---
# JS Interop in Blazor
## 1. Collocated JS Modules
Always use collocated `.razor.js` files with `export` — never global `window.*` functions or `<script>` tags.
```javascript
// ChartPanel.razor.js — placed next to ChartPanel.razor
export function initialize(canvas, dotNetRef) { /* ... */ }
export function updateData(points) { /* ... */ }
export function dispose() { /* ... */ }
```
Import paths: same project = `"./Components/ChartPanel.razor.js"`, RCL = `"./_content/{AssemblyName}/..."`.
## 2. Lifecycle Timing
**All JS interop must happen in `OnAfterRenderAsync` or event handlers** — never in `OnInitialized`, `OnParametersSet`, or constructors. JS is not available during server prerendering.
Use a typed interop wrapper (see Section 4) — never call `InvokeAsync`/`InvokeVoidAsync` with raw string literals:
```csharp
private ChartInterop? _chart;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
...From dotnet's repository, MIT licence.
Related skills
-
Checked
TinyBase app builder
Scaffolds and extends local first JavaScript apps with TinyBase, including schemas, persistence and sync.
7/101 credit -
Checked
ComfyUI custom node UI
Adds widgets, sidebar tabs, commands and dialogs to ComfyUI custom nodes, so your node feels built in.
8/101 credit -
Checked
Scrolling menu upgrade
Finds outdated react-horizontal-scrolling-menu code and rewrites it for version 8 so the menu works again.
7/101 credit -
Checked
Screenshot to React code
Rebuilds a screenshot or mockup as React, TypeScript and Tailwind code that closely matches the design.
7/101 credit -
Checked
Map location picker
Adds a map pin picker to a web form, so users can choose and submit one exact spot like a delivery address.
7/101 credit -
Checked
Port code to Rust
Ports C, C++, Python, Go or JavaScript code into idiomatic Rust, with tests that prove it behaves the same.
9/101 credit