# create-tests-extract

create-tests-extract extracts heavy inline test blocks into adjacent files while preserving access to private module items.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 113 installs · ★ 5 repo stars
- Author: ulpi-io
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/ulpi-io/skills/tree/HEAD/create-tests-extract/SKILL.md
- Updated: 2026-08-31
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/create-tests-extract

## What it does

This skill slims down production source files without degrading test strictness, specifically targeting Rust codebases. Instead of throwing tests into a top-level integration folder, it prefers an adjacent module like `foo_tests.rs` wired with `#[cfg(test)]`. That keeps `super::*` visibility working so unit tests continue checking private helpers.

The routine inspects the source, selects the smallest extraction boundary, moves test-only helpers alongside test functions, and wires the module. Once moved, it runs the narrowest targeted test suite to confirm nothing broke.

It only reorganizes existing test suites: creating fresh test cases or repairing failing logic falls outside its scope.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add ulpi-io/skills --skill create-tests-extract -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/create-tests-extract/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/create-tests-extract/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add ulpi-io/skills --skill create-tests-extract -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/create-tests-extract/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add ulpi-io/skills --skill create-tests-extract -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/create-tests-extract/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install ulpi-io/skills create-tests-extract
```

2. **Manually: put the files in place**
- File: `.github/skills/create-tests-extract/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add ulpi-io/skills --skill create-tests-extract -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/ulpi-io/skills --path create-tests-extract
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/create-tests-extract/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add ulpi-io/skills --skill create-tests-extract -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/ulpi-io/skills/tree/HEAD/create-tests-extract/SKILL.md

## When to use it
- relocate bulky inline test suites out of core source files
- keep private visibility intact without turning unit tests into integration checks
- move test-specific helpers and fixtures into dedicated files
- run focused test suites immediately after file reorganizations

## Example prompts
- Extract the inline test module from src/parser.rs into an adjacent file
- Move the heavy #[cfg(test)] block out of this file while keeping private access
- Clean up storage.rs by moving its test suite next to it and running checks

## Similar
- [rust-unit-tests](https://affpapa.org/en/nevibecode/skills/rust-unit-tests.md) — skill · ★ 720 repo stars
- [rust-write-tests](https://affpapa.org/en/nevibecode/skills/rust-write-tests.md) — skill · 257 installs
- [writing-unit-tests](https://affpapa.org/en/nevibecode/skills/writing-unit-tests.md) — skill · 25700 installs
- [testing-craft](https://affpapa.org/en/nevibecode/skills/testing-craft.md) — skill · 1200 installs
- [gsd-add-tests](https://affpapa.org/en/nevibecode/skills/gsd-add-tests.md) — skill · 576 installs
- [generate-tests](https://affpapa.org/en/nevibecode/commands/generate-tests.md) — command · 12378 installs

From the same set: [ulpi-io/skills](https://affpapa.org/en/nevibecode/by/ulpi-io/skills.md) — 49 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
