scaffold-package
Scaffold a new package in the monorepo with correct conventions, configs, and policy compliance
- License 许可
- MIT
- 最近更新
- 2026-11-06
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- scaffold-package
- description
- Scaffold a new package in the monorepo with correct conventions, configs, and policy compliance
- disable-model-invocation
- true
03 SKILL.md 正文
Scaffold a New Package
Create a new package in packages/ following all monorepo conventions.
Workflow
-
Gather info - Ask the user for:
- Package name (with or without
@tylerbu/scope) - Package type:
library,cli(OCLIF),docs(Astro/Starlight), orremark-plugin - Brief description
- Whether it should be private (default: false, except docs sites which are always private)
- Package name (with or without
-
Create directory -
packages/<folder-name>/- Folder name should match the unscoped package name
-
Create package.json matching existing conventions:
"type": "module""license": "MIT""author": "Tyler Butler <tyler@tylerbutler.com>""bugs": "https://github.com/tylerbutler/tools-monorepo/issues""repository": { "type": "git", "url": "git+https://github.com/tylerbutler/tools-monorepo.git", "directory": "packages/<name>" }"homepage"pointing to GitHub tree- Exports using
./esm/output directory with types - Scripts:
clean,build:compile,format,check:format,lint,testas appropriate for the type "nx": { "targets": { "build": {} } }to enable Nx orchestration- For CLIs: add
bin,oclifconfig,build:manifest,build:readmescripts - For docs sites: add
"private": true,build:site,dev,previewscripts,check:astro
-
Create tsconfig.json:
{ "extends": "../../config/tsconfig.strict.json", "include": ["src/**/*"], "compilerOptions": { "rootDir": "./src", "outDir": "./esm", "types": ["node"] } } -
Create vitest.config.ts (for non-docs packages):
import { defineConfig, mergeConfig } from "vitest/config"; import defaultConfig from "../../config/vitest.config"; const config = mergeConfig(defaultConfig, defineConfig({})); export default config; -
Create src/index.ts with a placeholder export
-
Create CLAUDE.md with package-specific guidance (keep it concise - 20-30 lines)
-
Run setup commands:
pnpm install ./packages/repopo/bin/dev.js check --fix pnpm syncpack:fix -
Verify - Run
pnpm nx run <package>:buildto confirm the package builds
Key Constraints
- Use tabs for indentation (not spaces)
- Use
.mtsfor TypeScript files if they need to be explicitly ESM (though.tsis fine with"type": "module") - No
.jsfile extensions - use.mjsor.cjs - Sort package.json keys (repopo enforces this)
- Internal deps use
workspace:^protocol
04 同仓库更多 Skills
release-check
Validate release readiness - changesets, policy compliance, build, test, and dependency sync
pr-changeset-check
Check if PR has appropriate changesets before creating
post-edit-conventions
Monorepo coding conventions to follow when writing or editing code in this repository
oclif-command-guide
Reference for OCLIF command patterns, base classes, and conventions used in CLI packages
nx-task-guide
Reference for Nx task architecture, orchestration patterns, and how to add or modify build tasks
nx-affected
Run Nx affected commands for the current changes