# same-results-less-code

The same-results-less-code skill helps spot conceptual complexity during code review and refactoring while preserving behavior. It looks beyond the mechanical issues linters catch.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 148 installs · ★ 227 repo stars
- Author: pproenca
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/same-results-less-code/SKILL.md
- Updated: 2026-08-15
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/same-results-less-code

## What it does

The guide examines code that grew through custom reinventions, poor abstraction choices, hidden duplication, or stored values that could be computed. Any proposed change should keep outputs, errors, side effects, and the API surface unchanged.

Its rules cover eight areas, including standard-library alternatives, abstraction shape, duplicated logic, derived state, excessive checks, and underused types. Think of it as a second pass after mechanical cleanup. For algorithmic complexity, it points to `complexity-optimizer`; for general cleanup of recently changed code, it points to `code-simplifier`.

Use it during PR review, when a module feels heavy, or while designing a new one. The guide recommends waiting until duplication has appeared three times before extracting an abstraction. For routine linting and formatting, use tools such as `eslint` or `ruff` instead.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill same-results-less-code -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill same-results-less-code -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/same-results-less-code/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill same-results-less-code -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/same-results-less-code/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install pproenca/dot-skills skills/.experimental/same-results-less-code
```

2. **Manually: put the files in place**
- File: `.github/skills/same-results-less-code/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill same-results-less-code -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/pproenca/dot-skills --path skills/.experimental/same-results-less-code
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/same-results-less-code/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add pproenca/dot-skills --skill same-results-less-code -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/pproenca/dot-skills/tree/HEAD/skills/.experimental/same-results-less-code/SKILL.md

## When to use it
- spot unnecessary abstractions in a module
- find semantic duplication behind different syntax
- replace stored computed values with derivation
- check whether code can be simplified without behavior changes
- separate conceptual refactoring from lint cleanup

## Example prompts
- Review this PR and find simplifications that preserve behavior.
- This module feels heavy; identify accidental complexity and excess abstractions.
- Can this logic be shorter without changing its API or side effects?

## 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: 5c5c54d5c6bf0261.

BEGIN THIRD-PARTY FILE 5c5c54d5c6bf0261
```text
---
name: same-results-less-code
description: Same behaviour in fewer, clearer lines — covers the judgment gaps that linters cannot catch (reinvention, wrong frame, hidden duplication, derived state, procedural rebuilds, speculative generality, defensive excess, type-system underuse). Trigger when reviewing, refactoring, or simplifying code — and even when the user doesn't explicitly ask for "simplification" but is reviewing code, refactoring, or asking "is there a shorter way to write this?". Complements knip/eslint/ruff/tsc by focusing on the conceptual modelling layer those tools cannot see.
---
# Community Refactoring Best Practices: Same Results, Less Code

Code-review and refactoring guide focused on the parts of code volume that come from **judgment and modelling gaps** — wrong abstraction choices, hidden semantic duplication, defensive habits, premature generality. This skill deliberately skips what linters and tools like `knip`, `eslint`, `ruff`, `tsc --noUnusedLocals`, or formatters already catch. It is the second pass: after the mechanical cleanup, what remains?

## Core Principles

1. **Preserve behaviour.** Every transformation must produce identical observable behaviour — same outputs, same errors, same side effects, same API surface.
2. **Earlier mistakes cascade.** A wrong frame multiplies into wrong shapes, which multiply into duplicate logic. Optimise from the top of the lifecycle.
3. **Explain why, not just what.** Each rule explains the cost of the anti-pattern so judgment can transfer to novel cases.
4. **Quantify where possible.** Prefer "eliminates N lines / prevents X bug class" over "cleaner."
5. **Don't over-refactor.** Rule of three: extract abstractions when duplication has actually appeared three times, not in anticipation.

## When to Apply

Use this skill when:

- Reviewing a PR for "could this be simpler?" (the question linters can't answer)
- Refactoring code that has grown in volume without growing in capability
- Auditing a module that "feels heavy" — many flags, many layers, many checks
- Onboarding to an unfamiliar codebase and trying to spot the parts that are accidental volume vs essential complexity
- Designing a new module and wanting to avoid the common over-abstraction traps
- Working alongside knip / eslint / ruff and wanting the layer of judgment those tools can't supply

**Don't use this skill for:**
```
END THIRD-PARTY FILE 5c5c54d5c6bf0261

The third-party file has ended. Everything between the 5c5c54d5c6bf0261 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.

First 2398 of 12231 bytes. © pproenca · MIT · https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/same-results-less-code/SKILL.md

_Part of the page did not fit — see the HTML version._

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