Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计未展示

context-witness背景见证人

Agent Skill

context-witness 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

441

周安装

18

GitHub Stars

公开资料未说明

下载量

143
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:context-witness(背景见证人)
来源仓库:https://github.com/front-depiction/claude-setup
仓库路径:skills/context-witness
安装命令:
npx skills add front-depiction/claude-setup --skill "context-witness"
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

AgentSkills.tonpx skills
npx skills add front-depiction/claude-setup --skill "context-witness"

简介

context-witness 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于前端开发、UI 设计或用户体验优化等需参考最佳实践的场景。
  • 返回经过验证的案例和模式库,提升解决方案可靠性。
  • 安装命令为 npx skills add front-depiction/claude-setup --skill "context-witness",应关注其对第三方服务的依赖程度。
  • 使用前请确认其是否包含过时的示例,避免引入 deprecated 方案。

SKILL.md

name
context-witness
description
Decide between Context Tag witness and capability patterns for dependency injection, understanding coupling trade-offs

Context Witness Pattern

Choose between witness (existence) and capability (behavior) patterns for Context Tags.

Coupling: Hard vs Soft

Some coupling is necessary and good - but move it from hard to soft coupling.

Hard Coupling (Schema)

Field exists in the schema - tightly coupled to domain model:

import { Schema } from "effect"

// ❌ HARD COUPLING - Serial is part of the schema
export const PaymentIntent = Schema.Struct({
  id: Schema.String,
  serial: Schema.String,  // In schema = hard coupled
  amount: Schema.BigInt
})

// Every PaymentIntent MUST have a serial
// Serialization/validation requires serial
// Cannot create without providing serial
// Schema change needed to remove/change serial

Soft Coupling (Witness)

Field removed from schema, only injected in code:

import { Schema, Context, Effect, Logger } from "effect"

declare const generateId: () => string

// ✅ SOFT COUPLING - Serial not in schema
export const PaymentIntent = Schema.Struct({
  id: Schema.String,
  amount: Schema.BigInt
  // No serial field!
})

// Serial is a witness - required but injected via Context
class Serial extends Context.Tag("Serial")<Serial, string>() {}

const createPaymentIntent = (amount: bigint) =>
  Effect.gen(function* () {
    const serial = yield* Serial  // Injected from context

    // Use serial in business logic, logging, etc.
    // but it's not part of the persisted data
    yield* Logger.info(`Creating payment intent ${serial}`)

    return PaymentIntent.make({ id: generateId(), amount })
  })

// Type: Effect<PaymentIntent, never, Serial>

Key insight: schema (hard coupling) => witness (soft coupling)

By removing the field from the schema and injecting it only where needed, you:

  • Keep domain models minimal
  • Avoid unnecessary persistence
  • Easy to test (provide test serial)
  • Easy to remove/change (just change injection)
  • Explicit dependencies in type signature

When to use witnesses:

  • Correlation IDs (for tracing, not persistence)
  • Request IDs (for logging, not data)
  • Transaction contexts (for coordination, not storage)
  • Tenant/Region markers (for routing, not schema)

Witness: Existence Only

Use when you only need to know something exists in the environment:

import { Schema, Context, Effect } from "effect"

declare const PaymentIntent: Schema.Struct<{
  id: typeof Schema.String
  serial: typeof Schema.String
  amount: typeof Schema.BigInt
}>
declare const other: any

// Witness - a serial number exists
export class Serial extends Context.Tag("Serial")<Serial, string>() {}

const createPaymentIntent = Effect.gen(function* () {
  const serial = yield* Serial  // Pull from environment
  return PaymentIntent.make({ serial, ...other })
})

// Type: Effect<PaymentIntent, never, Serial>

Capability: Behavior

Use when you need operations:

import { Schema, Context, Effect } from "effect"

declare const PaymentIntent: Schema.Struct<{
  id: typeof Schema.String
  serial: typeof Schema.String
  amount: typeof Schema.BigInt
}>
declare const other: any

