# Bridge js

> Bridge js is an open-source agent skill for developer tools. Lets an agent write Swift–JavaScript interop code with BridgeJS bindings and exports. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/swiftwasm/Swift-Wasm-Agent-Skill/tree/main/bridge-js
- **Repository:** https://github.com/swiftwasm/swift-wasm-agent-skill
- **GitHub stars:** 49
- **License:** MIT
- **Skill name:** bridge-js
- **Collection:** https://github.com/swiftwasm/Swift-Wasm-Agent-Skill
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

BridgeJS is a code generation layer in JavaScriptKit for passing values and calls between Swift and JavaScript. Instead of hand-writing raw JSObject and JSValue handling, the developer declares the API shape in Swift using @JS-style macros or in a bridge-js.d.ts file, and the generated glue code handles the boundary. The skill points the agent to the DocC documentation in the JavaScriptKit checkout for details rather than relying on memory.

The skill covers both directions: exporting Swift types and functions so JavaScript can call them, and importing JavaScript or TypeScript APIs into Swift through declared bindings, globals such as document or console, and injected imports. It explains how types map across the boundary, which values are passed by reference and which by copy, how errors must be typed as throws(JSException), and how async functions turn into Promises.

Work with this skill assumes a Swift project that depends on JavaScriptKit. The skill also references a local ts2swift script for previewing how a d.ts file converts to Swift, and it includes reference files on project setup, testing and known limitations.

## When your agent uses it

> Export Swift to JavaScript and import JavaScript/TypeScript into Swift using BridgeJS; type-safe bindings via @JS and related macros or bridge-js.d.ts; setup, config, AOT. Use when using or setting up BridgeJS, exporting Swift APIs to JS, importing JS/TS APIs into Swift, writing bridge-js.d.ts, configuring BridgeJS, or debugging BridgeJS boundaries.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/swiftwasm/Swift-Wasm-Agent-Skill/tree/HEAD/bridge-js)
- [License: MIT](https://github.com/swiftwasm/Swift-Wasm-Agent-Skill/tree/HEAD/bridge-js)

## Features

- **Swift to JavaScript export:** Shows how to expose Swift functions, classes, enums and closures to JavaScript using @JS annotations.
- **JavaScript import bindings:** Covers declaring JavaScript functions, classes, getters and setters in Swift with import macros.
- **TypeScript declaration generation:** Explains generating Swift bindings from a bridge-js.d.ts file and previewing the output with ts2swift.
- **Type mapping rules:** Summarizes how optionals, undefined, arrays, records and typed arrays cross the Swift and JS boundary.
- **Closure and async handling:** Describes passing closures in both directions, releasing typed closures, and Promise-returning async exports.
- **Boundary debugging guidance:** Points to setup, configuration, testing and limitations references for troubleshooting interop issues.

## Good for

- Export a Swift struct and its methods so a JavaScript frontend can call them
- Import a browser API such as document or console into a Swift WebAssembly app
- Generate Swift bindings from a TypeScript d.ts file for an existing JS library
- Convert a Swift closure into a JavaScript callback and release it correctly
- Configure BridgeJS in a JavaScriptKit project and debug a failing boundary call

## Install

### Claude Code

This skill ships in the `bridge-js` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add swiftwasm/Swift-Wasm-Agent-Skill
/plugin install bridge-js@swiftwasm-skills
```

Or copy only this skill to `~/.claude/skills/bridge-js`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/swiftwasm/Swift-Wasm-Agent-Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/bridge-js &&
cp -R "$tmp/bridge-js" ~/.claude/skills/bridge-js &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/bridge-js` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/bridge-js` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/swiftwasm/Swift-Wasm-Agent-Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/bridge-js &&
cp -R "$tmp/bridge-js" ~/.agents/skills/bridge-js &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/bridge-js` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/bridge-js` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/swiftwasm/Swift-Wasm-Agent-Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/bridge-js &&
cp -R "$tmp/bridge-js" ~/.cursor/skills/bridge-js &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/bridge-js` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/swiftwasm/Swift-Wasm-Agent-Skill.git --path bridge-js
```

Or copy the folder to `~/.gemini/skills/bridge-js` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/bridge-js`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/swiftwasm/Swift-Wasm-Agent-Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/bridge-js &&
cp -R "$tmp/bridge-js" ~/.copilot/skills/bridge-js &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/bridge-js` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/swiftwasm/Swift-Wasm-Agent-Skill.git
```

Then copy `Swift-Wasm-Agent-Skill/bridge-js` into your agent's skills folder as `bridge-js`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need to be used?

It assumes a project that depends on JavaScriptKit, and it refers to the checked-out JavaScriptKit repository for the DocC documentation and the ts2swift script.

### Does Bridge js run scripts or change my code?

The skill itself has no scripts. It gives the agent instructions and references for writing BridgeJS exports, imports and bindings.

### Which errors are supported across the bridge?

Only throws(JSException) is supported at the bridge; plain throws is not.

### How are async Swift functions exposed to JavaScript?

Exported async functions, methods and closures become Promise-returning JavaScript functions and require JavaScriptEventLoop.installGlobalExecutor().

### How do I install Bridge js in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/bridge-js to use it in all your projects, or to .claude/skills/bridge-js in one project. Or install the bridge-js plugin, which includes it: /plugin marketplace add swiftwasm/Swift-Wasm-Agent-Skill, then /plugin install bridge-js@swiftwasm-skills.

### Does Bridge js run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Bridge js?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Bridge js?

The closest alternatives to Bridge js are Javascriptkit, TypeScript best practices, TypeScript, Axiom swift and JavaScript TypeScript jest.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Javascriptkit](https://ai-powered.com/skills/javascriptkit): Javascriptkit is an open-source agent skill for developer tools.
- [TypeScript best practices](https://ai-powered.com/skills/typescript-best-practices): TypeScript best practices is an open-source agent skill for developer tools.
- [TypeScript](https://ai-powered.com/skills/typescript): TypeScript is an open-source agent skill for developer tools.
- [Axiom swift](https://ai-powered.com/skills/axiom-swift-charleswiltgen-2): Axiom swift is an open-source agent skill for developer tools.
- [JavaScript TypeScript jest](https://ai-powered.com/skills/javascript-typescript-jest): JavaScript TypeScript jest is an open-source agent skill for developer tools.
- [Developing genkit js](https://ai-powered.com/skills/developing-genkit-js): Developing genkit js is an open-source agent skill for developer tools.
- [Coding standards](https://ai-powered.com/skills/coding-standards-fmarzochi): Coding standards is an open-source agent skill for developer tools.
- [Base44 SDK](https://ai-powered.com/skills/base44-sdk): Base44 SDK is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/bridge-js
