From rn-lib-claude
Use when setting up CI/CD for a React Native library — GitHub Actions workflows for PR checks, automated publish on changeset merge, NPM_TOKEN setup, and caching strategies.
How this skill is triggered — by the user, by Claude, or both
Slash command
/rn-lib-claude:ciThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Two workflows cover the full lifecycle: one for PR quality gates, one for automated publish.
Two workflows cover the full lifecycle: one for PR quality gates, one for automated publish.
.github/workflows/ci.yml)Runs on every pull request and push to main. Blocks merge if checks fail.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
check:
name: Typecheck, Lint, Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: bun run typecheck
- name: Lint
run: bun run lint
- name: Format check
run: bun run format:check
- name: Test
run: bun run test
- name: Build
run: bun run build
Add this step before bun install to cache the package store:
- uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
.github/workflows/publish.yml)Runs when a PR is merged to main. If a changeset is present, it opens a "Version Packages" PR automatically. When that PR is merged, it publishes to npm.
This uses the official Changesets GitHub Action.
name: Publish
on:
push:
branches: [main]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Create release PR or publish
uses: changesets/action@v1
with:
publish: npm publish --access public
version: bunx changeset version
commit: "chore: version packages"
title: "chore: version packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
How it works:
.changeset/*.md filenpm publishNPM_TOKEN, Value: the tokenThe GITHUB_TOKEN is provided automatically by GitHub Actions — no setup needed.
For TurboModule or Fabric view libraries, the CI workflow above is sufficient for JS checks. Native compilation (iOS/Android) requires macOS runners and is slow/expensive. Recommended approach:
ubuntu-latest — fast and freemacos-latestIf you want to validate native builds on CI:
build-ios:
name: iOS Build Check
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: cd example && bun install
- name: Install CocoaPods
run: cd example/ios && pod install
- name: Build iOS
run: cd example && bun run ios --configuration Debug
CocoaPods cache (saves ~3min per run):
- uses: actions/cache@v4
with:
path: example/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
After adding CI, enable branch protection on main:
maincheck job from the CI workflow.github/ Files to Create.github/
├── workflows/
│ ├── ci.yml ← PR quality gate
│ └── publish.yml ← automated publish via Changesets
Add to .gitignore:
# already ignored by scaffold
No changes needed — .github/ is never in the scaffold's files field so it won't be published to npm.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub shankulkarni/claude-plugin-marketplace --plugin rn-lib-claude