llm-api-contract

Define TypeScript LLMService API signatures for correct calls and error semantics.

21|4|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/tylerjrbuell/reactive-agents-ts --skill llm-api-contract
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: llm-api-contract
Source: https://github.com/tylerjrbuell/reactive-agents-ts/tree/main/.agents/skills/llm-api-contract
Command: npx skills add https://github.com/tylerjrbuell/reactive-agents-ts --skill llm-api-contract

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill codifies the exact TypeScript API contract for LLMService to prevent common compile-time and runtime errors caused by incorrect method signatures, wrong field access, or improper error handling.

Core Features & Use Cases

  • Precise API Signatures: Documents the exact shapes and return types for complete, stream, completeStructured, embed, countTokens, and getModelConfig.
  • Correct Field Usage & Error Semantics: Clarifies expected response fields such as content, stopReason, and usage.estimatedCost and enforces Effect-based error handling conventions.
  • Use Case: Use this contract when implementing or calling LLMService across agent layers, writing reasoning strategies, building LLM-dependent features, or creating deterministic test providers.

Quick Start

Validate your LLMService calls against the contract by calling complete with messages and accessing response.content and response.usage.totalTokens.

Frequently Asked Questions about llm-api-contract

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I correctly call LLMService completion endpoints in TypeScript?

To correctly call LLMService completion endpoints in TypeScript, pass messages to the complete method and access the returned response.content and response.usage.estimatedCost fields to prevent compile-time and runtime errors.

What are the correct response field names for LLMService structured completion and streaming?

The correct LLMService response field names for structured completion and streaming are content, stopReason, and usage.estimatedCost. Accessing these exact fields prevents incorrect data extraction and runtime failures.

How does Effect-based error handling work for LLMService API calls?

Effect-based error handling for LLMService API calls enforces specific error semantics during method execution. This contract ensures TypeScript agent layers correctly catch and manage failures without mismatched error types.

Can I use this TypeScript LLMService contract for embedding and token counting?

Yes, you can use this TypeScript LLMService contract for embedding and token counting. It specifies exact API signatures for the embed and countTokens methods to ensure non-compiling calls are prevented.

Why does my TypeScript LLMService code fail to compile when calling getModelConfig?

Your TypeScript LLMService code fails to compile when calling getModelConfig because the method signature does not match the defined API contract. Validating parameter shapes against the contract prevents these build errors.

When do I need an API contract for LLMService test provider scenarios?

You need an API contract for LLMService test provider scenarios when building deterministic tests. It codifies exact method signatures and field names to ensure test mocks accurately reflect production LLM behavior.