// Capability - can generate/validate
export class SerialService extends Context.Tag("SerialService")<
  SerialService,
  {
    readonly next: () => string
    readonly validate: (s: string) => boolean
  }
>() {}

const createPaymentIntent = Effect.gen(function* () {
  const svc = yield* SerialService
  const serial = svc.next()  // Behavior
  return PaymentIntent.make({ serial, ...other })
})

// Type: Effect<PaymentIntent, never, SerialService>

Decision Framework

NeedPattern
Just presence/valueWitness
Operations/generationCapability
Precondition markerWitness
Side effectsCapability
Multiple implementationsCapability
Mocking behaviorCapability
Correlation IDWitness
Transaction contextWitness
LoggerCapability
DatabaseCapability

When to Use Witness

Good fits:

  • Request ID - must exist for tracing
  • Transaction context - must be established
  • Tenant/Region - required for data boundary
  • Pre-validated tokens - already verified

When to Use Capability

Good fits:

  • Serial generation - create/validate operations
  • Clock - now() operation
  • Logger - structured logging methods
  • Database - query/transact operations
  • HTTP clients - fetch/post operations

Testing Implications

Witnesses are trivial to provide:

import { Effect } from "effect"

declare const myProgram: Effect.Effect<unknown, never, Serial>
declare class Serial extends Context.Tag("Serial")<Serial, string>() {}

const test = myProgram.pipe(
  Effect.provideService(Serial, "test-serial-123")
)

Capabilities need implementation:

import { Effect } from "effect"

declare const myProgram: Effect.Effect<unknown, never, SerialService>
declare class SerialService extends Context.Tag("SerialService")<
  SerialService,
  {
    readonly next: () => string
    readonly validate: (s: string) => boolean
  }
>() {}

const test = myProgram.pipe(
  Effect.provideService(SerialService, {
    next: () => "test-serial-123",
    validate: () => true
  })
)

Coupling Strategy

Rule of thumb: Remove non-essential fields from schema, inject via witness instead.

Ask yourself: Does this need to be persisted/serialized?

  • No → Remove from schema, inject via witness
  • Yes → Keep in schema
import { Schema, Context, Effect, Logger, Clock } from "effect"

declare const LineItem: Schema.Schema<any>
declare const generateId: () => string
declare const calculateTotal: (items: Array<any>) => bigint

// ✅ Domain model - only persisted data
export const Order = Schema.Struct({
  id: Schema.String,
  items: Schema.Array(LineItem),
  total: Schema.BigInt
  // No correlationId - not persisted!
  // No timestamp - derived from system!
})

// Witnesses for runtime context
class CorrelationId extends Context.Tag("CorrelationId")<CorrelationId, string>() {}
class RequestId extends Context.Tag("RequestId")<RequestId, string>() {}

// Use in code, not in data
const createOrder = (items: Array<Schema.Schema.Type<typeof LineItem>>) =>
  Effect.gen(function* () {
    const correlationId = yield* CorrelationId  // For tracing
    const requestId = yield* RequestId          // For logging
    const clock = yield* Clock                  // For timestamp

    yield* Logger.info({
      message: "Creating order",
      correlationId,    // Used for tracing
      requestId,        // Used for logging
      timestamp: Clock.currentTimeMillis(clock)
    })

    // Data only contains what's persisted
    return Order.make({
      id: generateId(),
      items,
      total: calculateTotal(items)
    })
  })

// Type: Effect<Order, never, CorrelationId | RequestId | Clock>

Benefits:

  • Minimal schemas (only persisted data)
  • Context values available when needed
  • Easy to test with different context
  • Can add/remove context without schema changes
  • Explicit dependencies in type signatures

Choose witness for simplicity, capability for flexibility.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

31.95%
按下载量换算46

windsurf

21.36%
按下载量换算31

trae

16.9%
按下载量换算24

OpenCode

11.36%
按下载量换算16

Codex

8.51%
按下载量换算12

Antigravity

3.85%
按下载量换算6

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills