{"data":{"slug":"discovered-8bdb52766dce3bc503ba40315ad4ddcc42d3b465bb9b9f27","title":"Build with Node.js and .NET","summary":"Configure and execute build scripts for Node.js and .NET projects, including GitHub Actions workflows, environment setup, and CI\/CD automation.","url":"https:\/\/skillshunter.net\/skills\/discovered-8bdb52766dce3bc503ba40315ad4ddcc42d3b465bb9b9f27","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-8bdb52766dce3bc503ba40315ad4ddcc42d3b465bb9b9f27","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-8bdb52766dce3bc503ba40315ad4ddcc42d3b465bb9b9f27.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-8bdb52766dce3bc503ba40315ad4ddcc42d3b465bb9b9f27\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the global `.gitignore` file includes `scripts\/build.sh` to exclude the wrapper script from version control. If using Tauri, set up a matrix build with `windows-latest` and `macos-latest` runners, and include the `Swatinem\/rust-cache@v2` action with the specified workspace path.","instructions":"---\nname: build\ndescription: Configure build script and run it\nallowed-tools: Bash(bash ~\/.claude\/skills\/build\/scripts\/build.sh), Bash(build), Bash(echo *), Bash(test *), Bash(ls *), Bash(mkdir *), Bash(find *), Bash(grep *), AskUserQuestion, Write(scripts\/build.sh), Write(.github\/workflows\/build.yml), Edit(.gitignore), Read(.gitignore), Edit(~\/.bashrc), Read(~\/.bashrc), Edit(~\/.zshrc), Read(~\/.zshrc), Read(package.json), Read(.nvmrc), Read(global.json)\n---\n\nSee `~\/.claude\/learnings\/shell-environment.md` for the expected bash functions and verification checklist.\n\n## Context\n- Shell rc target: !`case \"$(uname -s)\" in Darwin) echo \"~\/.zshrc\" ;; MINGW*|MSYS*|CYGWIN*) echo \"~\/.bashrc\" ;; *) [ -n \"$ZSH_VERSION\" ] || [ \"${SHELL##*\/}\" = \"zsh\" ] && echo \"~\/.zshrc\" || echo \"~\/.bashrc\" ;; esac`\n- Build function in shell rc: !`cat ~\/.bashrc ~\/.zshrc ~\/.bash_profile ~\/.zprofile 2>\/dev\/null | grep -c \"build()\" || echo 0`\n- run_repo_script helper in shell rc: !`cat ~\/.bashrc ~\/.zshrc ~\/.bash_profile ~\/.zprofile 2>\/dev\/null | grep -c \"run_repo_script()\" || echo 0`\n- Wrapper script exists: !`test -f scripts\/build.sh && echo yes || echo no`\n- GitHub workflow: !`F=$(find .github\/workflows -maxdepth 1 -name '*.yml' 2>\/dev\/null | sort); [ -n \"$F\" ] && echo \"$F\" || echo none`\n\n## 1. Check prerequisites\n\n1. If **Build function in shell rc** is 0, append the `build` wrapper to the file in **Shell rc target** (i.e. `~\/.zshrc` on macOS, `~\/.bashrc` on Windows Git Bash \/ Linux-bash). It delegates to the shared `run_repo_script` helper, which walks up from the current directory to the repo's `scripts\/build.sh` and runs it from the directory that holds it \u2014 so `build` works from any subdirectory. If **run_repo_script helper in shell rc** is 0, append the helper too (the `publish` skill installs the same one \u2014 add it only when missing, so it isn't duplicated):\n   ```bash\n   run_repo_script() { local rel=\"$1\"; shift; local d=\"$PWD\"; while [ \"$d\" != \"\/\" ] && [ ! -f \"$d\/$rel\" ]; do d=\"$(dirname \"$d\")\"; done; if [ -f \"$d\/$rel\" ]; then ( cd \"$d\" && bash \"$rel\" \"$@\" ); else echo \"No $rel in this directory or any parent\"; fi; }\n   build() { run_repo_script scripts\/build.sh \"$@\"; }\n   ```\n\n## 2. Set up quick build shortcut\n\n1. If **Wrapper script exists** is no, create `scripts\/build.sh`:\n   ```bash\n   #!\/bin\/bash\n   bash ~\/.claude\/skills\/build\/scripts\/build.sh \"$@\"\n   ```\n2. Keep the wrapper out of git via the **global** excludes file \u2014 never the project's `.gitignore` (it's a per-machine artifact only this skill generates). Ensure the global excludes file contains the line `scripts\/build.sh`:\n   ```bash\n   gi=\"$(git config --global core.excludesfile)\"; gi=\"${gi\/#\\~\/$HOME}\"; gi=\"${gi:-$HOME\/.gitignore}\"\n   grep -qxF 'scripts\/build.sh' \"$gi\" 2>\/dev\/null || {\n     grep -qF 'per-machine wrappers written by Claude Code' \"$gi\" 2>\/dev\/null \\\n       || printf '\\n# per-machine wrappers written by Claude Code deploy\/build skills \u2014 never committed\\n' >> \"$gi\"\n     printf 'scripts\/build.sh\\n' >> \"$gi\"\n   }\n   ```\n\n## 3. Configure GitHub Actions CI (optional)\n\nIf **GitHub workflow** is `none`:\n\n1. Ask the user: \"No GitHub Actions workflow found. Set up CI for push\/PR builds?\"\n2. If declined, skip to step 4.\n3. Detect project type and parameters (see **Project type detection** and **Parameter detection**).\n4. Generate the workflow, show it to the user for approval.\n5. On approval: `mkdir -p .github\/workflows`, then write `.github\/workflows\/build.yml`.\n\n### Project type detection\n\n| Check | How | Type |\n|---|---|---|\n| `test -d src-tauri` | directory exists | **Tauri** |\n| `test -f package.json` | file exists (and not Tauri) | **npm** |\n| `find . -maxdepth 2 -name '*.csproj'` | csproj found | **dotnet** |\n\n### Parameter detection\n\n**npm:**\n- **Node version**: if `.nvmrc` exists \u2192 use `node-version-file: .nvmrc` (stays in sync). Else read `engines.node` from `package.json` \u2192 use minimum major. Else default `24` (current active LTS).\n- **Lint**: include `npm run lint` step only if `package.json` has a `scripts.lint` entry.\n- **Test**: include `npm test` step only if `package.json` has a `scripts.test` that is not the default `echo \"Error: no test specified\" && exit 1`.\n\n**dotnet:**\n- **.NET version**: `global.json` `sdk.version` \u2192 `{major}.x`. Else parse `TargetFramework` from csproj (`net9.0` \u2192 `9.x`). Default `9.x`.\n- **Runner**: if csproj contains `<RuntimeIdentifier>win-` or `<UseWPF>` or `<UseWindowsForms>` \u2192 `windows-latest`. Else `ubuntu-latest`.\n- **Test**: include test step only if `tests\/` directory exists.\n\n**Tauri:**\n- **Node version**: same logic as npm.\n- **Runner**: matrix build \u2014 `windows-latest` and `macos-latest`. Each runner uses its native Rust target (x86_64 on Windows, aarch64 on macOS ARM runners).\n- **Rust cache**: always include `Swatinem\/rust-cache@v2` with `workspaces: src-tauri -> target`.\n\n### Reference workflows\n\nGenerate `.github\/workflows\/build.yml` following these patterns. Omit commented lines that don't apply; do not leave comments in the output.\n\n**Read each action's current major before emitting it \u2014 the pins in these templates are a sample, not a currency claim.** They were correct on 2026-10-08 and each action versions independently, so a copied set goes stale a major at a time with nothing reporting it: this skill shipped `checkout@v5`\/`setup-node@v5`\/`setup-dotnet@v4` for long enough that a generated workflow's first run was its own staleness check. `github-action-version-bumps.md` carries the one-command query and the inputs to re-confirm at the new ref; `ci-workflow-local-rehearsal.md` carries how to run the result before pushing it.\n\n**npm** (reference: bga-assistant):\n```yaml\nname: Build\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\/checkout@v7\n\n      - uses: actions\/setup-node@v7\n        with:\n          node-version-file: .nvmrc  # or node-version: '24' if no .nvmrc\n          cache: npm\n\n      # `corepack enable` alone leaves npm at the image's bundled version \u2014 measured 2026-10-08 in a\n      # node:24.19.0 container, 11.17.0 against a pin of 11.18.0. npm is the exception among the three\n      # managers and needs naming; without this the run ignores the `packageManager` pin v5 requires.\n      - run: corepack enable npm\n\n      - run: npm ci\n\n      - run: npm run lint    # omit if no lint script\n\n      - run: npm run build\n\n      - run: npm test        # omit if no real test script\n```\n\n**dotnet** (reference: crop-stage):\n```yaml\nname: Build\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  build:\n    runs-on: ubuntu-latest  # or windows-latest for Windows-only targets\n    steps:\n      - uses: actions\/checkout@v7\n\n      - uses: actions\/setup-dotnet@v6\n        with:\n          dotnet-version: '9.x'\n\n      - run: dotnet restore\n\n      - run: dotnet build -c Release --no-restore\n\n      - run: dotnet test tests\/ -c Release --no-restore  # omit if no tests\/ dir\n```\n\n**Tauri** (reference: tauri-dashboard):\n```yaml\nname: Build\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  build:\n    strategy:\n      matrix:\n        os: [windows-latest, macos-latest]\n    runs-on: ${{ matrix.os }}\n    steps:\n      - uses: actions\/checkout@v7\n\n      - uses: actions\/setup-node@v7\n        with:\n          node-version: '24'  # or node-version-file: .nvmrc\n          cache: npm\n\n      - uses: dtolnay\/rust-toolchain@stable\n\n      - uses: Swatinem\/rust-cache@v2\n        with:\n          workspaces: src-tauri -> target\n\n      - run: corepack enable npm   # see the **npm** template for why npm needs naming\n\n      - run: npm ci\n\n      - run: cargo test --manifest-path src-tauri\/Cargo.toml --lib\n\n      - run: npm run build\n```\n\n## 4. Build\n\nIf step 1 or 2 made changes, tell the user:\n> The `build` shortcut has been configured. **Restart Claude Code** for `! build` to work \u2014 the shell reads its rc file only at startup, so new functions aren't available until the next session.\n>\n> For now, running the build directly:\n\nRun the build script directly (bypassing the shell function):\n```\nbash ~\/.claude\/skills\/build\/scripts\/build.sh\n```\n\nReport the output to the user. If it fails, analyze the error and suggest a fix. On success, remind the user to restart Claude Code if they haven't already, then `! build` will work.\n","use_cases":["Automate build and test workflows for Node.js projects using npm scripts","Set up CI\/CD pipelines for .NET applications with GitHub Actions","Generate and configure `.github\/workflows\/build.yml` for continuous integration","Ensure build scripts are excluded from version control using global `.gitignore`","Integrate Tauri projects with cross-platform build configurations"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/AnotherSava\/claude-code-common\/blob\/1a7f9f9cce53f6946ae1e3a9cc0733f2524a4b93\/claude\/skills\/build\/SKILL.md","source_commit":"1a7f9f9cce53f6946ae1e3a9cc0733f2524a4b93","license":null,"version":null,"listing_approved_at":"2026-12-01","created_at":"2026-11-30T08:07:46.000000Z","updated_at":"2026-12-01T12:48:20.000000Z","seo_title":"Build Automation for Node.js and .NET Projects","seo_description":"Automate build processes for Node.js and .NET applications with GitHub Actions, including environment setup, linting, testing, and workflow configuration.","seo_keywords":["Node.js build automation","GitHub Actions workflow",".NET CI\/CD setup","npm script execution","Tauri cross-platform build"]}}