$npx -y skills add lbb00/ai-rules-sync --skill new-adapterAdd support for a new AI tool with adapters, CLI, completion, and tests.
| 1 | # New Adapter |
| 2 | |
| 3 | ## Instructions |
| 4 | |
| 5 | Complete workflow for adding support for a new AI tool to AIS. |
| 6 | |
| 7 | ### Prerequisites |
| 8 | |
| 9 | Before starting, gather this information: |
| 10 | - Tool name (e.g., "windsurf", "mcp") |
| 11 | - Rule/config types supported (e.g., rules, commands, skills) |
| 12 | - Default source directory (e.g., `.windsurf/rules/`) |
| 13 | - Target directory (usually same as source) |
| 14 | - File mode: `file` or `directory` |
| 15 | |
| 16 | ### Steps |
| 17 | |
| 18 | #### 1. Create Adapter File |
| 19 | |
| 20 | Create `src/adapters/<tool>-<type>.ts`: |
| 21 | |
| 22 | ```typescript |
| 23 | import { createBaseAdapter } from './base.js'; |
| 24 | |
| 25 | export const myToolAdapter = createBaseAdapter({ |
| 26 | name: '<tool>-<type>', |
| 27 | tool: '<tool>', |
| 28 | subtype: '<type>', |
| 29 | configPath: ['<tool>', '<type>'], |
| 30 | defaultSourceDir: '.<tool>/<type>', |
| 31 | targetDir: '.<tool>/<type>', |
| 32 | mode: 'directory', // or 'file' |
| 33 | }); |
| 34 | ``` |
| 35 | |
| 36 | #### 2. Register Adapter |
| 37 | |
| 38 | In `src/adapters/index.ts`: |
| 39 | - Import the new adapter |
| 40 | - Register in `DefaultAdapterRegistry` constructor |
| 41 | |
| 42 | #### 3. Update Project Config |
| 43 | |
| 44 | In `src/project-config.ts`: |
| 45 | - Add tool section to `ProjectConfig` interface |
| 46 | - Add tool to `SourceDirConfig` interface if needed |
| 47 | |
| 48 | #### 4. Wire CLI Commands |
| 49 | |
| 50 | In `src/cli/register.ts`: |
| 51 | - Add tool subcommand group |
| 52 | - Register add/remove/install/import commands |
| 53 | |
| 54 | #### 5. Update Completion |
| 55 | |
| 56 | In `src/completion.ts`: |
| 57 | - Add tool to completion types |
| 58 | - Add subtype completions |
| 59 | |
| 60 | In `src/completion/scripts.ts`: |
| 61 | - Update bash/zsh/fish completion scripts |
| 62 | |
| 63 | #### 6. Add Tests |
| 64 | |
| 65 | Create `src/__tests__/<tool>-<type>.test.ts`: |
| 66 | - Test adapter properties |
| 67 | - Test add/remove operations |
| 68 | - Test config path resolution |
| 69 | |
| 70 | #### 7. Update Documentation |
| 71 | |
| 72 | - README.md: Add to supported sync types table |
| 73 | - README_ZH.md: Sync changes (use `/sync-readme`) |
| 74 | - CLAUDE.md: Update if architectural changes |
| 75 | |
| 76 | #### 8. Verify |
| 77 | |
| 78 | ```bash |
| 79 | # Build |
| 80 | npm run build |
| 81 | |
| 82 | # Run tests |
| 83 | npm test |
| 84 | |
| 85 | # Test manually |
| 86 | node dist/index.js <tool> <type> add <name> |
| 87 | node dist/index.js <tool> <type> remove <name> |
| 88 | ``` |
| 89 | |
| 90 | ### Checklist |
| 91 | |
| 92 | - [ ] Adapter file created |
| 93 | - [ ] Adapter registered |
| 94 | - [ ] ProjectConfig updated |
| 95 | - [ ] CLI commands wired |
| 96 | - [ ] Completion updated |
| 97 | - [ ] Tests written and passing |
| 98 | - [ ] README.md updated |
| 99 | - [ ] README_ZH.md synced |
| 100 | - [ ] Manual testing complete |
| 101 | |
| 102 | ## Examples |
| 103 | |
| 104 | Request: Add support for a new AI tool with rules and skills |
| 105 | Result: Complete adapter implementation with tests passing |