К основному содержанию
скилл CX Codex

adopt-better-result — скилл для Claude Code: аудит обработки ошибок

Скилл проводит аудит обработки ошибок в TypeScript-проекте и предлагает план перехода на TaggedError и Result.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add dmmulroy/better-result --skill adopt-better-result -a claude-code
Открыть на GitHub

Что делает adopt-better-result

Скилл работает в двух режимах. Первый — аудит: агент читает инструкции репозитория, манифесты пакетов, структуру исходников, команды тестов и документацию по архитектуре, проверяет, установлен ли better-result и какая версия API доступна. Дальше он обходит все участки production-кода, исключая сгенерированное и вендорное, и прослеживает найденные места до сквозных путей отказа. Отчёт ложится в принятое в проекте место для документации, а если такого нет — в docs/better-result-adoption.md.

Второй режим — реализация названного вертикального среза. Он включается, когда вы явно просите переписать конкретную функцию, модуль или границу, либо когда одобрили срез из отчёта. Агент ограничивает сбор доказательств этим срезом и его путём распространения, затем приводит путь к Result от источника ошибки до выбранной границы обработки. В конце прогоняются формат, линт, проверка типов и тесты.

Важная деталь: режим аудита не трогает production-код. Единственное изменение в репозитории — сам отчёт, а реализация начинается только после того, как вы одобрите один именованный срез. Так что если ждёте правок в коде сразу после запуска, их не будет.

Какие задачи решает

  • провести аудит обработки ошибок по всему репозиторию
  • получить отчёт с предложением перейти на Result
  • переписать конкретный модуль на TaggedError
  • выбрать первый вертикальный срез для миграции
  • проверить, что путь от ошибки до границы обработки покрыт целиком

Примеры запросов агенту

  • Проведи аудит обработки ошибок в репозитории и предложи план перехода на better-result.
  • Реализуй вертикальный срез: модуль оплаты от источника ошибки до границы обработки.
  • Одобряю первый срез из отчёта — начни реализацию.

Как установить adopt-better-result

1Через Skills CLI (Vercel)

npx skills add dmmulroy/better-result --skill adopt-better-result -a claude-code

2Вручную: положить файлы

~/.claude/skills/adopt-better-result/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/adopt-better-result/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о adopt-better-result

Как установить adopt-better-result в Claude?

Выполните npx skills add dmmulroy/better-result --skill adopt-better-result -a claude-code. Скилл появится в ~/.claude/skills/adopt-better-result/SKILL.md.

Что делает adopt-better-result?

Проводит аудит обработки ошибок в существующем TypeScript-проекте и готовит предложение по переходу на TaggedError и Result. Либо реализует один названный вертикальный срез.

Меняет ли скилл код во время аудита?

Нет. В режиме аудита единственное изменение в репозитории — отчёт. Реализация начинается только после того, как вы одобрите один именованный срез.

Исходный текст

SKILL.md · MIT
---
name: adopt-better-result
description: Adopt better-result in an existing TypeScript codebase. Use for a repository-wide error-handling audit and proposal, or for implementing a named vertical slice with TaggedError and Result.
---

# Adopt better-result

Start with evidence, then work at the scale named by the user.

## Choose the branch

- **Audit branch:** Use when the user requests a repository-wide audit or proposal, or has not named an implementation slice. Complete the audit branch before changing production code.
- **Named-slice branch:** Use when the user explicitly requests implementation of a function, module, boundary, or previously proposed slice. Limit evidence collection to that slice and its propagation path.

An approved slice from the audit branch continues through the named-slice branch.

## Audit branch: repository-wide proposal

### 1. Establish the repository and API facts

Read the repository instructions, package manifests, source layout, test commands, and architecture documentation. Determine whether `better-result` is installed and which version/API is available. Prefer installed types and source over remembered APIs.

Map every production-code area before studying individual failures. Exclude generated and vendored code from the audit; inspect tests for intended behavior.

