v0.x-to-testkit

Migrate inline bootstrap-testing helpers into forge/pkg/testkit via forge generate.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It resolves brittle, duplicated inline test helper code by moving the shared bootstrap-testing sub-helpers into forge/pkg/testkit, while keeping the generated per-service wiring stable.

Core Features & Use Cases

  • Centralizes test harness helpers: Discard logger, in-memory SQLite ORM setup, httptest server harness, permissive authorizer, and (when needed) WithTestTenant are provided by forge/pkg/testkit.
  • Keeps generated factory behavior intact: Per-service NewTest<Service> and NewTest<Service>Server shapes remain, with the wiring shim preserved in the generated pkg/app/testing.go.
  • Supports safe migration and verification: Uses forge generate for deterministic rewrite and guides verification via build and go test, with greps to confirm helper calls and detect legacy artifacts.

Quick Start

Run forge generate to rewrite pkg/app/testing.go into the testkit-backed shape and then verify with go test ./... and go build ./....

Frequently Asked Questions about v0.x-to-testkit

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

FAQPage Schema
How do I migrate inline test helpers to a shared testkit during a forge upgrade?

Migrate test helpers by running forge generate to deterministically rewrite pkg/app/testing.go, replacing inline bootstrap code with forge/pkg/testkit calls while preserving generated per-service NewTest<Service> factory behavior.

What is the purpose of centralizing test harness setup in forge/pkg/testkit?

Centralizing test harness setup in forge/pkg/testkit resolves brittle duplicated code by moving shared helpers like discard logger, sqlite memory DB, httptest server, and permissive authorizer into one package while keeping per-service wiring stable.

How do I verify a testkit migration succeeded without breaking existing tests?

Verify a testkit migration by running go build ./... and go test ./... to ensure compilation and test passage, then grep pkg/app/testing.go to confirm calls to testkit.DiscardLogger, testkit.NewSQLiteMemDB, testkit.NewTestServer, and testkit.PermissiveAuthorizer.

Can I preserve NewTest<Service>Server behavior when moving testing helpers to testkit?

Yes, NewTest<Service>Server behavior is preserved during testkit migration by keeping the generated per-service factory shape intact in pkg/app/testing.go, which now uses testkit-backed wiring shims instead of inlined setup code.

When do I need to migrate my codebase to use forge/pkg/testkit?

You need to migrate to forge/pkg/testkit when your codebase crosses a forge upgrade version that introduces the testkit package, particularly if your generated pkg/app/testing.go currently inlines discard logger, sqlite memory DB, and httptest harness setup.