code-quality · zernie — скилл для Claude Code: качество и типы TS/JS
Скилл для рефакторинга TypeScript и JavaScript: приводит типы в порядок, убирает невозможные состояния и разделяет логику с вводом-выводом.
npx skills add zernie/vigiles --skill code-quality -a claude-codeЧто делает code-quality
Скилл включается, когда вы просите почистить, улучшить или ужесточить код либо публичный API. Он не ищет баги — для этого в наборе есть отдельная команда /code-review. Внутри пять техник, и под каждую свой файл-справочник с принципом, примером «до/после» и списком запахов, по которым техника опознаётся.
Техники такие: разбирать данные на границе вместо повторной проверки примитивов; строить типы так, чтобы незаконное состояние просто не компилировалось; закрывать switch и цепочки if по union проверкой исчерпываемости; выносить чистые функции и подставлять швы для spawn, fetch, fs; держать форму публичных экспортов. Справочники читаются по одному — под тот код, что перед вами, а не все пять сразу.
Порядок работы задан жёстко: сначала назвать решение вслух, потом менять тип и дать tsc показать все места вызова, починить их и прогнать тесты. Одна техника за раз, тесты остаются зелёными. Абстракция ради ещё не существующего различия — это как раз тот баг, который скилл должен предотвращать, поэтому правило трёх и YAGNI здесь работают против вас.
Какие задачи решает
- убрать повторную проверку одного и того же примитива в разных местах
- сделать невозможную комбинацию полей некомпилируемой
- закрыть
switchпо union проверкой исчерпываемости - отделить чистую логику от
fetchиfsи покрыть её тестами - сузить публичный экспорт до внятной формы
Примеры запросов агенту
- отрефактори модуль
orders, примени parse-don't-validate на границе - убери boolean-флаги в типе
Job— сделай незаконные состояния невыразимыми - пройдись по публичным экспортам пакета и подтяни их форму
Как установить code-quality
1Через Skills CLI (Vercel)
npx skills add zernie/vigiles --skill code-quality -a claude-code2Вручную: положить файлы
~/.claude/skills/code-quality/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/code-quality/
1Через Skills CLI (Vercel)
npx skills add zernie/vigiles --skill code-quality -a codex2Вручную: положить файлы
.agents/skills/code-quality/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add zernie/vigiles --skill code-quality -a cursor2Вручную: положить файлы
.cursor/skills/code-quality/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install zernie/vigiles code-quality2Вручную: положить файлы
.github/skills/code-quality/SKILL.md1Через Skills CLI (Vercel)
npx skills add zernie/vigiles --skill code-quality -a gemini-cli2Командой платформы
gemini skills install https://github.com/zernie/vigiles --path .claude/skills/code-qualityВручную: положить файлы
.devin/skills/code-quality/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add zernie/vigiles --skill code-quality -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о code-quality
Как установить code-quality в Claude?
Выполните npx skills add zernie/vigiles --skill code-quality -a claude-code. Скилл окажется в ~/.claude/skills/code-quality/SKILL.md.
Что делает code-quality?
Применяет к TypeScript и JavaScript набор техник, завязанных на типы: разбор на границе, невыразимость незаконных состояний, исчерпывающий разбор union, чистые функции с подставными швами и аккуратный публичный API.
Чем code-quality отличается от code-review?
Первый занимается формой и дизайном кода, второй ищет баги. Скилл прямо говорит, что охота за ошибками — не его задача.
Исходный текст
SKILL.md · MIT
--- name: code-quality description: Improve the quality and type-safety of TypeScript/JavaScript being written or refactored — parse-don't-validate, make-illegal-states-irrepresentable, exhaustive matching, pure-function/IO separation, and public-API hygiene. Use when asked to refactor, clean up, improve, harden, or review the design/quality of code or an API. NOT for hunting bugs (that's /code-review) and NOT for vigiles's own spec/lint rules. --- Apply a small set of **type-driven** quality techniques when writing or refactoring code. Each technique has its own reference — the principle, a real before/after from this repo, and the smells to grep for. **Read the reference(s) that match the code in front of you; don't apply all five blindly.** ## When this fires A request to _refactor / clean up / improve / harden / tighten_ code or an API — or when you're about to write a new module/type/public export and want it right the first time. Not a bug hunt (use `/code-review`). ## The techniques — read the matching reference | Smell in front of you | Technique | Reference | | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------- | | a magic `0` / `""` / `-1`; the same primitive re-validated at many sites; `"x" in obj` repeated | **Parse, don't validate** | [`references/parse-dont-validate.md`](references/parse-dont-validate.md) | | a field that's always `""`; boolean-flag soup; a sentinel standing in for "absent"; an impossible combo that still compiles | **Make illegal states irrepresentable** | [`references/make-illegal-states-irrepresentable.md`](references/make-illegal-states-irrepresentable.md) | | a `switch`/`if`-chain on a union with no exhaustiveness guard | **Exhaustive matching** | [`references/exhaustive-matching.md`](references/exhaustive-matching.md) | | logic tangled with IO (`spawn`/`fetch`/`fs`); a function that's hard to test | **Pure functions + injected seams** | [`references/pure-functions.md`](references/pure-functions.md) | | a public export with a fuzzy shape; a `string` that means an enum; a leaked internal helper | **Public-API quality** | [`references/public-api-quality.md`](references/public-api-quality.md) | ## How to apply 1. **Name the decision out loud** before you change the shape — what illegal state it forbids, where the parse boundary sits (the `surface-architecture-decisions` reflex). A quality change the reviewer can't see is churn. 2. **One technique at a time, tests stay green.** Change the type, let `tsc` show you every call site, fix them, run the tests. Never batch five refactors into one unreviewable diff. 3. **Don't over-abstract** (rule-of-three / YAGNI). A tagged union for 3 real variants is good; an abstraction for a difference that doesn't exist yet is the bug this skill is supposed to prevent. 4. **Prefer the strongest option the DECIDABILITY allows** — a type that can't express the bad state beats a runtime check that hopes to catch it; but a runtime guard at a boundary beats nothing when the input is genuinely dynamic. ## Guardrails - **Quality only, not correctness.** This skill improves shape/design; it does not hunt for bugs — that's `/code-review`. - **Every change removes a real failure mode.** If you can't name the bug the new shape prevents, don't make the change. - **Keep the public surface small.** A new `export` is a contract (see the public-API reference); don't widen it to make a refactor convenient.
© zernie · MIT · zernie/vigiles
Похожие скиллы
Всё по теме «Код-ревью и рефакторинг» →Сначала — code-quality от других авторов.