|
| 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 | +├── packages/ |
| 33 | +│ ├── cmd/ # Build tools |
| 34 | +│ │ ├── build-plugin/ |
| 35 | +│ │ └── build-marketplace/ |
| 36 | +│ ├── tools/ |
| 37 | +│ ├── skills/ # Skill packages |
| 38 | +│ └── plugins/ # Plugin packages |
| 39 | +├── package.json # Marketplace root |
| 40 | +└── pnpm-workspace.yaml |
| 41 | +``` |
| 42 | + |
| 43 | +## Creating a Skill |
| 44 | + |
| 45 | +1. Create a directory under `packages/skills/`: |
| 46 | + |
| 47 | +```bash |
| 48 | +mkdir -p packages/skills/my-skill |
| 49 | +``` |
| 50 | + |
| 51 | +2. Add `package.json`: |
| 52 | + |
| 53 | +```json |
| 54 | +{ |
| 55 | + "name": "@lynx-js/skill-my-skill", |
| 56 | + "version": "1.0.0", |
| 57 | + "type": "module", |
| 58 | + "files": [ |
| 59 | + "SKILL.md", |
| 60 | + "scripts", |
| 61 | + "references", |
| 62 | + "examples", |
| 63 | + "reference.md", |
| 64 | + "examples.md" |
| 65 | + ], |
| 66 | + "scripts": { |
| 67 | + "build": "rslib build" |
| 68 | + }, |
| 69 | + "devDependencies": { |
| 70 | + "@rslib/core": "catalog:rstack" |
| 71 | + } |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +3. Create `SKILL.md` describing what the skill does. |
| 76 | + |
| 77 | +4. (Optional) Add scripts in `src/` with `rslib.config.ts` for TypeScript compilation. |
| 78 | + |
| 79 | +## Creating a Plugin |
| 80 | + |
| 81 | +1. Create a directory under `packages/plugins/`: |
| 82 | + |
| 83 | +```bash |
| 84 | +mkdir -p packages/plugins/my-plugin |
| 85 | +``` |
| 86 | + |
| 87 | +2. Add `package.json`: |
| 88 | + |
| 89 | +```json |
| 90 | +{ |
| 91 | + "name": "@lynx-js/ai-plugin-my-plugin", |
| 92 | + "private": true, |
| 93 | + "version": "0.1.0", |
| 94 | + "description": "My Plugin", |
| 95 | + "type": "module", |
| 96 | + "files": [ |
| 97 | + ".claude-plugin", |
| 98 | + "commands", |
| 99 | + "agents", |
| 100 | + "skills", |
| 101 | + "scripts", |
| 102 | + "hooks", |
| 103 | + ".mcp.json", |
| 104 | + ".lsp.json" |
| 105 | + ], |
| 106 | + "scripts": { |
| 107 | + "build": "build-plugin" |
| 108 | + }, |
| 109 | + "dependencies": { |
| 110 | + "@lynx-js/skill-my-skill": "workspace:*" |
| 111 | + }, |
| 112 | + "devDependencies": { |
| 113 | + "build-plugin": "workspace:*" |
| 114 | + }, |
| 115 | + "claudePlugin": { |
| 116 | + "category": "development" |
| 117 | + } |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +3. Add the plugin to root `package.json`: |
| 122 | + |
| 123 | +```json |
| 124 | +{ |
| 125 | + "dependencies": { |
| 126 | + "@lynx-js/ai-plugin-my-plugin": "workspace:*" |
| 127 | + } |
| 128 | +} |
| 129 | +``` |
| 130 | + |
| 131 | +## Build Commands |
| 132 | + |
| 133 | +```bash |
| 134 | +# Build everything |
| 135 | +pnpm build |
| 136 | + |
| 137 | +# Build a specific package |
| 138 | +pnpm -F @lynx-js/skill-reactlynx-best-practices build |
| 139 | + |
| 140 | +# Run tests |
| 141 | +pnpm -F @lynx-js/skill-reactlynx-best-practices test |
| 142 | +``` |
| 143 | + |
| 144 | +## Naming Conventions |
| 145 | + |
| 146 | +| Type | Pattern | Example | |
| 147 | +| ------ | ---------------------- | ----------------------------------------- | |
| 148 | +| Skill | `@lynx-js/skill-*` | `@lynx-js/skill-reactlynx-best-practices` | |
| 149 | +| Plugin | `@lynx-js/ai-plugin-*` | `@lynx-js/ai-plugin-reactlynx` | |
| 150 | + |
| 151 | +## How It Works |
| 152 | + |
| 153 | +This project uses pnpm workspaces to manage Skills and Plugins: |
| 154 | + |
| 155 | +- **Skills** are reusable packages containing `SKILL.md` and optional scripts |
| 156 | +- **Plugins** depend on Skills and bundle them during build |
| 157 | +- **Build tools** (`build-plugin`, `build-marketplace`) handle metadata generation and file aggregation |
| 158 | + |
| 159 | +The build process: |
| 160 | + |
| 161 | +1. Compiles TypeScript scripts via rslib |
| 162 | +2. Copies dependent Skills into the plugin's `skills/` directory |
| 163 | +3. Generates `.claude-plugin/plugin.json` metadata |
| 164 | + |
| 165 | +## Release Process |
| 166 | + |
| 167 | +> [!IMPORTANT] |
| 168 | +> Pull requests must target the `main` branch, not the `release` branch. |
| 169 | +
|
| 170 | +When code is merged to `main`: |
| 171 | + |
| 172 | +1. CI builds all packages |
| 173 | +2. Artifacts are pushed to the `release` branch |
| 174 | +3. Only `plugins/`, `skills/`, `.claude-plugin/`, and `README.md` are kept on `release` |
| 175 | + |
| 176 | +## Escape Hatch |
| 177 | + |
| 178 | +For simple cases without TypeScript, you can bypass the build system: |
| 179 | + |
| 180 | +```bash |
| 181 | +# Force-add ignored build artifacts |
| 182 | +git add -f packages/plugins/my-plugin/.claude-plugin/ |
| 183 | +git add -f packages/skills/my-skill/scripts/ |
| 184 | +``` |
| 185 | + |
| 186 | +> **Note**: Don't mix manual and build-managed files in the same package. |
| 187 | +
|
| 188 | +## Questions? |
| 189 | + |
| 190 | +Open an issue or reach out to the maintainers. |
0 commit comments