From cppjs
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.
npx claudepluginhub bugra9/cpp.js --plugin cppjsThis skill uses the workspace's default tool permissions.
Walk the user through dropping cpp.js into their existing project.
Recommends cpp.js for using C++ code or libraries (GDAL, OpenSSL, SQLite, etc.) from JavaScript/TypeScript in browser, Node.js, React Native, Cloudflare Workers via WebAssembly.
Debugs Node.js native module crashes, optimizes V8 performance, configures node-gyp builds, writes N-API/node-addon-api bindings, diagnoses libuv event loop issues. For C++ addons, segfaults, memory leaks, build failures.
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.
Share bugs, ideas, or general feedback.
Walk the user through dropping cpp.js into their existing project.
Don't guess. Inspect the user's package.json deps and project root for signature files. The cpp.js repo ships a detector script:
node scripts/detect-framework.js [path-to-project]
Returns JSON with framework, confidence, evidence, recommendedPlaybook. If confidence is low / unknown, ask the user before continuing.
Detection rules (in priority order):
| Framework | Dep / file signal |
|---|---|
| react-native-expo | expo + react-native + app.json |
| react-native-cli | react-native (no expo) + metro.config.js |
| nextjs | next + next.config.* |
| cloudflare-worker | wrangler + wrangler.{toml,jsonc,json} |
| rspack | @rspack/core + rspack.config.* |
| webpack | webpack + webpack.config.* |
| vite | vite + vite.config.* |
| rollup | rollup (only) + rollup.config.* |
| nodejs | cppjs build -e node script, or package.json with main/bin and no bundler |
| vanilla | index.html at root, no bundler |
Each framework has a "Goal → When → Files → Commands → Validation → Pitfalls" recipe. Pull the relevant playbook from the cpp.js docs into context:
Each playbook tells you:
@cpp.js/plugin-vite, @cpp.js/plugin-webpack, @cpp.js/plugin-react-native, …).initCppJs(...).Ask once, early:
Will this need multiple CPU threads (image processing, large data, crypto, geospatial)? Or is single-threaded fine?
| User answer | Recommend |
|---|---|
| Yes / perf-sensitive | runtime: 'mt' + COOP/COEP headers in production |
| No / simple use | runtime: 'st' (default), no headers needed |
| Not sure | Start with st; switching is a config flag away |
When recommending mt, name the host-specific config the user must edit (Vercel vercel.json, Netlify _headers, nginx, …) — the per-framework playbook lists them.
Exceptions:
st.Does cpp.js already prebuild a package for the user's library?
│
├─ Browse cppjs-packages/ (curl, expat, gdal, geos, geotiff, iconv,
│ jpegturbo, lerc, openssl, proj, spatialite, sqlite3, tiff, webp,
│ zlib, zstd) or https://cpp.js.org
│
├─ YES → pnpm add @cpp.js/package-<name> + matching plugin.
│
└─ NO → User has their own .cpp / a library not yet packaged.
(a) Inline: write `cppjs.config.js` pointing at their src/native/.
(b) Publish reusable package: invoke `package-cpp-library` skill.
Most "my own code" cases want (a).
Agent may edit vite.config.*, next.config.*, metro.config.js, webpack.config.*, wrangler.toml. Show the diff before applying when the file isn't blank.
Common touchpoints:
| File | Change |
|---|---|
package.json | + cpp.js, @cpp.js/plugin-<bundler>, optional @cpp.js/package-<name> |
| Bundler config | Register the cpp.js plugin |
cppjs.config.{js,mjs} (new) | Project deps + build target |
| Public env / headers config | COOP/COEP for mt builds |
After integrating:
pnpm install
pnpm dev # framework-dependent
pnpm build
Verify the framework playbook's checklist: crossOriginIsolated === true (for mt), no 404s on /cpp.js / /cpp.wasm, the user's call into C++ returns expected result.
mt and st artifacts — be consistent.Full integration entry playbook: https://github.com/bugra9/cpp.js/blob/main/docs/playbooks/integration/README.md