errors
БесплатноБез исполняемых скриптовНе проверенReview changed and surrounding code for error handling violations and fix them. Use when checking or fixing error conventions in the project: no dynamic…
от emgeorrk★ 37 звёзд на GitHubОб этом скилле
Review all changed and surrounding code in the current diff for error handling violations, then fix each one.
Rules
1. Never create dynamic errors
Do not use fmt.Errorf(...) or errors.New(...) to construct ad-hoc error values at the call site. Every error must be a package-level sentinel.
Wrong:
return fmt.Errorf("user %s not found", id)
return errors.New("connection failed")
2. Use sentinel errors
Each package declares its sentinels in a dedicated errors.go file
(see internal/sensors/errors.go). Keep them unexported (errFoo) unless
callers in other packages need errors.Is on them:
package sensors
import "errors"
var (
errCPUInfo = errors.New("host_processor_info failed")
errSMCRead = errors.New("SMC read failed")
)
Wrap sentinels to add context using fmt.Errorf with %w:
return fmt.Errorf("%w: kern_return_t %d", errCPUInfo, int(kr))
Wrapping an underlying error you received (syscall, stdlib) with %w is also
fine: fmt.Errorf("sysctl hw.memsize: %w", err).
Do not create anonymous errors — always wrap a sentinel or a received error.
Check errors with errors.Is:
if errors.Is(err, errSMCRead) {
// handle SMC read failure
}
3. Test files
Test files (*_test.go) are exempt from these rules. They may use fmt.Errorf or errors.New freely to simulate error conditions in mocks and assertions.
Checklist
For every piece of code you write or modify:
- No
fmt.Errorf(...)orerrors.New(...)producing anonymous errors in production code - All packages declare their sentinels (
var errFoo = errors.New(...)) in the package'serrors.go - Errors are wrapped with
fmt.Errorf("...: %w", errSentinel)when adding context - New error scenarios have a corresponding sentinel
var
Установить errors в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл errors?
Review changed and surrounding code for error handling violations and fix them. Use when checking or fixing error conventions in the project: no dynamic errors, sentinel errors only.
Как установить скилл errors?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл errors запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic