# Read Before Edit

> Use when about to modify code in a file or function you haven't actually read yet — making a change in an unfamiliar or existing part of the codebase. Makes the agent read the surrounding code first so the edit matches existing patterns and doesn't break nearby logic.

- **Type:** Skill
- **Install:** `agentstack add skill-buildmoonshot-skillpacks-read-before-edit`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [buildmoonshot](https://agentstack.voostack.com/s/buildmoonshot)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [buildmoonshot](https://github.com/buildmoonshot)
- **Source:** https://github.com/buildmoonshot/skillpacks/tree/main/skills/engineering/beginner/read-before-edit

## Install

```sh
agentstack add skill-buildmoonshot-skillpacks-read-before-edit
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Read Before You Edit

Before changing existing code, **read enough of it to understand what you're touching.** Editing blind is how agents break working software.

## What to do

1. **Read the function/section you're changing** — and the code immediately around it. Understand what it does and what depends on it before you touch a line.

2. **Find the existing patterns.** How does this file name things, handle errors, structure logic? Match that, don't impose your own style.

3. **Check who calls it.** A quick look at where a function is used tells you what you might break. Changing a signature or return value without checking callers is a classic self-inflicted bug.

4. **Reuse what's there.** If the codebase already has a helper, a utility, or a pattern for what you need, use it instead of writing a parallel one. New code should look like it belongs.

## The trap to avoid

Don't pattern-match on the *name* of a function and assume it does what you'd expect. Open it and confirm. The function called `validateUser` might also mutate state, log, or throw — assumptions about unread code are where bugs hide.

## Why this matters

Most agent-introduced bugs aren't bad logic — they're good logic that didn't fit the existing code, broke an unseen caller, or duplicated something already there. Two minutes of reading prevents the kind of bug that takes an hour to trace.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [buildmoonshot](https://github.com/buildmoonshot)
- **Source:** [buildmoonshot/skillpacks](https://github.com/buildmoonshot/skillpacks)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-buildmoonshot-skillpacks-read-before-edit
- Seller: https://agentstack.voostack.com/s/buildmoonshot
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
