diff options
| author | jesse <jesse@magic-kingdom> | 2026-03-15 21:29:25 +0000 |
|---|---|---|
| committer | jesse <jesse@magic-kingdom> | 2026-03-15 21:29:25 +0000 |
| commit | f4b54a17171e4cf90601db6b6fc4ba3ab1c1f206 (patch) | |
| tree | 7e356e9faed0d6ecc0ba1fba0f4703a762018a0c /docs/README.opencode.md | |
| parent | 911fa1d6c535c4e68be852f2ee153421a161aa5c (diff) | |
Auto-register skills from plugin, simplify OpenCode install to one line
The plugin's new `config` hook injects the skills directory into
OpenCode's live config singleton, so skills are discovered automatically
without symlinks or manual config edits.
Installation is now just adding one line to opencode.json:
"plugin": ["superpowers@git+https://github.com/obra/superpowers.git"]
Rewrote docs/README.opencode.md and .opencode/INSTALL.md to reflect
the new approach, removing ~200 lines of platform-specific symlink
instructions. Added migration notes for existing users.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'docs/README.opencode.md')
| -rw-r--r-- | docs/README.opencode.md | 274 |
1 files changed, 37 insertions, 237 deletions
diff --git a/docs/README.opencode.md b/docs/README.opencode.md index 7f1ed30..71b74c5 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -2,169 +2,36 @@ Complete guide for using Superpowers with [OpenCode.ai](https://opencode.ai). -## Quick Install +## Installation -Tell OpenCode: +Add superpowers to the `plugin` array in your `opencode.json` (global or project-level): -``` -Clone https://github.com/obra/superpowers to ~/.config/opencode/superpowers, then create directory ~/.config/opencode/plugins, then symlink ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js to ~/.config/opencode/plugins/superpowers.js, then symlink ~/.config/opencode/superpowers/skills to ~/.config/opencode/skills/superpowers, then restart opencode. +```json +{ + "plugin": ["superpowers@git+https://github.com/obra/superpowers.git"] +} ``` -## Manual Installation +Restart OpenCode. The plugin auto-installs via Bun and registers all skills automatically. -### Prerequisites +Verify by asking: "Tell me about your superpowers" -- [OpenCode.ai](https://opencode.ai) installed -- Git installed +### Migrating from the old symlink-based install -### macOS / Linux +If you previously installed superpowers using `git clone` and symlinks, remove the old setup: ```bash -# 1. Install Superpowers (or update existing) -if [ -d ~/.config/opencode/superpowers ]; then - cd ~/.config/opencode/superpowers && git pull -else - git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers -fi - -# 2. Create directories -mkdir -p ~/.config/opencode/plugins ~/.config/opencode/skills - -# 3. Remove old symlinks/directories if they exist +# Remove old symlinks rm -f ~/.config/opencode/plugins/superpowers.js rm -rf ~/.config/opencode/skills/superpowers -# 4. Create symlinks -ln -s ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js ~/.config/opencode/plugins/superpowers.js -ln -s ~/.config/opencode/superpowers/skills ~/.config/opencode/skills/superpowers - -# 5. Restart OpenCode -``` - -#### Verify Installation - -```bash -ls -l ~/.config/opencode/plugins/superpowers.js -ls -l ~/.config/opencode/skills/superpowers -``` - -Both should show symlinks pointing to the superpowers directory. - -### Windows - -**Prerequisites:** -- Git installed -- Either **Developer Mode** enabled OR **Administrator privileges** - - Windows 10: Settings → Update & Security → For developers - - Windows 11: Settings → System → For developers - -Pick your shell below: [Command Prompt](#command-prompt) | [PowerShell](#powershell) | [Git Bash](#git-bash) - -#### Command Prompt - -Run as Administrator, or with Developer Mode enabled: - -```cmd -:: 1. Install Superpowers -git clone https://github.com/obra/superpowers.git "%USERPROFILE%\.config\opencode\superpowers" - -:: 2. Create directories -mkdir "%USERPROFILE%\.config\opencode\plugins" 2>nul -mkdir "%USERPROFILE%\.config\opencode\skills" 2>nul - -:: 3. Remove existing links (safe for reinstalls) -del "%USERPROFILE%\.config\opencode\plugins\superpowers.js" 2>nul -rmdir "%USERPROFILE%\.config\opencode\skills\superpowers" 2>nul - -:: 4. Create plugin symlink (requires Developer Mode or Admin) -mklink "%USERPROFILE%\.config\opencode\plugins\superpowers.js" "%USERPROFILE%\.config\opencode\superpowers\.opencode\plugins\superpowers.js" - -:: 5. Create skills junction (works without special privileges) -mklink /J "%USERPROFILE%\.config\opencode\skills\superpowers" "%USERPROFILE%\.config\opencode\superpowers\skills" - -:: 6. Restart OpenCode -``` - -#### PowerShell - -Run as Administrator, or with Developer Mode enabled: - -```powershell -# 1. Install Superpowers -git clone https://github.com/obra/superpowers.git "$env:USERPROFILE\.config\opencode\superpowers" - -# 2. Create directories -New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\opencode\plugins" -New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\opencode\skills" - -# 3. Remove existing links (safe for reinstalls) -Remove-Item "$env:USERPROFILE\.config\opencode\plugins\superpowers.js" -Force -ErrorAction SilentlyContinue -Remove-Item "$env:USERPROFILE\.config\opencode\skills\superpowers" -Force -ErrorAction SilentlyContinue - -# 4. Create plugin symlink (requires Developer Mode or Admin) -New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.config\opencode\plugins\superpowers.js" -Target "$env:USERPROFILE\.config\opencode\superpowers\.opencode\plugins\superpowers.js" - -# 5. Create skills junction (works without special privileges) -New-Item -ItemType Junction -Path "$env:USERPROFILE\.config\opencode\skills\superpowers" -Target "$env:USERPROFILE\.config\opencode\superpowers\skills" - -# 6. Restart OpenCode -``` - -#### Git Bash - -Note: Git Bash's native `ln` command copies files instead of creating symlinks. Use `cmd //c mklink` instead (the `//c` is Git Bash syntax for `/c`). +# Optionally remove the cloned repo +rm -rf ~/.config/opencode/superpowers -```bash -# 1. Install Superpowers -git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers - -# 2. Create directories -mkdir -p ~/.config/opencode/plugins ~/.config/opencode/skills - -# 3. Remove existing links (safe for reinstalls) -rm -f ~/.config/opencode/plugins/superpowers.js 2>/dev/null -rm -rf ~/.config/opencode/skills/superpowers 2>/dev/null - -# 4. Create plugin symlink (requires Developer Mode or Admin) -cmd //c "mklink \"$(cygpath -w ~/.config/opencode/plugins/superpowers.js)\" \"$(cygpath -w ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js)\"" - -# 5. Create skills junction (works without special privileges) -cmd //c "mklink /J \"$(cygpath -w ~/.config/opencode/skills/superpowers)\" \"$(cygpath -w ~/.config/opencode/superpowers/skills)\"" - -# 6. Restart OpenCode +# Remove skills.paths from opencode.json if you added one for superpowers ``` -#### WSL Users - -If running OpenCode inside WSL, use the [macOS / Linux](#macos--linux) instructions instead. - -#### Verify Installation - -**Command Prompt:** -```cmd -dir /AL "%USERPROFILE%\.config\opencode\plugins" -dir /AL "%USERPROFILE%\.config\opencode\skills" -``` - -**PowerShell:** -```powershell -Get-ChildItem "$env:USERPROFILE\.config\opencode\plugins" | Where-Object { $_.LinkType } -Get-ChildItem "$env:USERPROFILE\.config\opencode\skills" | Where-Object { $_.LinkType } -``` - -Look for `<SYMLINK>` or `<JUNCTION>` in the output. - -#### Troubleshooting Windows - -**"You do not have sufficient privilege" error:** -- Enable Developer Mode in Windows Settings, OR -- Right-click your terminal → "Run as Administrator" - -**"Cannot create a file when that file already exists":** -- Run the removal commands (step 3) first, then retry - -**Symlinks not working after git clone:** -- Run `git config --global core.symlinks true` and re-clone +Then follow the installation steps above. ## Usage @@ -178,8 +45,6 @@ use skill tool to list skills ### Loading a Skill -Use OpenCode's native `skill` tool to load a specific skill: - ``` use skill tool to load superpowers/brainstorming ``` @@ -207,124 +72,59 @@ description: Use when [condition] - [what it does] ### Project Skills -Create project-specific skills in your OpenCode project: +Create project-specific skills in `.opencode/skills/` within your project. -```bash -# In your OpenCode project -mkdir -p .opencode/skills/my-project-skill -``` +**Skill Priority:** Project skills > Personal skills > Superpowers skills -Create `.opencode/skills/my-project-skill/SKILL.md`: +## Updating -```markdown ---- -name: my-project-skill -description: Use when [condition] - [what it does] ---- +Superpowers updates automatically when you restart OpenCode. The plugin is re-installed from the git repository on each launch. -# My Project Skill +To pin a specific version, use a branch or tag: -[Your skill content here] +```json +{ + "plugin": ["superpowers@git+https://github.com/obra/superpowers.git#v5.0.3"] +} ``` -## Skill Locations - -OpenCode discovers skills from these locations: - -1. **Project skills** (`.opencode/skills/`) - Highest priority -2. **Personal skills** (`~/.config/opencode/skills/`) -3. **Superpowers skills** (`~/.config/opencode/skills/superpowers/`) - via symlink +## How It Works -## Features +The plugin does two things: -### Automatic Context Injection - -The plugin automatically injects superpowers context via the `experimental.chat.system.transform` hook. This adds the "using-superpowers" skill content to the system prompt on every request. - -### Native Skills Integration - -Superpowers uses OpenCode's native `skill` tool for skill discovery and loading. Skills are symlinked into `~/.config/opencode/skills/superpowers/` so they appear alongside your personal and project skills. +1. **Injects bootstrap context** via the `experimental.chat.system.transform` hook, adding superpowers awareness to every conversation. +2. **Registers the skills directory** via the `config` hook, so OpenCode discovers all superpowers skills without symlinks or manual config. ### Tool Mapping -Skills written for Claude Code are automatically adapted for OpenCode. The bootstrap provides mapping instructions: +Skills written for Claude Code are automatically adapted for OpenCode: - `TodoWrite` → `todowrite` - `Task` with subagents → OpenCode's `@mention` system - `Skill` tool → OpenCode's native `skill` tool - File operations → Native OpenCode tools -## Architecture - -### Plugin Structure - -**Location:** `~/.config/opencode/superpowers/.opencode/plugins/superpowers.js` - -**Components:** -- `experimental.chat.system.transform` hook for bootstrap injection -- Reads and injects the "using-superpowers" skill content - -### Skills - -**Location:** `~/.config/opencode/skills/superpowers/` (symlink to `~/.config/opencode/superpowers/skills/`) - -Skills are discovered by OpenCode's native skill system. Each skill has a `SKILL.md` file with YAML frontmatter. - -## Updating - -```bash -cd ~/.config/opencode/superpowers -git pull -``` - -Restart OpenCode to load the updates. - ## Troubleshooting ### Plugin not loading -1. Check plugin exists: `ls ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js` -2. Check symlink/junction: `ls -l ~/.config/opencode/plugins/` (macOS/Linux) or `dir /AL %USERPROFILE%\.config\opencode\plugins` (Windows) -3. Check OpenCode logs: `opencode run "test" --print-logs --log-level DEBUG` -4. Look for plugin loading message in logs +1. Check OpenCode logs: `opencode run --print-logs "hello" 2>&1 | grep -i superpowers` +2. Verify the plugin line in your `opencode.json` is correct +3. Make sure you're running a recent version of OpenCode ### Skills not found -1. Verify skills symlink: `ls -l ~/.config/opencode/skills/superpowers` (should point to superpowers/skills/) -2. Use OpenCode's `skill` tool to list available skills -3. Check skill structure: each skill needs a `SKILL.md` file with valid frontmatter - -### Windows: Module not found error - -If you see `Cannot find module` errors on Windows: -- **Cause:** Git Bash `ln -sf` copies files instead of creating symlinks -- **Fix:** Use `mklink /J` directory junctions instead (see Windows installation steps) +1. Use OpenCode's `skill` tool to list available skills +2. Check that the plugin is loading (see above) +3. Each skill needs a `SKILL.md` file with valid YAML frontmatter ### Bootstrap not appearing -1. Verify using-superpowers skill exists: `ls ~/.config/opencode/superpowers/skills/using-superpowers/SKILL.md` -2. Check OpenCode version supports `experimental.chat.system.transform` hook -3. Restart OpenCode after plugin changes +1. Check OpenCode version supports `experimental.chat.system.transform` hook +2. Restart OpenCode after config changes ## Getting Help - Report issues: https://github.com/obra/superpowers/issues - Main documentation: https://github.com/obra/superpowers - OpenCode docs: https://opencode.ai/docs/ - -## Testing - -Verify your installation: - -```bash -# Check plugin loads -opencode run --print-logs "hello" 2>&1 | grep -i superpowers - -# Check skills are discoverable -opencode run "use skill tool to list all skills" 2>&1 | grep -i superpowers - -# Check bootstrap injection -opencode run "what superpowers do you have?" -``` - -The agent should mention having superpowers and be able to list skills from `superpowers/`. |
