|
| 1 | +# Contributing to Lynx Agent Skills |
| 2 | + |
| 3 | +Thank you for your interest in contributing! This guide will help you get started. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Node.js 18+ |
| 8 | +- pnpm 10+ |
| 9 | + |
| 10 | +```bash |
| 11 | +corepack enable |
| 12 | +corepack prepare pnpm@latest --activate |
| 13 | +``` |
| 14 | + |
| 15 | +## Getting Started |
| 16 | + |
| 17 | +```bash |
| 18 | +# Clone the repository |
| 19 | +git clone <repository-url> |
| 20 | +cd skills |
| 21 | + |
| 22 | +# Install dependencies |
| 23 | +pnpm install |
| 24 | + |
| 25 | +# Build all packages |
| 26 | +pnpm build |
| 27 | +``` |
| 28 | + |
| 29 | +## Project Structure |
| 30 | + |
| 31 | +``` |
| 32 | +. |
| 33 | +├── packages/ |
| 34 | +│ ├── cmd/ # Build tools |
| 35 | +│ │ ├── build-plugin/ |
| 36 | +│ │ └── build-marketplace/ |
| 37 | +│ ├── skills/ # Skill packages |
| 38 | +│ │ ├── debug-info-remapping/ |
| 39 | +│ │ └── reactlynx-best-practice/ |
| 40 | +│ └── plugins/ # Plugin packages |
| 41 | +│ ├── lynx-debug/ |
| 42 | +│ └── reactlynx/ |
| 43 | +├── package.json # Marketplace root |
| 44 | +└── pnpm-workspace.yaml |
| 45 | +``` |
| 46 | + |
| 47 | +## Creating a Skill |
| 48 | + |
| 49 | +1. Create a directory under `packages/skills/`: |
| 50 | + |
| 51 | +```bash |
| 52 | +mkdir -p packages/skills/my-skill |
| 53 | +``` |
| 54 | + |
| 55 | +2. Add `package.json`: |
| 56 | + |
| 57 | +```json |
| 58 | +{ |
| 59 | + "name": "@lynx-js/skill-my-skill", |
| 60 | + "version": "1.0.0", |
| 61 | + "type": "module", |
| 62 | + "files": ["SKILL.md", "scripts"], |
| 63 | + "scripts": { |
| 64 | + "build": "rslib build" |
| 65 | + }, |
| 66 | + "devDependencies": { |
| 67 | + "@rslib/core": "catalog:rstack" |
| 68 | + } |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +3. Create `SKILL.md` describing what the skill does. |
| 73 | + |
| 74 | +4. (Optional) Add scripts in `src/` with `rslib.config.ts` for TypeScript compilation. |
| 75 | + |
| 76 | +## Creating a Plugin |
| 77 | + |
| 78 | +1. Create a directory under `packages/plugins/`: |
| 79 | + |
| 80 | +```bash |
| 81 | +mkdir -p packages/plugins/my-plugin |
| 82 | +``` |
| 83 | + |
| 84 | +2. Add `package.json`: |
| 85 | + |
| 86 | +```json |
| 87 | +{ |
| 88 | + "name": "@lynx-js/plugin-my-plugin", |
| 89 | + "private": true, |
| 90 | + "version": "0.1.0", |
| 91 | + "description": "My Plugin", |
| 92 | + "type": "module", |
| 93 | + "files": [".claude-plugin", "commands", "agents", "skills", "scripts"], |
| 94 | + "scripts": { |
| 95 | + "build": "build-plugin" |
| 96 | + }, |
| 97 | + "dependencies": { |
| 98 | + "@lynx-js/skill-my-skill": "workspace:*" |
| 99 | + }, |
| 100 | + "devDependencies": { |
| 101 | + "build-plugin": "workspace:*" |
| 102 | + }, |
| 103 | + "claudePlugin": { |
| 104 | + "category": "development" |
| 105 | + } |
| 106 | +} |
| 107 | +``` |
| 108 | + |
| 109 | +3. Add the plugin to root `package.json`: |
| 110 | + |
| 111 | +```json |
| 112 | +{ |
| 113 | + "dependencies": { |
| 114 | + "@lynx-js/plugin-my-plugin": "workspace:*" |
| 115 | + } |
| 116 | +} |
| 117 | +``` |
| 118 | + |
| 119 | +## Build Commands |
| 120 | + |
| 121 | +```bash |
| 122 | +# Build everything |
| 123 | +pnpm build |
| 124 | + |
| 125 | +# Build a specific package |
| 126 | +pnpm -F @lynx-js/skill-reactlynx-best-practice build |
| 127 | + |
| 128 | +# Run tests |
| 129 | +pnpm -F @lynx-js/skill-reactlynx-best-practice test |
| 130 | +``` |
| 131 | + |
| 132 | +## Naming Conventions |
| 133 | + |
| 134 | +| Type | Pattern | Example | |
| 135 | +|------|---------|---------| |
| 136 | +| Skill | `@lynx-js/skill-*` | `@lynx-js/skill-reactlynx-best-practice` | |
| 137 | +| Plugin | `@lynx-js/plugin-*` | `@lynx-js/plugin-reactlynx` | |
| 138 | + |
| 139 | +## How It Works |
| 140 | + |
| 141 | +This project uses pnpm workspaces to manage Skills and Plugins: |
| 142 | + |
| 143 | +- **Skills** are reusable packages containing `SKILL.md` and optional scripts |
| 144 | +- **Plugins** depend on Skills and bundle them during build |
| 145 | +- **Build tools** (`build-plugin`, `build-marketplace`) handle metadata generation and file aggregation |
| 146 | + |
| 147 | +The build process: |
| 148 | +1. Compiles TypeScript scripts via rslib |
| 149 | +2. Copies dependent Skills into the plugin's `skills/` directory |
| 150 | +3. Generates `.claude-plugin/plugin.json` metadata |
| 151 | + |
| 152 | +## Release Process |
| 153 | + |
| 154 | +When code is merged to `main`: |
| 155 | +1. CI builds all packages |
| 156 | +2. Artifacts are pushed to the `release` branch |
| 157 | +3. Only `plugins/`, `skills/`, `.claude-plugin/`, and `README.md` are kept on `release` |
| 158 | + |
| 159 | +## Escape Hatch |
| 160 | + |
| 161 | +For simple cases without TypeScript, you can bypass the build system: |
| 162 | + |
| 163 | +```bash |
| 164 | +# Force-add ignored build artifacts |
| 165 | +git add -f packages/plugins/my-plugin/.claude-plugin/ |
| 166 | +git add -f packages/skills/my-skill/scripts/ |
| 167 | +``` |
| 168 | + |
| 169 | +> **Note**: Don't mix manual and build-managed files in the same package. |
| 170 | +
|
| 171 | +## Questions? |
| 172 | + |
| 173 | +Open an issue or reach out to the maintainers. |
0 commit comments