v0.x-to-observe-libs

Migrate per-package observability codegen to forge/pkg/observe interceptor middleware.

4|1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/reliant-labs/forge --skill v0-x-to-observe-libs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: v0.x-to-observe-libs
Source: https://github.com/reliant-labs/forge/tree/main/internal/templates/project/skills/forge/migration/v0.x-to-observe-libs
Command: npx skills add https://github.com/reliant-labs/forge --skill v0-x-to-observe-libs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It resolves breaking or inefficient observability migration when moving from per-internal-package middleware/tracing/metrics codegen to the interceptor-based observability libraries in forge/pkg/observe.

Core Features & Use Cases

  • Removes stale generated wrappers: ensures middleware_gen.go, tracing_gen.go, and metrics_gen.go are removed while keeping mock_gen.go intact.
  • Rewires server observability correctly: moves canonical wiring to observe.DefaultMiddlewares(...) with project-specific interceptors passed as Extras.
  • Guides manual code updates: helps you replace direct references to Instrumented/Traced/Metric wrapper types and adjust inner-call observability using TraceCall or related helpers when needed.

Use this when forge upgrade indicates you are crossing the version that introduced forge/pkg/observe (typically 1.6.x → 1.7.x) and your generated and wired observability code no longer matches the new recommended architecture.

Quick Start

Run forge generate, then verify no middleware_gen.go, tracing_gen.go, or metrics_gen.go files remain under internal/ before rebuilding and testing the project.

Frequently Asked Questions about v0.x-to-observe-libs

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

FAQPage Schema
Why does my forge upgrade break observability wiring when moving to 1.7.x?

Your forge upgrade crosses the version that introduced forge/pkg/observe, requiring migration from per-internal-package codegen wrappers to interceptor-based middleware. This Skill automates that observability migration by removing stale generated wrappers and rewiring to observe.DefaultMiddlewares.

How do I migrate generated middleware and tracing wrappers to interceptors?

Run forge generate to deterministically regenerate code, which removes stale middleware_gen.go, tracing_gen.go, and metrics_gen.go files while keeping mock_gen.go intact, then manually refactor direct wrapper type references to use observe.DefaultMiddlewares with Extras passthrough.

What generated files need to be removed when adopting forge/pkg/observe interceptors?

You must remove middleware_gen.go, tracing_gen.go, and metrics_gen.go files from internal packages while explicitly keeping mock_gen.go intact. The interceptor-based observability libraries replace these stale generated wrappers with canonical observe.DefaultMiddlewares chaining.

Can I keep mock codegen while removing tracing and metrics wrappers during a forge migration?

Yes, the migration ensures mock_gen.go remains untouched as codegen while only stale middleware, tracing, and metrics wrappers are removed. This allows you to adopt observe.DefaultMiddlewares and pass project-specific interceptors as Extras without losing mock generation.

How do I instrument inner-call observability after migrating to forge/pkg/observe?

Inner-call observability is handled by opting in to observe.TraceCall or related helpers for manual refactoring. The canonical interceptor chaining via observe.DefaultMiddlewares with Extras passthrough manages outer server observability, while TraceCall targets specific inner calls.

When do I need to manually refactor wrapper references during an observability migration?

Manual refactoring is needed when direct references to Instrumented, Traced, or Metric wrapper types exist in your code after deterministic regeneration. You must replace these references and adjust inner-call observability using TraceCall or related helpers to satisfy canonical interceptor chaining.