Build with Node.js and .NET
Configure and execute build scripts for Node.js and .NET projects, including GitHub Actions workflows, environment setup, and CI/CD automation.
Editor's 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.
When to Use It
- 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
SKILL.md
SkillsHunter provides this listing for informational purposes only. Review the skill’s source, license, and required permissions before use. You are responsible for deciding whether to install or run it. Terms of Use
See ~/.claude/learnings/shell-environment.md for the expected bash functions and verification checklist.
Context
- 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 - Build function in shell rc: !
cat ~/.bashrc ~/.zshrc ~/.bash_profile ~/.zprofile 2>/dev/null | grep -c "build()" || echo 0 - run_repo_script helper in shell rc: !
cat ~/.bashrc ~/.zshrc ~/.bash_profile ~/.zprofile 2>/dev/null | grep -c "run_repo_script()" || echo 0 - Wrapper script exists: !
test -f scripts/build.sh && echo yes || echo no - GitHub workflow: !
F=$(find .github/workflows -maxdepth 1 -name '*.yml' 2>/dev/null | sort); [ -n "$F" ] && echo "$F" || echo none
1. Check prerequisites
- If Build function in shell rc is 0, append the
buildwrapper to the file in Shell rc target (i.e.~/.zshrcon macOS,~/.bashrcon Windows Git Bash / Linux-bash). It delegates to the sharedrun_repo_scripthelper, which walks up from the current directory to the repo'sscripts/build.shand runs it from the directory that holds it — sobuildworks from any subdirectory. If run_repo_script helper in shell rc is 0, append the helper too (thepublishskill installs the same one — add it only when missing, so it isn't duplicated):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; } build() { run_repo_script scripts/build.sh "$@"; }
2. Set up quick build shortcut
- If Wrapper script exists is no, create
scripts/build.sh:#!/bin/bash bash ~/.claude/skills/build/scripts/build.sh "$@" - Keep the wrapper out of git via the global excludes file — never the project's
.gitignore(it's a per-machine artifact only this skill generates). Ensure the global excludes file contains the linescripts/build.sh:gi="$(git config --global core.excludesfile)"; gi="${gi/#\~/$HOME}"; gi="${gi:-$HOME/.gitignore}" grep -qxF 'scripts/build.sh' "$gi" 2>/dev/null || { grep -qF 'per-machine wrappers written by Claude Code' "$gi" 2>/dev/null \ || printf '\n# per-machine wrappers written by Claude Code deploy/build skills — never committed\n' >> "$gi" printf 'scripts/build.sh\n' >> "$gi" }
3. Configure GitHub Actions CI (optional)
If GitHub workflow is none:
- Ask the user: "No GitHub Actions workflow found. Set up CI for push/PR builds?"
- If declined, skip to step 4.
- Detect project type and parameters (see Project type detection and Parameter detection).
- Generate the workflow, show it to the user for approval.
- On approval:
mkdir -p .github/workflows, then write.github/workflows/build.yml.
Project type detection
| Check | How | Type |
|---|---|---|
test -d src-tauri |
directory exists | Tauri |
test -f package.json |
file exists (and not Tauri) | npm |
find . -maxdepth 2 -name '*.csproj' |
csproj found | dotnet |
Parameter detection
npm:
- Node version: if
.nvmrcexists → usenode-version-file: .nvmrc(stays in sync). Else readengines.nodefrompackage.json→ use minimum major. Else default24(current active LTS). - Lint: include
npm run lintstep only ifpackage.jsonhas ascripts.lintentry. - Test: include
npm teststep only ifpackage.jsonhas ascripts.testthat is not the defaultecho "Error: no test specified" && exit 1.
dotnet:
- .NET version:
global.jsonsdk.version→{major}.x. Else parseTargetFrameworkfrom csproj (net9.0→9.x). Default9.x. - Runner: if csproj contains
<RuntimeIdentifier>win-or<UseWPF>or<UseWindowsForms>→windows-latest. Elseubuntu-latest. - Test: include test step only if
tests/directory exists.
Tauri:
- Node version: same logic as npm.
- Runner: matrix build —
windows-latestandmacos-latest. Each runner uses its native Rust target (x86_64 on Windows, aarch64 on macOS ARM runners). - Rust cache: always include
Swatinem/rust-cache@v2withworkspaces: src-tauri -> target.
Reference workflows
Generate .github/workflows/build.yml following these patterns. Omit commented lines that don't apply; do not leave comments in the output.
Read each action's current major before emitting it — 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.
npm (reference: bga-assistant):
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc # or node-version: '24' if no .nvmrc
cache: npm
# `corepack enable` alone leaves npm at the image's bundled version — measured 2026-10-08 in a
# node:24.19.0 container, 11.17.0 against a pin of 11.18.0. npm is the exception among the three
# managers and needs naming; without this the run ignores the `packageManager` pin v5 requires.
- run: corepack enable npm
- run: npm ci
- run: npm run lint # omit if no lint script
- run: npm run build
- run: npm test # omit if no real test script
dotnet (reference: crop-stage):
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest # or windows-latest for Windows-only targets
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: '9.x'
- run: dotnet restore
- run: dotnet build -c Release --no-restore
- run: dotnet test tests/ -c Release --no-restore # omit if no tests/ dir
Tauri (reference: tauri-dashboard):
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24' # or node-version-file: .nvmrc
cache: npm
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri -> target
- run: corepack enable npm # see the **npm** template for why npm needs naming
- run: npm ci
- run: cargo test --manifest-path src-tauri/Cargo.toml --lib
- run: npm run build
4. Build
If step 1 or 2 made changes, tell the user:
The
buildshortcut has been configured. Restart Claude Code for! buildto work — the shell reads its rc file only at startup, so new functions aren't available until the next session.For now, running the build directly:
Run the build script directly (bypassing the shell function):
bash ~/.claude/skills/build/scripts/build.sh
Report 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.
View original Markdown
---
name: build
description: Configure build script and run it
allowed-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)
---
See `~/.claude/learnings/shell-environment.md` for the expected bash functions and verification checklist.
## Context
- 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`
- Build function in shell rc: !`cat ~/.bashrc ~/.zshrc ~/.bash_profile ~/.zprofile 2>/dev/null | grep -c "build()" || echo 0`
- run_repo_script helper in shell rc: !`cat ~/.bashrc ~/.zshrc ~/.bash_profile ~/.zprofile 2>/dev/null | grep -c "run_repo_script()" || echo 0`
- Wrapper script exists: !`test -f scripts/build.sh && echo yes || echo no`
- GitHub workflow: !`F=$(find .github/workflows -maxdepth 1 -name '*.yml' 2>/dev/null | sort); [ -n "$F" ] && echo "$F" || echo none`
## 1. Check prerequisites
1. 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 — 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 — add it only when missing, so it isn't duplicated):
```bash
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; }
build() { run_repo_script scripts/build.sh "$@"; }
```
## 2. Set up quick build shortcut
1. If **Wrapper script exists** is no, create `scripts/build.sh`:
```bash
#!/bin/bash
bash ~/.claude/skills/build/scripts/build.sh "$@"
```
2. Keep the wrapper out of git via the **global** excludes file — 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`:
```bash
gi="$(git config --global core.excludesfile)"; gi="${gi/#\~/$HOME}"; gi="${gi:-$HOME/.gitignore}"
grep -qxF 'scripts/build.sh' "$gi" 2>/dev/null || {
grep -qF 'per-machine wrappers written by Claude Code' "$gi" 2>/dev/null \
|| printf '\n# per-machine wrappers written by Claude Code deploy/build skills — never committed\n' >> "$gi"
printf 'scripts/build.sh\n' >> "$gi"
}
```
## 3. Configure GitHub Actions CI (optional)
If **GitHub workflow** is `none`:
1. Ask the user: "No GitHub Actions workflow found. Set up CI for push/PR builds?"
2. If declined, skip to step 4.
3. Detect project type and parameters (see **Project type detection** and **Parameter detection**).
4. Generate the workflow, show it to the user for approval.
5. On approval: `mkdir -p .github/workflows`, then write `.github/workflows/build.yml`.
### Project type detection
| Check | How | Type |
|---|---|---|
| `test -d src-tauri` | directory exists | **Tauri** |
| `test -f package.json` | file exists (and not Tauri) | **npm** |
| `find . -maxdepth 2 -name '*.csproj'` | csproj found | **dotnet** |
### Parameter detection
**npm:**
- **Node version**: if `.nvmrc` exists → use `node-version-file: .nvmrc` (stays in sync). Else read `engines.node` from `package.json` → use minimum major. Else default `24` (current active LTS).
- **Lint**: include `npm run lint` step only if `package.json` has a `scripts.lint` entry.
- **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`.
**dotnet:**
- **.NET version**: `global.json` `sdk.version` → `{major}.x`. Else parse `TargetFramework` from csproj (`net9.0` → `9.x`). Default `9.x`.
- **Runner**: if csproj contains `<RuntimeIdentifier>win-` or `<UseWPF>` or `<UseWindowsForms>` → `windows-latest`. Else `ubuntu-latest`.
- **Test**: include test step only if `tests/` directory exists.
**Tauri:**
- **Node version**: same logic as npm.
- **Runner**: matrix build — `windows-latest` and `macos-latest`. Each runner uses its native Rust target (x86_64 on Windows, aarch64 on macOS ARM runners).
- **Rust cache**: always include `Swatinem/rust-cache@v2` with `workspaces: src-tauri -> target`.
### Reference workflows
Generate `.github/workflows/build.yml` following these patterns. Omit commented lines that don't apply; do not leave comments in the output.
**Read each action's current major before emitting it — 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.
**npm** (reference: bga-assistant):
```yaml
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc # or node-version: '24' if no .nvmrc
cache: npm
# `corepack enable` alone leaves npm at the image's bundled version — measured 2026-10-08 in a
# node:24.19.0 container, 11.17.0 against a pin of 11.18.0. npm is the exception among the three
# managers and needs naming; without this the run ignores the `packageManager` pin v5 requires.
- run: corepack enable npm
- run: npm ci
- run: npm run lint # omit if no lint script
- run: npm run build
- run: npm test # omit if no real test script
```
**dotnet** (reference: crop-stage):
```yaml
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest # or windows-latest for Windows-only targets
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: '9.x'
- run: dotnet restore
- run: dotnet build -c Release --no-restore
- run: dotnet test tests/ -c Release --no-restore # omit if no tests/ dir
```
**Tauri** (reference: tauri-dashboard):
```yaml
name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24' # or node-version-file: .nvmrc
cache: npm
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri -> target
- run: corepack enable npm # see the **npm** template for why npm needs naming
- run: npm ci
- run: cargo test --manifest-path src-tauri/Cargo.toml --lib
- run: npm run build
```
## 4. Build
If step 1 or 2 made changes, tell the user:
> The `build` shortcut has been configured. **Restart Claude Code** for `! build` to work — the shell reads its rc file only at startup, so new functions aren't available until the next session.
>
> For now, running the build directly:
Run the build script directly (bypassing the shell function):
```
bash ~/.claude/skills/build/scripts/build.sh
```
Report 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.
Community Reviews & Field Notes
Tried this skill on your own project? Share the model you used and the results you got.