# Reuse Before Generate

Searches public code and package indexes for an existing solution before your agent starts scaffolding one from scratch.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 6
- Author: aradar46
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/aradar46/reuse-before-generate
- Updated: 2026-09-23
- HTML: https://affpapa.org/en/nevibecode/mcp/reuse-before-generate

## What it does

The server steps in ahead of code generation and queries public catalogs in parallel: GitHub, GitLab, npm, PyPI, crates.io, NuGet, Maven Central, RubyGems, Packagist, Docker Hub, Hugging Face. It also covers app and tool listings such as Show HN, Flathub, F-Droid, GNOME Extensions, Homebrew, AUR, Conda and CRAN. Results come back as structured Markdown, and the agent is nudged to search the web for commercial products and community threads as well.

Every source sits behind a public endpoint, so no API keys are needed. One unavailable or rate-limited catalog does not block the rest — you still get what the others return. A GitHub token is optional and its only job is raising GitHub's search limit.

This matters when your assistant reaches for thousands of lines the moment you describe a feature. To make the check automatic, drop an instruction into `CLAUDE.md`, `.cursorrules`, `GEMINI.md` or `AGENTS.md`: call `check_before_building` (or `reuse_before_generate`) first, run a web search next, then show a short comparison table and ask whether to reuse or extend something that exists.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `GITHUB_TOKEN` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add reuse-before-generate -e GITHUB_TOKEN=<GITHUB_TOKEN> -- npx -y reuse-before-generate
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add reuse-before-generate --env GITHUB_TOKEN=<GITHUB_TOKEN> -- npx -y reuse-before-generate
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "reuse-before-generate": {
            "command": "npx",
            "args": [
                "-y",
                "reuse-before-generate"
            ],
            "env": {
                "GITHUB_TOKEN": "<GITHUB_TOKEN>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "reuse-before-generate": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "reuse-before-generate"
            ],
            "env": {
                "GITHUB_TOKEN": "<GITHUB_TOKEN>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e GITHUB_TOKEN=<GITHUB_TOKEN> reuse-before-generate npx -y reuse-before-generate
```
Replace <…> with your own values

## When to use it
- find a maintained library instead of writing the module yourself
- check whether an app for your use case already ships
- compare options from several ecosystems in one table
- make the agent ask before it scaffolds a new project

## Example prompts
- Check with reuse-before-generate whether a terminal markdown viewer already exists
- Before we write this service, look for existing tools and show me a comparison table
- Call `check_before_building` for offline speech to text on GNOME

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

---
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
