Skip to content

Add OpenCode Agent Skill Installation Option to NPX Installer #5

@grantfox-oss

Description

@grantfox-oss

Add support to install the Trustless Work skill for OpenCode AI (parity with Claude Code and Gemini CLI) + validate behavior with real integration/verification scenarios

Context

We already have an npm package that users run via:

Today, the installer creates/configures the Trustless Work skill for Claude Code, enabling the agent to:

  • Guide implementation of Trustless Work products: API, SDK, Blocks
  • Verify whether any of those products are implemented correctly in a user's project

We want to extend the installer to also support installing the same skill for OpenCode AI.


Goal

Update the npx installer so users can choose the target AI agent and install the Trustless Work skill for:

  • ✅ Claude Code (existing)
  • ✅ Gemini CLI (existing)
  • ➕ OpenCode AI (new)

Critical: The OpenCode skill must have feature parity with Claude and must operate with deep, accurate, and up-to-date knowledge of Trustless Work products and integration requirements.


Key Requirement: Skill knowledge must be accurate, detailed, and up-to-date

The installed OpenCode skill must not be generic. It must provide production-grade guidance and verification aligned with current Trustless Work requirements, including (but not limited to):

  • Product-specific integration steps for API / SDK / Blocks
  • Current required parameters, endpoints, configuration, and conventions
  • The latest escrow schema (fields, structure, lifecycle, roles, milestones, disputes, etc.)
  • Correct typing expectations (DTOs/interfaces/types), validations, and constraints
  • Required conventions (naming, env vars, headers, auth patterns, required payload shape, etc.)
  • Verification logic that checks correctness based on the current Trustless Work spec

Source of truth for knowledge: https://docs.trustlesswork.com/trustless-work/


Requirements

1) Installer prompt update

  • Running npx @trustless-work/skill must show a welcome screen and a target agent selection menu including:
    • Claude Code
    • Gemini CLI
    • OpenCode AI
  • Selecting OpenCode AI must trigger the OpenCode-specific installation flow.

2) OpenCode AI skill installation

Implement a new installer path that:

  • Creates the skill files/config required by OpenCode AI (format + location per OpenCode’s expected setup).
  • Installs the Trustless Work skill with:
    • Implementation workflows: API / SDK / Blocks
    • Verification workflows (detects whether Trustless Work is integrated correctly)

3) Knowledge freshness / update strategy (must-have)

The installer must ensure the OpenCode skill content is updated to match Trustless Work’s latest integration requirements.

Implement at least one of the following strategies:

  • Option A (recommended): Add a npx @trustless-work/skill update command that refreshes skill content based on the latest Trustless Work docs/spec.
  • Option B: During install, fetch current docs (or a versioned spec snapshot) and embed/reference it so the skill has up-to-date instructions and schemas.
  • Option C: Ship a versioned “spec bundle” with a clear upgrade/update path. Warn if the skill/spec is older than the installed package version.

Acceptance expectation: A user who installs the OpenCode skill should get a skill that knows the current parameters, schemas, and typing requirements—not outdated ones.

4) Shared core content (avoid duplication)

Avoid duplicating logic/content across Claude, Gemini, OpenCode:

  • Extract shared “Trustless Work knowledge + workflows” into a core module.
  • Implement per-agent adapters that map that core into:
    • Claude skill format (existing)
    • OpenCode skill format (new)

5) Graceful behavior

  • If OpenCode tooling is not installed or configured, the installer must:
    • Provide a clear message explaining what is missing
    • Provide steps to fix it
  • No silent partial installs.

6) Documentation

Update README to:

  • Mention OpenCode support
  • Show how to install for Claude
  • Show how to install for OpenCode
  • Explain OpenCode prerequisites
  • Include how to update skill knowledge (if an update command is added)

Acceptance Criteria

  • Running npx @trustless-work/skill shows a menu including Claude Code, Gemini CLI and OpenCode AI.
  • Selecting OpenCode AI installs the skill successfully and prints:
    • Where the skill was installed
    • How to invoke/use it in OpenCode
    • Example prompts for:
      • Implement API/SDK/Blocks
      • Verify integration
  • The OpenCode skill is not generic and reflects Trustless Work’s real integration needs, including:
    • Correct parameters
    • Correct escrow schema expectations
    • Correct typing/DTO/interface guidance
  • Existing Claude installation remains unchanged and works as before.
  • README updated.
  • Automated tests and/or smoke tests validate:
    • Claude flow still passes
    • OpenCode flow creates the expected files/structure
    • The installed content includes the Trustless Work spec bundle / version reference / update mechanism

Mandatory Real-World Validation (must be performed and documented)

Beyond unit tests, the PR must include evidence that the OpenCode skill actually works in realistic scenarios. At minimum:

A) Implementation scenario test (happy path)

Using OpenCode with the installed skill, request an actual implementation, for example:

  • “Implement Trustless Work API integration in a NestJS project”
  • “Integrate Trustless Work SDK and provide example usage”
  • “Add Trustless Work Blocks into a Next.js app with a sample screen”

Expected:

  • The agent produces steps/code consistent with current Trustless Work requirements (parameters, schemas, types).
  • No outdated instructions.

B) Verification scenario test (error detection)

Intentionally introduce mistakes in a sample project and verify the skill detects them, for example:

  • Missing required env vars / config
  • Wrong endpoint/parameter names
  • Incorrect escrow schema fields
  • Type mismatches in DTOs/interfaces
  • Wrong payload shape for create/execute flows

Expected:

  • The skill identifies the issue(s) clearly and suggests the correct fix aligned with the current spec.

C) Record the results

Add to PR description (or a docs/validation.md) including:

  • The prompts used
  • The outputs (summaries)
  • What errors were introduced
  • What the skill detected and how it proposed fixes
  • Skill/spec version used during the validation

Tests

Run:

  • npm test

Suggested Implementation Notes

  • Add a clean abstraction:
    • installSkill(target: "claude" | "gemini" | "opencode", options)
  • Shared modules:
    • core/knowledge (docs/spec bundle, schemas, types, integration checklists)
    • core/workflows (implement API/SDK/Blocks, verify integration)
    • core/verifier (project checks)
  • Per-agent adapters:
    • adapters/claude/*
    • adapters/opencode/*
  • Add a skillVersion + specVersion field and print it after install.

Out of Scope

  • Adding support for additional agents beyond OpenCode (other than already planned ones).
  • Major CLI refactors unless required to add OpenCode cleanly.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions