[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AD3EMPGZ8FRE4YDQKVA7HS":3,"skill-same:01M6AD3EMPGZ8FRE4YDQKVA7HS":58},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":30,"linkOnly":31,"markdownContent":32,"markdownBody":33,"frontMatter":34,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":40,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":6,"updatedAt":43,"install":44,"resources":57},"01M6AD3EMPGZ8FRE4YDQKVA7HS","compile",null,"Compile \u002F build \u002F type-check the skywalking-nodejs agent. Use when asked to \"compile\", \"build\", \"type-check\", \"run tsc\", \"make sure it compiles\", or to validate that changes under src\u002F build cleanly. Mirrors the CI pipeline in .github\u002Fworkflows\u002Fbuild.yaml (npm i -> npm run lint -> npm run build) and handles the two things that trip up a fresh\u002FApple-Silicon checkout: the protobuf submodule and the grpc-tools native-binary download.","apache\u002Fskywalking-nodejs","apache","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47359?v=4","01M6AC83E6K4FDKK7HZ8WNMQKE","The Apache Software Foundation","01M6AD3C9FDB044RXKPSV32QW1",180,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fapache\u002Fskywalking-nodejs\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fcompile\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29],"github","workflows","validate","protobuf","run","lint","nodejs","npm","skywalking","grpc","yaml","2026-11-10 10:12:30",false,"---\nname: compile\ndescription: >-\n  Compile \u002F build \u002F type-check the skywalking-nodejs agent. Use when asked to \"compile\", \"build\",\n  \"type-check\", \"run tsc\", \"make sure it compiles\", or to validate that changes under src\u002F build cleanly.\n  Mirrors the CI pipeline in .github\u002Fworkflows\u002Fbuild.yaml (npm i -> npm run lint -> npm run build) and\n  handles the two things that trip up a fresh\u002FApple-Silicon checkout: the protobuf submodule and the\n  grpc-tools native-binary download.\n---\n\n# Compile skywalking-nodejs\n\nThe source is TypeScript compiled by `tsc`, but it imports generated gRPC\u002Fprotobuf stubs. So a build is\nthree stages: **fetch the proto definitions -> generate the stubs -> compile**.\n\n## What the build does (source of truth: package.json + .github\u002Fworkflows\u002Fbuild.yaml)\n\n```\nnpm i            # install deps; the `prepare` hook runs scripts\u002Fprotoc.sh -> generates src\u002Fproto\u002F\nnpm run lint     # eslint src\u002F**\u002F*.ts  (eslint:recommended + prettier + Apache license-header check)\nnpm run build    # clean -> prepare (regen src\u002Fproto) -> tsc --build src -> regen proto into lib\u002F\n```\n\n`npm run build` expands to:\n`npm run clean && npm run prepare && tsc --build src && OUT_DIR=lib\u002Fproto\u002F scripts\u002Fprotoc.sh`\nOutput lands in `lib\u002F`. CI runs this on Node 12\u002F14\u002F16\u002F18 (Node 18 is the highest; Node 10 skips lint).\n\n`scripts\u002Fprotoc.sh` invokes `node_modules\u002F.bin\u002Fgrpc_tools_node_protoc` (from **grpc-tools**) and the\n`protoc-gen-ts` plugin (from **grpc_tools_node_protoc_ts**) over `protocol\u002F**\u002F*.proto`.\n\n## Prerequisite for every path: the protobuf submodule\n\n`protocol\u002F` is a git submodule (apache\u002Fskywalking-data-collect-protocol). A fresh clone leaves it empty,\nand then `tsc` fails with a cascade of `Cannot find module '..\u002Fproto\u002F...'`. Initialize it first:\n\n```bash\ngit submodule update --init --recursive\nfind protocol -name '*.proto' | head      # sanity check: should list files\n```\n\n## Path A — Linux \u002F Intel macOS (the simple case)\n\n```bash\ngit submodule update --init --recursive\nnpm i\nnpm run lint\nnpm run build\n```\n\n## Path B — Apple Silicon (arm64), old checkouts pinning grpc-tools 1.11.x\n\nCurrent `master` depends on `grpc-tools@^1.13.1`, which **does** ship a darwin-arm64 binary — so Path A\n(`npm i`) works natively on Apple Silicon, no workaround needed. Use the steps below only on an **older\ncheckout** whose lockfile still pins `grpc-tools@1.11.2` (no arm64 prebuilt → `npm i` dies with\n`404 ... grpc-tools\u002Fv1.11.2\u002Fdarwin-arm64.tar.gz`). It installs deps without the broken postinstall, then\nswaps in a 1.13.x binary that produces compatible stubs:\n\n```bash\ngit submodule update --init --recursive\n\n# 1. Install everything EXCEPT the failing grpc-tools postinstall:\nnpm i --ignore-scripts\n\n# 2. Get a grpc-tools build that has an arm64 binary (1.13.x), in a scratch dir:\n( cd \u002Ftmp && rm -rf gtt && mkdir gtt && cd gtt && npm i grpc-tools@latest )\n\n# 3. Replace the binary-less grpc-tools with the working one (bin links stay valid):\nrm -rf node_modules\u002Fgrpc-tools && cp -R \u002Ftmp\u002Fgtt\u002Fnode_modules\u002Fgrpc-tools node_modules\u002Fgrpc-tools\n\n# 4. Sanity-check the toolchain, then build:\nnode_modules\u002F.bin\u002Fgrpc_tools_node_protoc --version    # -> libprotoc 3.19.1\nnpm run lint\nnpm run build\n```\n\nThis was run end-to-end on darwin-arm64 (Node available locally, `tsc 3.9.10`): proto stubs generated,\n`tsc --build src` exit 0, `eslint` exit 0, `lib\u002F` populated.\n\nNote: `--ignore-scripts` also skips the `prepare`\u002F`husky` hooks, which is why step 4 runs the build\nexplicitly. The swapped `node_modules` is fine for building; it is not arch-portable to other machines.\n\n## Path C — Docker (mirrors CI exactly; needs Docker Hub access)\n\nBest for reproducibility when the host toolchain is uncooperative, but it requires pulling `node:18`\n(this environment could not reach Docker Hub — registry `EOF` — so Path B was used instead):\n\n```bash\ngit submodule update --init --recursive\ndocker run --rm --platform linux\u002Famd64 -v \"$PWD\":\u002Fapp -w \u002Fapp node:18 bash -lc '\n  npm i && npm run lint && npm run build\n'\n```\n\n`--platform linux\u002Famd64` is required on Apple Silicon so grpc-tools downloads its linux-x64 prebuilt; it\nruns under emulation, so the first `npm i` is slow — use a long timeout. Afterward `rm -rf node_modules`\nto drop the Linux binaries before any host use.\n\n## Verifying success\n\n- `tsc --build src` exits 0 (it is **silent** on success); `lib\u002F` is populated, e.g.\n  `lib\u002Fagent\u002Fprotocol\u002Fgrpc\u002Fclients\u002FTraceReportClient.js`.\n- A type error appears as a non-zero exit with a `src\u002F....ts(line,col): error TS....` message.\n- Lint failures are usually Prettier (`.prettierrc`: printWidth 120, singleQuote, trailingComma all) or a\n  missing Apache header (`.file-headerrc`). Auto-fix formatting with `npm run format`.\n- Type-check only (skip lint + lib emit), after deps + stubs exist: `node_modules\u002F.bin\u002Ftsc --build src`.\n\n## Gotchas\n\n- Empty `protocol\u002F` -> \"Cannot find module '..\u002Fproto\u002F...'\" everywhere -> you skipped the submodule.\n- Native arm64 `npm i` dies in `grpc-tools` postinstall (404) -> use Path B (swap to grpc-tools 1.13.x).\n- `npx tsc` with no `node_modules` silently installs an unrelated deprecated package literally named `tsc`\n  (`tsc@2.0.4`) — that is NOT the TypeScript compiler. Install deps first, then use `node_modules\u002F.bin\u002Ftsc`.\n","# Compile skywalking-nodejs\n\nThe source is TypeScript compiled by `tsc`, but it imports generated gRPC\u002Fprotobuf stubs. So a build is\nthree stages: **fetch the proto definitions -> generate the stubs -> compile**.\n\n## What the build does (source of truth: package.json + .github\u002Fworkflows\u002Fbuild.yaml)\n\n```\nnpm i            # install deps; the `prepare` hook runs scripts\u002Fprotoc.sh -> generates src\u002Fproto\u002F\nnpm run lint     # eslint src\u002F**\u002F*.ts  (eslint:recommended + prettier + Apache license-header check)\nnpm run build    # clean -> prepare (regen src\u002Fproto) -> tsc --build src -> regen proto into lib\u002F\n```\n\n`npm run build` expands to:\n`npm run clean && npm run prepare && tsc --build src && OUT_DIR=lib\u002Fproto\u002F scripts\u002Fprotoc.sh`\nOutput lands in `lib\u002F`. CI runs this on Node 12\u002F14\u002F16\u002F18 (Node 18 is the highest; Node 10 skips lint).\n\n`scripts\u002Fprotoc.sh` invokes `node_modules\u002F.bin\u002Fgrpc_tools_node_protoc` (from **grpc-tools**) and the\n`protoc-gen-ts` plugin (from **grpc_tools_node_protoc_ts**) over `protocol\u002F**\u002F*.proto`.\n\n## Prerequisite for every path: the protobuf submodule\n\n`protocol\u002F` is a git submodule (apache\u002Fskywalking-data-collect-protocol). A fresh clone leaves it empty,\nand then `tsc` fails with a cascade of `Cannot find module '..\u002Fproto\u002F...'`. Initialize it first:\n\n```bash\ngit submodule update --init --recursive\nfind protocol -name '*.proto' | head      # sanity check: should list files\n```\n\n## Path A — Linux \u002F Intel macOS (the simple case)\n\n```bash\ngit submodule update --init --recursive\nnpm i\nnpm run lint\nnpm run build\n```\n\n## Path B — Apple Silicon (arm64), old checkouts pinning grpc-tools 1.11.x\n\nCurrent `master` depends on `grpc-tools@^1.13.1`, which **does** ship a darwin-arm64 binary — so Path A\n(`npm i`) works natively on Apple Silicon, no workaround needed. Use the steps below only on an **older\ncheckout** whose lockfile still pins `grpc-tools@1.11.2` (no arm64 prebuilt → `npm i` dies with\n`404 ... grpc-tools\u002Fv1.11.2\u002Fdarwin-arm64.tar.gz`). It installs deps without the broken postinstall, then\nswaps in a 1.13.x binary that produces compatible stubs:\n\n```bash\ngit submodule update --init --recursive\n\n# 1. Install everything EXCEPT the failing grpc-tools postinstall:\nnpm i --ignore-scripts\n\n# 2. Get a grpc-tools build that has an arm64 binary (1.13.x), in a scratch dir:\n( cd \u002Ftmp && rm -rf gtt && mkdir gtt && cd gtt && npm i grpc-tools@latest )\n\n# 3. Replace the binary-less grpc-tools with the working one (bin links stay valid):\nrm -rf node_modules\u002Fgrpc-tools && cp -R \u002Ftmp\u002Fgtt\u002Fnode_modules\u002Fgrpc-tools node_modules\u002Fgrpc-tools\n\n# 4. Sanity-check the toolchain, then build:\nnode_modules\u002F.bin\u002Fgrpc_tools_node_protoc --version    # -> libprotoc 3.19.1\nnpm run lint\nnpm run build\n```\n\nThis was run end-to-end on darwin-arm64 (Node available locally, `tsc 3.9.10`): proto stubs generated,\n`tsc --build src` exit 0, `eslint` exit 0, `lib\u002F` populated.\n\nNote: `--ignore-scripts` also skips the `prepare`\u002F`husky` hooks, which is why step 4 runs the build\nexplicitly. The swapped `node_modules` is fine for building; it is not arch-portable to other machines.\n\n## Path C — Docker (mirrors CI exactly; needs Docker Hub access)\n\nBest for reproducibility when the host toolchain is uncooperative, but it requires pulling `node:18`\n(this environment could not reach Docker Hub — registry `EOF` — so Path B was used instead):\n\n```bash\ngit submodule update --init --recursive\ndocker run --rm --platform linux\u002Famd64 -v \"$PWD\":\u002Fapp -w \u002Fapp node:18 bash -lc '\n  npm i && npm run lint && npm run build\n'\n```\n\n`--platform linux\u002Famd64` is required on Apple Silicon so grpc-tools downloads its linux-x64 prebuilt; it\nruns under emulation, so the first `npm i` is slow — use a long timeout. Afterward `rm -rf node_modules`\nto drop the Linux binaries before any host use.\n\n## Verifying success\n\n- `tsc --build src` exits 0 (it is **silent** on success); `lib\u002F` is populated, e.g.\n  `lib\u002Fagent\u002Fprotocol\u002Fgrpc\u002Fclients\u002FTraceReportClient.js`.\n- A type error appears as a non-zero exit with a `src\u002F....ts(line,col): error TS....` message.\n- Lint failures are usually Prettier (`.prettierrc`: printWidth 120, singleQuote, trailingComma all) or a\n  missing Apache header (`.file-headerrc`). Auto-fix formatting with `npm run format`.\n- Type-check only (skip lint + lib emit), after deps + stubs exist: `node_modules\u002F.bin\u002Ftsc --build src`.\n\n## Gotchas\n\n- Empty `protocol\u002F` -> \"Cannot find module '..\u002Fproto\u002F...'\" everywhere -> you skipped the submodule.\n- Native arm64 `npm i` dies in `grpc-tools` postinstall (404) -> use Path B (swap to grpc-tools 1.13.x).\n- `npx tsc` with no `node_modules` silently installs an unrelated deprecated package literally named `tsc`\n  (`tsc@2.0.4`) — that is NOT the TypeScript compiler. Install deps first, then use `node_modules\u002F.bin\u002Ftsc`.\n",{"name":5,"description":7},"master","d7f266f9bad4f55a5d260377abe7a4a26ce7eaaf",".claude\u002Fskills\u002Fcompile",70,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fskywalking-nodejs","https:\u002F\u002Fskywalking.apache.org\u002F","https:\u002F\u002Fgithub.com\u002Fapache","https:\u002F\u002Fwww.apache.org\u002F","2026-11-02 21:53:42",{"source":8,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add apache\u002Fskywalking-nodejs --skill compile",{"tool":50,"command":51},"bunx","bunx skills add apache\u002Fskywalking-nodejs --skill compile",{"tool":53,"command":54},"pnpm","pnpm dlx skills add apache\u002Fskywalking-nodejs --skill compile","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fapache\u002Fskywalking-nodejs\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fcompile\u002FSKILL.md",true,[],[]]