From cppjs
Answers cpp.js runtime configuration, build hooks, C++ binding rules, filesystem, threading, and troubleshooting questions by loading matching reference docs.
npx claudepluginhub bugra9/cpp.js --plugin cppjsThis skill uses the workspace's default tool permissions.
Answer cpp.js runtime / config questions from the canonical reference docs, never from training-data guesses. The reference covers four surfaces; pick the one matching the question.
Integrates cpp.js into existing JavaScript/TypeScript/React Native projects by detecting framework/bundler (Next.js, Vite, Webpack, etc.) and applying matching playbook for plugins, config, and init.
Fetches C/C++ examples from cppcheatsheet.com to write functional code, answer questions on modern features, system programming, CUDA GPU computing, debugging, and interview prep.
Writes idiomatic modern C++ code with RAII, smart pointers, STL algorithms, templates, move semantics, and performance optimization. For refactoring, memory safety, complex patterns.
Share bugs, ideas, or general feedback.
Answer cpp.js runtime / config questions from the canonical reference docs, never from training-data guesses. The reference covers four surfaces; pick the one matching the question.
| User asks about | Load this doc | MCP topic |
|---|---|---|
initCppJs(opts) parameters, return shape, Module helpers | docs/api/init.md | init |
cppjs.config.js fields (consumer, build-time) | docs/api/cppjs-config.md | config |
cppjs.build.js hooks (package author, build-time) | docs/api/cppjs-build.md | build |
OPFS, memfs, persistence, file mounting, m.FS | docs/api/filesystem.md | filesystem |
runtime: 'st' | 'mt', useWorker, COOP/COEP, edge limits | docs/api/threading.md | threading |
| C++ binding rules (no pointers, C++11+, wrapper pattern) | docs/api/cpp-binding-rules.md | binding-rules |
Manual SWIG .i escape hatch | docs/api/swig-escape.md | swig |
state / target shapes for build hooks; 20 built-in target inventory | docs/api/build-state.md | state |
| Catalog of override mechanisms (filter → targetSpecs → build hooks → extensions) | docs/api/overrides.md | overrides |
| Common errors mapped to fixes; tribal-knowledge gotchas | docs/api/troubleshooting.md | troubleshooting |
| Default Emscripten / CMake flags + safe-override guide | docs/api/performance.md | performance |
| Memory / object lifecycle in JS (none needed) + TypeScript notes | docs/api/lifecycle-and-types.md | lifecycle |
| Where to start | docs/api/README.md (decision tree) | index |
GitHub mirrors of all docs:
https://github.com/bugra9/cpp.js/blob/main/docs/api/<file>.mdcppjs_get_api_reference({ topic: 'init' }) (or any topic from the table above).useWorker: trueruntime: 'mt' in production → requires COOP/COEP headersuseWorker, no mt, no OPFSpaths.native is an array, not a string-O3, -msimd128, -sALLOW_MEMORY_GROWTH=1, etc. — don't override speculativelycppjs.config.js is build-time only. Putting useWorker: true in it does nothing — that's a runtime option for initCppJs(opts). Catch this confusion early.targetSpecs[].specs.* → cppjs.config.js env / functions → cppjs.build.js hooks → extensions[] → ~/.cppjs.json. See overrides.md.Use these to short-circuit obvious cases. Always offer to load the full doc for nuance.
"How do I get persistent storage in browser?"
→ useWorker: true, then write to /opfs/<appName>/. See filesystem.md.
"How do I make cpp.js multithreaded?"
→ target.runtime: 'mt' in cppjs.config.js + COOP/COEP headers in production. See threading.md.
"What does useWorker actually do?"
→ Spawns the Wasm module in a Web Worker; everything becomes async via Comlink. Required for OPFS, optional for parallelism (separate from runtime: 'mt'). See init.md + threading.md.
"Can I use cpp.js on Cloudflare Workers?"
→ Yes, but only runtime: 'st' + memory fs. No useWorker, no OPFS, no mt — edge runtimes don't expose the Worker API. See threading.md "Edge runtime limits".
"What fields go in cppjs.config.js?"
→ general.name, dependencies[], paths.{config, project, native[], output, …}, target.runtime, export.{type, libName[]}. See cppjs-config.md for the full shape with defaults.
cppjs.config.js (build-time) with initCppJs(opts) (runtime). Different surfaces, different fields.useWorker: true with runtime: 'mt'. They're orthogonal axes (see the matrix in threading.md).cppjs.build.js to a consumer — that file is package-author-only.mt build to production. It's the #1 reason mt "works in dev, fails in prod".Full index: https://github.com/bugra9/cpp.js/blob/main/docs/api/README.md