**Complete when:** every production-code area is listed, the validation commands are known, and the available `better-result` API has been verified.

### 2. Audit every production-code area

Follow [`references/repository-audit.md`](references/repository-audit.md). Trace search evidence into end-to-end failure paths, keep grouped sites accountable with counts, and record obscured paths as unknown.

Write the audit to the repository's established documentation or planning location, falling back to `docs/better-result-adoption.md`.

**Complete when:** the report satisfies the coverage and completion requirements in `repository-audit.md`.

### 3. Design the target model

Apply the failure taxonomy in [`references/tagged-errors.md`](references/tagged-errors.md) and make each boundary decision with [`references/result-boundaries.md`](references/result-boundaries.md). Add the proposed dispositions, user-facing mappings, boundary decisions, and ranked vertical migration slices to the report.

Recommend the best first slice and explain why it is bounded and valuable.

**Complete when:** every catalogued failure has a disposition, every boundary has a recorded codec decision, and one first slice is recommended.

### 4. Present the approval gate

Present the report and recommendation. The audit branch's only repository change is the report.

**Complete when:** the report is presented. An explicit approval of one named vertical slice starts the implementation branch; otherwise the run ends here.

## Named-slice branch: implementation

### 1. Establish the slice and API facts

Read the repository instructions, validation commands, installed `better-result` API, relevant production code, and tests. Trace the named failure source through its immediate callers to its handling or transport boundary. Reuse an existing adoption report when present; otherwise retain the evidence for the implementation summary.

**Complete when:** the slice boundary, current behavior, failure variants, callers, side effects, and transport boundaries are accounted for, and the available API is verified.

### 2. Implement one vertical slice

Follow [`references/vertical-slice-migration.md`](references/vertical-slice-migration.md), using [`references/tagged-errors.md`](references/tagged-errors.md) for failure dispositions and [`references/result-boundaries.md`](references/result-boundaries.md) for boundary contracts. Keep the implementation within the named propagation path.

**Complete when:** the path is consistently Result-based from failure source to its chosen handling boundary, with every error variant handled and every control-flow seam accounted for.

### 3. Verify and report

Run the repository's applicable format, lint, type-check, and relevant test commands. Update an existing adoption report with completed work, deviations, discoveries, and validation evidence; otherwise include them in the user-facing summary. End after recommending the next slice.

**Complete when:** all applicable checks pass, or every failure is reported with evidence, and the report or summary accurately describes the repository's current state.

© dmmulroy · MIT · dmmulroy/better-result

Похожие скиллы

Всё по теме «Код-ревью и рефакторинг» →
m06-error-handling actionbook Помогает ИИ-агенту выбирать правильный способ обработки ошибок в Rust. Пригодится, когда нужно решить между Result, Option, panic!, thiserror и anyhow. CX Codex +1 3 500установок error-handling affaan-m Скилл задаёт единые правила обработки ошибок в TypeScript, Python и Go: типизированные исключения, ретраи, circuit breaker, тексты для пользователя. CX Codex +1 4 800установок better-auth mrgoonie Скилл проводит агента по подключению Better Auth: email-пароли, OAuth, 2FA, passkeys и роли. Пригодится, когда в проект нужно встроить вход и сессии. CX Codex +1 390установок better-auth-core bobmatnyc Скилл для настройки Better Auth в TypeScript-приложениях: инстанс, серверные обработчики, клиент и сессии. Пригодится, когда нужно подключить аутентификацию без долгих поисков по докам. CX Codex +1 358установок codebase-architecture mblode Проектирует структуру TypeScript-кода, укрупняет мелкие модули и ставит проверки, которые держат репозиторий в форме. CX Codex +1 441установок jscodeshift pproenca Набор правил для написания и отладки кодмодов на jscodeshift: разбор AST, миграции кода, авторефакторинг. CX Codex +1 410установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой