Skip to content
Agentmart
Submit a tool

understand-and-refactor

Join an unfamiliar product repo: map architecture and data flow, then apply the highest-ROI structural / duplication / perf / maintainability refactors.

Skill by nhouseholder

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/nhouseholder-understand-and-refactor

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Join an unfamiliar product repo: map architecture and data flow, then apply the highest-ROI structural / duplication / perf / maintainability refactors.

Use cases: data

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/understand-and-refactor

What's inside

Skill name
understand-and-refactor
Description
Join an unfamiliar product repo: map architecture and data flow, then apply the highest-ROI structural / duplication / perf / maintainability refactors.
License
MIT
Instructions
78 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Understand and refactor

First session on an unfamiliar product repo. **Map, then change.** Do not edit until the map names the highest-ROI targets — unless the user passed a path so narrow the map is that path.

`$ARGUMENTS` is the scope: a path or subsystem, and/or `--report-only`. Default scope is the current workspace. `--report-only` maps and ranks; it does not edit.

## Hard gates

- Behavior stays the same unless the user asked for a behavior change. This skill is structure, not features.
- Prefer existing docs over re-exploring: `AGENTS.md`, `CLAUDE.md`, `CONTEXT.md`, ADRs, `handoffs/`, README.
- A failed lookup is not a missing record. Prove the search can find something before reporting nothing.
- Do not invent product rules, betting thresholds, or deploy steps. Point at the file that already owns them.
- Do not add a library that duplicates one already in the repo. Search `package.json` / imports first.

## 1. Scope

- Named path / subsystem → that tree only.
- No path → whole workspace, but still start at the product surface the user cares about (app entry, API, pipeline) rather than listing every folder.
- `--report-only` present → stop after §4. No edits, no commits.

## 2. Map (write this down)

Read docs first. Then the repo:

1. Top-level layout and what each tree is for.
2. Runtime entry points (CLI, workers, HTTP, UI routes, schedulers).
3. Data flow for the main job: who writes, who reads, which store/key, which combiner.
4. Shared modules vs one-off copies.
5. Test / verify command that actually runs.

Keep the map short. Names, paths, arrows. Not a tour.

If a code-graph / memory MCP is available for this repo, use it before a repo-wide grep for symbols. Grep for exact string literals.

## 3. Rank problems

Only four buckets. Drop anything that is taste, renaming-for-renaming, or a rewrite of a working seam:

| Bucket | Look for |
|---|---|
| Structural | God modules, inverted dependencies, business rules stuck in I/O |
| Duplication | Two sources for one fact, copy-pasted gates, parallel formatters |
| Perf | Hot path doing N+1, unbounded walks, extra renders, sync work on the request path |
| Maintainability | Dead flags, undocumented invariants, tests that cannot fail, comments that lie |

Score each candidate:

- **Blast radius** — files/callers touched
- **Payoff** — fewer lies, fewer copies, cheaper hot path, safer change later
- **Proof** — how you will know it worked (test, metric, or both)

Highest ROI = high payoff, bounded blast radius, a proof. Skip “clean up the whole layer.”

## 4. Report

Print:

1. **Map** — entries, data flow, stores.
2. **Ranked list** — 3–7 items, ROI first, with proof.
3. **Do not touch** — sacred files / hard rules found in docs.
4. **First move** — the one change you would make this session.

`--report-only` ends here.

## 5. Apply (not `--report-only`)

Do the first move, then the next only if it is still the highest ROI after the first lands.

- One logical change per commit-sized chunk.
- Existing tests run; add a characterization test before moving a seam that has none.
- Hunt regressions on sibling readers of any fact you moved.
- Stop when the ranked list’s remaining items are speculative or out of scope.

## Done

The map is still accurate. The edits match the ranked list. Proof ran. No drive-by refactors outside the list.

From nhouseholder/cursor-laptop-skills, MIT.

More from nhouseholder/cursor-laptop-skills

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Aug 28, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from nhouseholder

Cite this page

understand-and-refactor skill. Agent Mart. https://agentmart.dev/skills/nhouseholder-understand-and-refactor (last updated 2026-10-24)