|
| 1 | +--- |
| 2 | +name: create-package |
| 3 | +description: Create a new monorepo package using the create-package CLI |
| 4 | +--- |
| 5 | + |
| 6 | +# Create Package Skill |
| 7 | + |
| 8 | +Use this skill when the user asks to create a new package in the monorepo. |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +The `yarn create-package` command automates the creation of new monorepo packages by: |
| 13 | + |
| 14 | +- Generating package scaffolding from the template package |
| 15 | +- Setting up the package structure, configuration files, and dependencies |
| 16 | +- Creating package.json with the provided name and description |
| 17 | + |
| 18 | +## Required Arguments |
| 19 | + |
| 20 | +- `--name` (or `-n`): The package name. Will be prefixed with "@ocap/" if not provided. |
| 21 | +- `--description` (or `-d`): A short description of the package for package.json |
| 22 | + |
| 23 | +## Usage Pattern |
| 24 | + |
| 25 | +1. Ask the user for the package name and description if not provided |
| 26 | +2. Run `yarn create-package --name <package-name> --description "<description>"` |
| 27 | +3. After successful creation, remind the user to: |
| 28 | + - Add coverage thresholds to the root `vitest.config.ts` file |
| 29 | + - Add any additional dependencies using `yarn workspace @ocap/<package-name> add <dep>` |
| 30 | + - If adding monorepo packages as dependencies, update the `references` array in the package's `tsconfig.json` and `tsconfig.build.json` |
| 31 | + |
| 32 | +## Example |
| 33 | + |
| 34 | +```bash |
| 35 | +yarn create-package --name my-package --description "A package for handling my feature" |
| 36 | +``` |
| 37 | + |
| 38 | +This creates a new package at `packages/my-package` with the name `@ocap/my-package`. |
| 39 | + |
| 40 | +## Post-Creation Steps |
| 41 | + |
| 42 | +Always remind the user of these manual steps after package creation: |
| 43 | + |
| 44 | +1. **Add coverage thresholds** to root `vitest.config.ts`: |
| 45 | + |
| 46 | + - The CLI cannot modify .ts config files automatically |
| 47 | + - Add appropriate coverage thresholds for the new package |
| 48 | + |
| 49 | +2. **Add dependencies** if needed: |
| 50 | + |
| 51 | + ```bash |
| 52 | + yarn workspace @ocap/<package-name> add <dependency> |
| 53 | + ``` |
| 54 | + |
| 55 | +3. **Update TypeScript references** if adding monorepo dependencies: |
| 56 | + - Add to `references` array in `tsconfig.json` |
| 57 | + - Add to `references` array in `tsconfig.build.json` |
| 58 | + |
| 59 | +## Notes |
| 60 | + |
| 61 | +- The package name will automatically be prefixed with "@ocap/" if not provided |
| 62 | +- The created package is private by default |
| 63 | +- The template is located at `packages/template-package/` |
| 64 | +- All placeholder values in the template will be replaced with actual values |
0 commit comments