reuse-before-you-write
БесплатноБез исполняемых скриптовНе проверенUse before writing any new function, helper, component or module - find what the repository, the standard library and the installed dependencies already…
от makifbaysal★ 123 звезды на GitHubОб этом скилле
Reuse Before You Write
Overview
Every line you add is a line someone reviews, tests and fixes later. Most of what a task needs already exists: in this repository, in the standard library or framework, in a dependency the project already ships, or in a library the whole ecosystem trusts. Writing it again costs review time, brings back bugs that library fixed years ago, and leaves the repository with two ways of doing one thing.
Core principle: the best code is the code you did not have to write. Be lazy about the solution, never about the change: the callers, tests and fixtures your change touches are still yours to finish.
The ladder: take the first rung that fully works
- Does it need to exist? Build what the task, its criteria and the human's comments ask for. Options, flags, config and "for later" extension points nobody asked for are not built.
- Already in this repository? A helper, service, component, hook, repository method, error type, test fixture or builder. Call it the way its neighbours do. If it almost fits, extend it in place (a parameter, a case) instead of writing a near-copy beside it.
- Standard library, framework or platform? Use what the language, the framework and the runtime already give you. If the repository wraps one (a house HTTP client, logger or date helper), use the house version.
- A dependency already installed? Read the manifest and lockfile and use what is there. A second library for a job an installed one already does (two HTTP clients, two date libraries, two validators) is a finding.
- A non-trivial, well-understood problem? Use the established library its ecosystem uses (see "When a library beats your own code"), vetted and added the way "Adding a library" says.
- Only now: the minimum new code that solves the task, in the repository's existing structure, layers and conventions.
Whatever rung you land on, keep the validation at trust boundaries, the error handling that prevents data loss, the security checks and the accessibility. Reuse never cuts those.
How to look before writing anything new
codebase_searchfor the concept ("retry with backoff", "format money", "parse csv", "debounce", "object pool"). Names differ between repositories; concepts don't.grep_codefor the usual names:retry,backoff,slug,debounce,paginate,validate,format,parse,pool, and the usual homes:util,helpers,common,shared,lib,pkg,core,platform.get_symbol_skeleton/expand_symbol_contexton a candidate: confirm it does what you need and see how its callers use it.search_memory(scope=project) for this repository's earlier choices ("http client", "date library").- The manifest:
go.mod,pom.xml/build.gradle(.kts),package.json,pubspec.yaml,pyproject.toml/requirements*.txt,Packages/manifest.json(Unity),addons/(Godot),.uproject/.uplugin(Unreal),Cargo.toml,*.csproj/Directory.Packages.props.
Two or three searches per concept is enough. Nothing found → go down the ladder; don't spend the run searching.
When a library beats your own code
Hand-rolling one of these is a review finding, not a shortcut:
| Problem | Why your own version loses |
|---|---|
| Password hashing, encryption, signatures, JWT/OAuth/OIDC, random tokens | One subtle mistake is a security hole; the library has been attacked for years. |
| Dates, times, time zones, durations, calendars | DST, leap years and zone rules break hand-written 86400-second math. |
| Money and decimals | Binary floats round; money needs a decimal type or integer minor units. |
| Parsing and serialization: CSV, JSON schemas, YAML, TOML, XML, HTML, Markdown, URLs, e-mail addresses, phone numbers | Quoting, escaping, encodings and malformed input; a split(",") or a regex covers the happy path only. |
| Input validation of whole request or form objects | A schema library gives field-specific messages and one error shape for free. |
| Retries with backoff and jitter, circuit breakers, rate limiting | Easy to get wrong under load; see resilient-io guidance where your skills have it. |
| HTTP/gRPC clients, file formats (PDF, images, zip, spreadsheets) | Protocol and format edge cases you will not think of. |
| Plurals, number, currency and date formatting per locale | CLDR rules; the platform's Intl / intl already has them. |
| Sanitizing HTML or user content for display | XSS; use the sanitizer, never a regex. |
A small transformation of your own data (map a DTO, sum a list, build a label) is not on this list. Write it.
Adding a library
Every point must hold, or go back down the ladder:
- Established: the de-facto choice in this ecosystem, the one the framework's own docs point to, widely used and documented. Not a single-maintainer package almost nobody installs.
- Maintained: a release in roughly the last year, and no open, unfixed security ad
Установить reuse-before-you-write в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл reuse-before-you-write?
Use before writing any new function, helper, component or module - find what the repository, the standard library and the installed dependencies already provide, and use an established library instead of hand-rolled code for a non-trivial problem
Как установить скилл reuse-before-you-write?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл reuse-before-you-write запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic