[FEATURE]: Add .claude/commands/ compatibility (like .claude/skills/) #4255

Open
opened 2026-02-16 17:43:11 -05:00 by yindo · 4 comments
Owner

Originally created by @SeanZoR on GitHub (Jan 5, 2026).

Originally assigned to: @thdxr on GitHub.

Summary

OpenCode supports Claude Code's .claude/skills/ paths for skill discovery, but doesn't support .claude/commands/ paths for command discovery. This creates an inconsistent migration experience for users coming from Claude Code.

Current Behavior

Skills - OpenCode searches these paths (per docs):

  • .opencode/skill/<name>/SKILL.md (project)
  • ~/.config/opencode/skill/<name>/SKILL.md (global)
  • .claude/skills/<name>/SKILL.md (project, Claude-compatible)
  • ~/.claude/skills/<name>/SKILL.md (global, Claude-compatible)

Commands - OpenCode only searches (per docs):

  • .opencode/command/ (project)
  • ~/.config/opencode/command/ (global)

No .claude/commands/ compatibility.

Proposed Behavior

Add Claude-compatible command paths to match the skills behavior:

  • .claude/commands/<name>.md (project)
  • ~/.claude/commands/<name>.md (global)

Use Case

Users migrating from Claude Code who have existing commands at ~/.claude/commands/ currently need to either:

  1. Copy/move files to ~/.config/opencode/command/
  2. Create symlinks manually

This is friction that doesn't exist for skills.

Related Issues

  • #6266 - .claude/skills/ compatibility discussion
  • #6177 - Skill discovery paths
  • #6252 - PR that added project-level .claude/skills/ support
Originally created by @SeanZoR on GitHub (Jan 5, 2026). Originally assigned to: @thdxr on GitHub. ## Summary OpenCode supports Claude Code's `.claude/skills/` paths for skill discovery, but doesn't support `.claude/commands/` paths for command discovery. This creates an inconsistent migration experience for users coming from Claude Code. ## Current Behavior **Skills** - OpenCode searches these paths (per [docs](https://opencode.ai/docs/skills)): - `.opencode/skill/<name>/SKILL.md` (project) - `~/.config/opencode/skill/<name>/SKILL.md` (global) - `.claude/skills/<name>/SKILL.md` (project, Claude-compatible) - `~/.claude/skills/<name>/SKILL.md` (global, Claude-compatible) **Commands** - OpenCode only searches (per [docs](https://opencode.ai/docs/commands)): - `.opencode/command/` (project) - `~/.config/opencode/command/` (global) No `.claude/commands/` compatibility. ## Proposed Behavior Add Claude-compatible command paths to match the skills behavior: - `.claude/commands/<name>.md` (project) - `~/.claude/commands/<name>.md` (global) ## Use Case Users migrating from Claude Code who have existing commands at `~/.claude/commands/` currently need to either: 1. Copy/move files to `~/.config/opencode/command/` 2. Create symlinks manually This is friction that doesn't exist for skills. ## Related Issues - #6266 - `.claude/skills/` compatibility discussion - #6177 - Skill discovery paths - #6252 - PR that added project-level `.claude/skills/` support
Author
Owner

@github-actions[bot] commented on GitHub (Jan 5, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6266: Does opencode actually support finding skills at .claude/skills? - Related to Claude Code path compatibility
  • #299: [feat] custom slash commands - Related feature for custom command management
  • #6347: [FEATURE]: Plugin Hook for Registering Additional Config Directories - Related to configurable discovery paths for commands and skills

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 5, 2026): This issue might be a duplicate of existing issues. Please check: - #6266: Does opencode actually support finding skills at `.claude/skills`? - Related to Claude Code path compatibility - #299: [feat] custom slash commands - Related feature for custom command management - #6347: [FEATURE]: Plugin Hook for Registering Additional Config Directories - Related to configurable discovery paths for commands and skills Feel free to ignore if none of these address your specific case.
Author
Owner

@mamoreau-devolutions commented on GitHub (Jan 7, 2026):

I just tried doing basic compatibility by copying .claude/commands to .opencode/command, but it looks like there are incompatibilities with the frontmatter for things like the argument-hint: https://code.claude.com/docs/en/slash-commands#frontmatter

