widen-return-type

Official

Widen return types, keep narrow type safety.

AuthorZaxbyHub
Version1.0.0
Installs0

System Documentation

What problem does it solve?

When widening a function's return type to support new use cases or extensibility, developers often lose the narrow, precise return types that make TypeScript's type system valuable, leading to unnecessary type errors and reduced code safety for existing function calls.

Core Features & Use Cases

  • Type-Safe Return Type Widening: Uses TypeScript overloads to preserve narrow return types for existing function calls while supporting widened return types for new use cases.
  • Consistent Opt-In Pattern Integration: Follows existing project patterns for tool map constants, conditional agent registration, and feature flag gating to ensure seamless integration with existing codebases.
  • Use Case: Ideal for OpenCode Swarm plugin development or any TypeScript codebase that uses opt-in tool registration and feature flags, where you need to expand function return types without breaking existing type safety for current users.

Quick Start

Ask the AI to apply the widen-return-type skill to update the return type of your existing tool registration function while keeping narrow return types intact for all current tool calls.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: widen-return-type
Download link: https://github.com/ZaxbyHub/opencode-swarm/archive/main.zip#widen-return-type

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 536,000+ vetted skills library on demand.