$npx -y skills add rstackjs/agent-skills --skill rstack-repo-maintainAudit and modernize RstackJS/Rspack ecosystem repositories to the current shared infrastructure baseline: Rslib ESM or dual builds, Rslint recommended rules, Rstest test tooling, Node 20+ support where appropriate, TypeScript 6 and tsgo where compatible, concise README/AGENTS doc
| 1 | # Rstack Repo Maintain |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Modernize RstackJS repositories without blindly copying config. Use current repository state and recently maintained exemplar repos to make small, verifiable infrastructure upgrades. |
| 6 | |
| 7 | ## Baseline Evidence |
| 8 | |
| 9 | Read `references/repo-baselines.md` when choosing a template repo, explaining where the baseline came from, or deciding whether a migration should be pure ESM, dual package, Node 20+, TypeScript 6, Rslint, Rstest, or tsgo. |
| 10 | |
| 11 | Default starting points: |
| 12 | |
| 13 | - Primary small-package baseline: `rstackjs/rslog`. |
| 14 | - Pure ESM and Node 20 plugin package baseline: `rstackjs/rsbuild-plugin-publint`. |
| 15 | - Concise AGENTS.md and tsgo/publint reference: `rstackjs/rslog`. |
| 16 | - Additional package validation reference: `rstackjs/rsbuild-plugin-arethetypeswrong`. |
| 17 | - Additional Rslib `dts.tsgo` implementation reference: `rstackjs/rsbuild-plugin-virtual-module`. |
| 18 | |
| 19 | Always re-check the target repo and exemplar repo before editing. The reference file is a dated snapshot, not a permanent source of truth. |
| 20 | |
| 21 | ## Workflow |
| 22 | |
| 23 | 1. **Inventory the target repo** |
| 24 | - Read `package.json`, lockfile, `rslib.config.*`, `rslint.config.*`, `rstest.config.*`, `vitest.config.*`, `jest.config.*`, `playwright.config.*`, `tsconfig*.json`, `.github/workflows/*`, `README.md`, `AGENTS.md`, release config, and source entry points. |
| 25 | - Identify package kind: library, Rsbuild/Rspack plugin, CLI, app template, test fixture, or docs package. |
| 26 | - List current build, lint, typecheck, test, release, and package manager commands before changing them. |
| 27 | |
| 28 | 2. **Choose the migration target** |
| 29 | - Prefer pure ESM for modern libraries and plugins when consumers can support it. |
| 30 | - Use dual package output only as a deliberate transition when existing CommonJS consumers or public exports require it. |
| 31 | - Treat runtime support, package exports, CLI bins, side effects, and documented deep imports as compatibility constraints. |
| 32 | |
| 33 | 3. **Update the infrastructure in small layers** |
| 34 | - **Rslib**: use `rslib` for builds, keep config minimal, set appropriate `lib.syntax`, emit declarations, and align `package.json#exports` with real output. Add `rsbuild-plugin-publint` when the package should validate publish metadata during build. |
| 35 | - **Rslint**: use `@rslint/core`; use `ts.configs.recommended` for TypeScript packages. Add `js.configs.recommended` only when JavaScript source or config files are intentionally linted. |
| 36 | - **Prettier**: if the repo already carries Prettier or should check formatting, wire it into lint scripts with the repo's established style (`prettier --check .` / `prettier --write .` or `-c` / `-w`) and keep generated artifacts ignored by `.prettierignore`. |
| 37 | - **Test tooling**: prefer Rstest for JavaScript/TypeScript unit tests in Rstack repositories. When a repo still uses Vitest or Jest, use the `migrate-to-rstest` skill, map scripts and configs to `@rstest/core`, keep Playwright or other browser E2E tooling separate, and remove legacy runner deps/configs only after the migrated scope is green. |
| 38 | - **Node/CI**: verify the effective Node support policy from code, dependencies, CI, and release workflows. Do not blindly add a Node 20 matrix or an extra CI build step when the maintained baseline intentionally keeps CI latest-only for speed or already builds in release. |
| 39 | - **GitHub Actions**: keep `.github/workflows/*` aligned with the chosen baseline repo. Pin third-party actions to commit hashes, not floating tags, and update action pins by copying or refreshing the baseline pattern instead of inventing new pins. |
| 40 | - **TypeScript**: upgrade to TypeScript 6, remove stale/deprecated compiler options, prefer `target: "ES2023"` for Node 20+ packages, and keep module resolution consistent with runtime output. |
| 41 | - **tsgo**: enable Rslib declaration `dts: { tsgo: true }` only after checking compatibility with declaration bundling, package shape, and installed `@typescript/native-preview`. Pin native-preview to an exact version and validate emitted declarations plus package contents. |
| 42 | - **Docs**: keep `README.md` focused on purpose, install, usage, options, supported runtimes, release/license links. Add a concise `AGENTS.md` in the rsbuild-style shape: Stack, Commands, Project structure, and Code style. |
| 43 | - **Dependency cleanup**: run a repo-appropriate unused dependency check such as Knip when feasible, then remove only dependencies proven unused or misplaced. Do not a |