bianhaifeng789-hue/openclaw-config/backend-type-discriminated-union

Claude Code and agent skill by bianhaifeng789-hue/openclaw-config

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Install

npx vskill@latest install bianhaifeng789-hue/openclaw-config/backend-type-discriminated-union

SKILL.md

The same SKILL.md was published earlier as bianhaifeng789-hue/openclaw-config/backend-type-discriminated-union.

Backend Type Discriminated Union Pattern

Source

Claude Code: utils/swarm/backends/types.ts

Pattern

BackendType + PaneBackendType discriminated union + isPaneBackend type guard.

Code Example

typescript
export type BackendType = 'tmux' | 'iterm2' | 'in-process'
export type PaneBackendType = 'tmux' | 'iterm2' // Subset without in-process
export type PaneId = string // Opaque identifier for pane
export type CreatePaneResult = {
paneId: PaneId
isFirstTeammate: boolean // Affects layout strategy
}
export type PaneBackend = {
readonly type: BackendType
readonly displayName: string
readonly supportsHideShow: boolean
isAvailable(): Promise<boolean>
isRunningInside(): Promise<boolean>
createTeammatePaneInSwarmView(name: string, color: AgentColorName): Promise<CreatePaneResult>
sendCommandToPane(paneId: PaneId, command: string, useExternalSession?: boolean): Promise<void>
setPaneBorderColor(paneId: PaneId, color: AgentColorName): Promise<void>
setPaneTitle(paneId: PaneId, name: string, color: AgentColorName): Promise<void>
enablePaneBorderStatus(windowTarget?: string): Promise<void>
rebalancePanes(windowTarget: string, hasLeader: boolean): Promise<void>
killPane(paneId: PaneId): Promise<boolean>
hidePane(paneId: PaneId): Promise<boolean>
showPane(paneId: PaneId, targetWindowOrPane: string): Promise<boolean>
}
export type TeammateExecutor = {
readonly type: BackendType
isAvailable(): Promise<boolean>
spawn(config: TeammateSpawnConfig): Promise<TeammateSpawnResult>
sendMessage(agentId: string, message: TeammateMessage): Promise<void>
terminate(agentId: string, reason?: string): Promise<boolean>
kill(agentId: string): Promise<boolean>
isActive(agentId: string): Promise<boolean>
}
// Type guard
export function isPaneBackend(type: BackendType): type is 'tmux' | 'iterm2' {
return type === 'tmux' || type === 'iterm2'
}

Key Concepts

  1. BackendType: 3 backend types (tmux, iterm2, in-process)
  2. PaneBackendType: Subset for pane-based only (tmux, iterm2)
  3. PaneBackend: Low-level pane operations interface
  4. TeammateExecutor: High-level teammate lifecycle interface
  5. Type Guard: isPaneBackend() for narrowing

Benefits

  • Clear separation: PaneBackend (low-level) vs TeammateExecutor (high-level)
  • Type-safe backend selection
  • Subset type for pane-only contexts

When to Use

  • Multi-backend teammate execution
  • Pane-based vs in-process distinction
  • Backend capability checks

Related Patterns

  • Backend Detection Registry (backends/registry.ts)
  • Teammate Spawn Config (backends/types.ts)
  • Pane Backend Executor (PaneBackendExecutor.ts)

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/bianhaifeng789-hue/openclaw-config/backend-type-discriminated-union/badge)](https://verified-skill.com/skills/bianhaifeng789-hue/openclaw-config/backend-type-discriminated-union)

Something wrong with this skill or its page? Tell us.