Image

I wouldn't mind having to duplicate certain frontmatter parameters for Claude Code and OpenCode, but this particular incompatibility prevents OpenCode from loading it. Therefore, I can't just use a git symlink for compatibility like I do for GitHub Copilot.

@mamoreau-devolutions commented on GitHub (Jan 7, 2026): I just tried doing basic compatibility by copying .claude/commands to .opencode/command, but it looks like there are incompatibilities with the frontmatter for things like the argument-hint: https://code.claude.com/docs/en/slash-commands#frontmatter <img width="1517" height="949" alt="Image" src="https://github.com/user-attachments/assets/12ae9366-1168-4586-a515-a92ce43c4dad" /> I wouldn't mind having to duplicate certain frontmatter parameters for Claude Code and OpenCode, but this particular incompatibility prevents OpenCode from loading it. Therefore, I can't just use a git symlink for compatibility like I do for GitHub Copilot.
Author
Owner

@zerobell-lee commented on GitHub (Jan 26, 2026):

It even interprets instructions wrongly. I tried running slash commands on both environment; ~/.config/opencode/commands and ~/.claude/commands, they were recognized successfully, but one in ~/.claude/commands never worked. It just adds custom command instruction onto the prompt and make user request empty.

@zerobell-lee commented on GitHub (Jan 26, 2026): It even interprets instructions wrongly. I tried running slash commands on both environment; `~/.config/opencode/commands` and `~/.claude/commands`, they were recognized successfully, but one in `~/.claude/commands` never worked. It just adds custom command instruction onto the prompt and make user request empty.
Author
Owner

@pablontiv commented on GitHub (Jan 29, 2026):

Additional Context: Frontmatter Incompatibility

Building on @mamoreau-devolutions' comment about frontmatter incompatibilities, here's the full mapping needed for Claude Code → OpenCode command compatibility:

Claude Code Frontmatter

name: my-command
description: Does something
argument-hint: <topic>
allowed-tools: [Read, Write, Bash]
model: claude-sonnet-4-20250514

OpenCode Command Frontmatter

description: Does something
agent: build
model: anthropic/claude-sonnet-4-20250514
subtask: false

Key Differences

Claude Code OpenCode Notes
name filename OpenCode derives name from file
argument-hint - No equivalent (causes parse error)
allowed-tools - No equivalent
model model Different format (provider/model)
- agent OpenCode-specific
- subtask OpenCode-specific

Suggested Solution

When loading from .claude/commands/, OpenCode could:

  1. Ignore unknown frontmatter fields instead of erroring
  2. Map argument-hint to hints array
  3. Auto-prefix model with provider if missing

This would allow the same command file to work in both tools.


Alternatively, issue #10262 (plugin dynamic commands) would let a compatibility plugin handle this translation layer without core changes.

@pablontiv commented on GitHub (Jan 29, 2026): ## Additional Context: Frontmatter Incompatibility Building on @mamoreau-devolutions' comment about frontmatter incompatibilities, here's the full mapping needed for Claude Code → OpenCode command compatibility: ### Claude Code Frontmatter ```yaml name: my-command description: Does something argument-hint: <topic> allowed-tools: [Read, Write, Bash] model: claude-sonnet-4-20250514 ``` ### OpenCode Command Frontmatter ```yaml description: Does something agent: build model: anthropic/claude-sonnet-4-20250514 subtask: false ``` ### Key Differences | Claude Code | OpenCode | Notes | |-------------|----------|-------| | `name` | filename | OpenCode derives name from file | | `argument-hint` | - | No equivalent (causes parse error) | | `allowed-tools` | - | No equivalent | | `model` | `model` | Different format (`provider/model`) | | - | `agent` | OpenCode-specific | | - | `subtask` | OpenCode-specific | ### Suggested Solution When loading from `.claude/commands/`, OpenCode could: 1. Ignore unknown frontmatter fields instead of erroring 2. Map `argument-hint` to `hints` array 3. Auto-prefix model with provider if missing This would allow the same command file to work in both tools. --- Alternatively, issue #10262 (plugin dynamic commands) would let a compatibility plugin handle this translation layer without core changes.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4255