Skip to content

feat(opencode): add native skills mode (--skills) for opencode#3539

Open
Securiteru wants to merge 1 commit into
github:mainfrom
Securiteru:feat/opencode-skills-mode
Open

feat(opencode): add native skills mode (--skills) for opencode#3539
Securiteru wants to merge 1 commit into
github:mainfrom
Securiteru:feat/opencode-skills-mode

Conversation

@Securiteru

Copy link
Copy Markdown

Summary

opencode's native extension mechanism is skills (.opencode/skills/<name>/SKILL.md with name + description frontmatter — the layout ~/.config/opencode/skills/ uses). The opencode integration currently installs only legacy markdown commands (.opencode/commands/), which modern opencode does not auto-load.

This adds a --skills option to the opencode integration (mirroring the existing Copilot --skills pattern) that installs Spec Kit commands as native opencode skills under .opencode/skills/speckit-<name>/SKILL.md. Commands remain the default for backward compatibility; the two modes are mutually exclusive.

Why

Users running opencode today get command files that opencode doesn't load as skills. --skills produces the native skill layout opencode discovers automatically, making specify init --integration opencode --integration-options="--skills" actually usable end-to-end with opencode.

What changed

  • OpencodeIntegration(MarkdownIntegration) gains options() (--skills flag) and a setup() branch.
  • _OpencodeSkillsHelper(SkillsIntegration) — internal, unregistered delegate that installs skills to .opencode/skills/ (config folder .opencode/, subdir skills, registrar extension /SKILL.md).
  • effective_invoke_separator / build_command_invocation adapt to hyphenated (/speckit-<name>) invocations in skills mode.
  • post_process_skill_content delegates to the helper for shared hook-guidance injection.
  • build_exec_args (the opencode run --command dispatch) is preserved unchanged.
  • Commands mode is unchanged → no regression for existing users.

Verification

  • specify init --integration opencode --integration-options="--skills" → 10 .opencode/skills/speckit-*/SKILL.md (no commands/ dir).
  • specify init --integration opencode (default) → legacy .opencode/commands/speckit.*.md (unchanged).
  • specify init --integration codex → unchanged.
  • Tests: added TestOpencodeSkillsMode covering skill layout, frontmatter, hyphen separator, init flow. 72/72 opencode+codex tests pass; 2461/2462 broader suite (1 pre-existing unrelated failure in a workflow URL-download test).

Backward compatibility

Default behaviour is unchanged (commands). --skills is opt-in. Existing opencode tests (commands mode, legacy-dir migration) all pass unmodified.

Checklist

  • Tests added for the new skills mode
  • No regression in default (commands) mode
  • Mirrors the established Copilot --skills pattern
  • build_exec_args dispatch preserved

opencode's native extension mechanism is skills (.opencode/skills/<name>/SKILL.md
with name+description frontmatter), as used by ~/.config/opencode/skills/. The
opencode integration previously installed only legacy markdown commands
(.opencode/commands/), which modern opencode does not auto-load.

Add a --skills option (mirroring Copilot's pattern) that installs Spec Kit
commands as native opencode skills under .opencode/skills/speckit-<name>/SKILL.md.
Commands remain the default for backward compatibility; the two modes are
mutually exclusive.

- OpencodeIntegration(MarkdownIntegration) gains options()/setup() branching
- _OpencodeSkillsHelper(SkillsIntegration) is an internal, unregistered delegate
- effective_invoke_separator/build_command_invocation adapt to skills mode
- build_exec_args (opencode run dispatch) preserved unchanged
- Tests cover: skill file layout, frontmatter, hyphen separator, init flow

Verified: specify init --integration opencode --integration-options=--skills
produces 10 .opencode/skills/speckit-*/SKILL.md; default still produces
.opencode/commands/; codex unchanged.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in OpenCode native skills scaffolding while retaining legacy command-mode compatibility.

Changes:

  • Adds --skills setup and invocation handling.
  • Adds tests for layout, frontmatter, separators, and initialization.
Show a summary per file
File Description
src/specify_cli/integrations/opencode/__init__.py Implements OpenCode skills mode.
tests/integrations/test_integration_opencode.py Tests skills-mode behavior.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 4
  • Review effort level: Medium

Comment on lines +100 to +104
if self._skills_mode:
stem = command_name
if stem.startswith("speckit."):
stem = stem[len("speckit."):]
invocation = "/speckit-" + stem.replace(".", "-")
Comment on lines +281 to +283
assert result.exit_code == 0, f"init failed: {result.output}"
assert (target / ".opencode" / "skills" / "speckit-specify" / "SKILL.md").exists()
assert not (target / ".opencode" / "commands").exists()
Comment on lines +5 to +9
- **Skills** (native, recommended): ``.opencode/skills/<name>/SKILL.md`` at the
project level and ``~/.config/opencode/skills/`` globally. Skills carry
``name`` + ``description`` frontmatter and are invoked as ``/speckit-<name>``.
- **Commands** (legacy): ``.opencode/commands/speckit.<name>.md`` slash-command
files, with ``.opencode/command/`` as a deprecated predecessor.
Comment on lines +202 to +205
class TestOpencodeSkillsMode:
"""``--skills`` installs native opencode skills under .opencode/skills/."""

KEY = "opencode"
@mnriem

mnriem commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants