cpp-on-the-web

cpp-on-the-web is a skill for Claude Code, Codex from GoogleChrome/modern-web-guidance-src. It costs 53 tokens per session (1,058 once invoked), scanned A, original, Apache-2.0.

A guide for compiling C and C++ code into WebAssembly, a format that lets it run in web browsers. It uses Emscripten, a toolchain for building C and C++ for the web.

In plain words
What is it for?
Use it to port C++ libraries, build browser-ready WebAssembly modules, configure ES6 JavaScript output, and reduce release file size.
Why use it?
It explains the setup and build choices needed to move native C++ code into a browser. It also points out common issues with JavaScript and C++ communication.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/googlechrome/modern-web-guidance-src/cpp-on-the-web
Any agent
npx skills add GoogleChrome/modern-web-guidance-src --skill cpp-on-the-web
Clone the repo
git clone --depth 1 https://github.com/GoogleChrome/modern-web-guidance-src

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 cpp-on-the-web

README.md
[![agentmods](https://agentmods.dev/badge/skills/googlechrome/modern-web-guidance-src/cpp-on-the-web.svg)](https://agentmods.dev/skills/googlechrome/modern-web-guidance-src/cpp-on-the-web)
Your own site
<a href="https://agentmods.dev/skills/googlechrome/modern-web-guidance-src/cpp-on-the-web"><img src="https://agentmods.dev/badge/skills/googlechrome/modern-web-guidance-src/cpp-on-the-web.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,058 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00053 $0.01058
Opus 5 $0.00026 $0.00529
Sonnet 5 $0.00011 $0.00212
Haiku 4.5 $0.00005 $0.00106

Measured 4d ago against content hash ca9dee250e1c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cpp-on-the-web 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 4d 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-src/cpp-on-the-web/SKILL.md · 86 lines

How it starts

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

Compiling C++ to the Web using WebAssembly

This skill provides guidance for using Emscripten to target the modern web with C and C++. It focuses on ES6 module output, clean JS/C++ interop, and common pitfalls.

Quick Start

  1. Installation: Use the Emscripten SDK (emsdk) as the quickest way to install.
    ./emsdk install latest
    ./emsdk activate latest
    source ./emsdk_env.sh
    
  2. Environment: Ensure emcc is in your PATH.
  3. Boilerplate: Use the hello-world template in assets/hello-world.
    • main.cpp: Basic Embind example.
    • index.html: Modern ES6 module loading.
    • Makefile: Recommended flags for modern web.
  • -sSTRICT: Opt into modern Emscripten behavior.
  • -sEXPORT_ES6: Output a modern ES6 module (this implies -sMODULARIZE).
  • -sENVIRONMENT=web: For optimal codesize limit the output only run on the web.
  • -Werror -Wall: Treat warnings as errors for safer C++ code.
  • -Oz/-Os: To minimal the payload size use -Oz/-Os for release builds rather then -O2/O3.
  • -flto: Use this flag when both compiling and linking in release mode to enable LTO for optimal performance.
  • -sALLOW_MEMORY_GROWTH: Allow the WASM heap to grow (required for many real-world apps).
  • --bind: Enable Embind for clean, class-based interop.

Best Practices

  • Prefer standard flags: Use standard compiler flags (e.g., -pthread, -g, -O3) over Emscripten-specific -s flags where possible.
  • Boolean flags: For boolean Emscripten flags (like -sSTRICT), omit the =1 suffix. Emscripten treats the presence of the flag as enabled.
  • List-based flags: For flags that take lists (e.g., -sEXPORTED_FUNCTIONS), use the simple comma-separated form (e.g., main,malloc) rather than the more verbose JSON form.

Separate Compilation

For larger projects, always use separate compilation (compiling .cpp to .o files before linking). This allows for incremental builds and is the standard practice for C/C++ development.

Read the full file on GitHub · 86 lines

Files

What ships with it

4 files 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. 4d ago First seen · 86 lines · 53 tokens per session scan A ca9dee250e1c

Subscribe to this mod's changes

cpp-on-the-web is a skill published in the GitHub repository GoogleChrome/modern-web-guidance-src (1,010 stars, last pushed today), licensed Apache-2.0. It adds 53 tokens to every session and 1,058 once invoked, about $0.0003 per session on Opus 5. 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

use-agent-browser-for-airi

Test AIRI display-model imports with agent-browser across stage-tamagotchi Electron, stage-web, and stage-pocket mobile web layouts. Use when uploading and verifying contributor-supplied Live2D ZIP, VRM, or MMD ZIP/PMX/PMD files through AIRI's model selector, including onboarding bypass, format-specific import…

moeru-ai/airi · 87 tokens

opencli-sitemap-author

Use when creating or maintaining OpenCLI site sitemaps: agent-facing navigation, page-state, action, workflow, API-reference, pitfall, and fallback knowledge for a website. Use after browser exploration discovers durable site context, when a sitemap is stale, or when promoting local site knowledge into the repo.

jackwener/OpenCLI · 67 tokens

interactive-login

How to complete browser/interactive logins (aws / gh / glab / gcloud). The platform backgrounds the login poller so it survives the human's browser round-trip — and when that does NOT work.

yc-software/qm · 46 tokens

pinchtab-mcp

Use this skill when a task requires browser automation through PinchTab's MCP server connected to a remote browser instance. Covers navigation, element interaction, data extraction, form filling, multi-step flows, and session management via MCP tools.

pinchtab/pinchtab · 52 tokens

web-browser

Automate and interact with web pages through Chrome or Chromium using the Chrome DevTools Protocol (CDP): navigate, click, fill forms, inspect content, take screenshots, and debug console or network activity. Use when an agent needs a real browser. Prefer headless Chrome unless visible browser interaction is required.

mitsuhiko/agent-stuff · 64 tokens

traceway-setup

Analyze and instrument repositories for Traceway observability. Use when the user wants to plan, add, migrate, or verify Traceway or OpenTelemetry monitoring for backend, browser, full-stack, mobile or iOS, or AI-agent software, including project topology and user-approved setup-plan creation. Backends use OTLP/HTTP…

tracewayapp/traceway · 134 tokens