# restore-internals-seams-in-finally-blocks-after-each-test

restore-internals-seams-in-finally-blocks-after-each-test is a Claude Code skill that directs agents to restore original _internals in finally after each test of error paths through DI seams.

- skill · `type=skill` · Claude Code, Codex, OpenCode, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 539 repo stars
- Author: ZaxbyHub
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/ZaxbyHub/opencode-swarm/tree/HEAD/.opencode/skills/generated/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/restore-internals-seams-in-finally-blocks-after-each-test

## What it does

For tests that exercise error handling through `_internals` DI seams, the skill requires restoring the original implementations in `finally` after each test. Otherwise, changed implementations can affect other tests in Bun’s shared runner process and trigger cascading failures.

It also calls for checking seam restoration in `afterEach`. Reviewers should look for both actions in the diff, and test engineers should add or update tests for the relevant condition. This is guidance for test changes, not a test-running script.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add ZaxbyHub/opencode-swarm --skill restore-internals-seams-in-finally-blocks-after-each-test -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/restore-internals-seams-in-finally-blocks-after-each-test/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add ZaxbyHub/opencode-swarm --skill restore-internals-seams-in-finally-blocks-after-each-test -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add ZaxbyHub/opencode-swarm --skill restore-internals-seams-in-finally-blocks-after-each-test -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install ZaxbyHub/opencode-swarm .opencode/skills/generated/restore-internals-seams-in-finally-blocks-after-each-test
```

2. **Manually: put the files in place**
- File: `.github/skills/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add ZaxbyHub/opencode-swarm --skill restore-internals-seams-in-finally-blocks-after-each-test -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/ZaxbyHub/opencode-swarm --path .opencode/skills/generated/restore-internals-seams-in-finally-blocks-after-each-test
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add ZaxbyHub/opencode-swarm --skill restore-internals-seams-in-finally-blocks-after-each-test -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/ZaxbyHub/opencode-swarm/tree/HEAD/.opencode/skills/generated/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md

## When to use it
- restore original `_internals` implementations after a test
- prevent DI seam changes from affecting other tests
- check seam restoration in `afterEach`
- add tests for the restoration condition

## Example prompts
- Check error-handling tests that use `_internals` and restore the original implementations in `finally` after each test.
- Verify that `afterEach` checks seam restoration.
- Update the tests to cover `_internals` restoration after an error.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: d3f2cf7da3d5d2fe.

BEGIN THIRD-PARTY FILE d3f2cf7da3d5d2fe
````text
---
name: restore-internals-seams-in-finally-blocks-after-each-test
description: restore _internals seams in finally blocks after each test
metadata:
  generated_from_knowledge: '["5ef666bf-7c7b-4990-b652-20782bf9c866"]'
  source_knowledge_ids: '["5ef666bf-7c7b-4990-b652-20782bf9c866"]'
  generated_at: "2026-07-14T05:31:50.176Z"
  confidence: "0.60"
  status: active
  version: "1"
  skill_origin: generated
---

<!-- generated by opencode-swarm skill-generator. Do not edit by hand; edits will be preserved on regeneration only with controlled update mode. -->

# restore _internals seams in finally blocks after each test

## Trigger

- (no explicit trigger metadata; cluster derived from category/tags)

## Required Procedure

- restore _internals seams in finally blocks after each test
- verify seam restoration in afterEach

## Forbidden Shortcuts

- (none recorded)

## Delegation Template

When delegating a task affected by this skill, include:

```
SKILLS: file:.opencode/skills/generated/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md
```

## Reviewer Checks

- Verify each required action above appears in the diff.

## Test Engineer Checks

- Add or update tests covering the trigger condition and the forbidden shortcut.

## Source Knowledge IDs

- 5ef666bf-7c7b-4990-b652-20782bf9c866 — When testing error-handling paths via _internals DI seams, always restore original implementations in a finally block to prevent cross-test pollution that causes cascading failures in Bun's shared test-runner process
````
END THIRD-PARTY FILE d3f2cf7da3d5d2fe

The third-party file has ended. Everything between the d3f2cf7da3d5d2fe tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© ZaxbyHub · MIT · https://github.com/ZaxbyHub/opencode-swarm/tree/HEAD/.opencode/skills/generated/restore-internals-seams-in-finally-blocks-after-each-test/SKILL.md

## Similar
- [bun-test-basics](https://affpapa.org/en/nevibecode/skills/bun-test-basics.md) — skill · 481 installs
- [bun-test-mocking](https://affpapa.org/en/nevibecode/skills/bun-test-mocking.md) — skill · 427 installs
- [testing-blocks](https://affpapa.org/en/nevibecode/skills/testing-blocks.md) — skill · 1700 installs
- [run-tests-after-changes](https://affpapa.org/en/nevibecode/hooks/run-tests-after-changes.md) — hook · 1967 installs
- [bun-runtime](https://affpapa.org/en/nevibecode/skills/bun-runtime.md) — skill · 6500 installs
- [bun-development](https://affpapa.org/en/nevibecode/skills/bun-development.md) — skill · 2900 installs

From the same set: [zaxbyhub/opencode-swarm](https://affpapa.org/en/nevibecode/by/zaxbyhub/opencode-swarm.md) — 121 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
