context-witness

Explains how to separate TypeScript service contracts using witness-based DI.

68|13|Updated Aug 9, 2025
One-click install
npx skills add https://github.com/kriegcloud/beep-effect --skill context-witness-kriegcloud
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-witness
Source: https://github.com/kriegcloud/beep-effect/tree/main/.claude/skills/context-witness
Command: npx skills add https://github.com/kriegcloud/beep-effect --skill context-witness-kriegcloud

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of tightly coupled domain models by differentiating between data that needs to be persisted and runtime context that is injected. It helps in creating more flexible and testable code.

Core Features & Use Cases

  • Soft Coupling: Demonstrates how to remove fields from schemas and inject them via context (witnesses) for cleaner domain models.
  • Witness vs. Capability: Provides a clear decision framework for choosing between witness (existence) and capability (behavior) patterns for dependency injection.
  • Use Case: When building a web service, instead of embedding a correlationId directly into your Order schema, you can remove it and inject it as a witness from the runtime context, making your Order schema minimal and focused only on persisted data.

Quick Start

Use the context-witness skill to understand how to inject a correlation ID as a witness.

Frequently Asked Questions about context-witness

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

FAQPage Schema
How do I decouple data from schema using context in Effect-TS?

You can decouple data from schema by removing non-essential fields and injecting them as runtime context witnesses, ensuring your domain models remain minimal and focused on persisted data.

What is the context witness pattern for dependency injection?

The context witness pattern is a dependency injection approach that separates runtime context from persisted data by passing non-essential fields as witnesses, creating soft coupling and explicit dependencies.

When should I use witness vs capability patterns for dependency injection?

Use the witness pattern when you need to inject existence-based runtime context like correlation IDs, and use the capability pattern when injecting behavior, ensuring explicit dependencies and easier testing.

How do I handle correlation IDs in TypeScript schemas without hard coupling?

Remove the correlation ID from your TypeScript schema and inject it via runtime context as a witness, achieving soft coupling and keeping your domain model focused only on essential persisted data.

What are the benefits of soft coupling for domain models in Effect-TS?

Soft coupling yields minimal domain models, easier testing, and explicit dependencies by removing non-essential fields from schemas and injecting them through runtime context witnesses.

Does the context witness pattern work for managing request IDs in TypeScript?

Yes, the context witness pattern works for request IDs by removing them from your TypeScript schema and injecting them as runtime context witnesses, preventing hard coupling in your domain models.