clean-code-ts-react
БесплатноБез исполняемых скриптовНе проверенUse when writing, reviewing, or refactoring TypeScript or React code for craftsmanship — naming, function and component shape, error handling, data modeling…
от pproenca★ 231 звезда на GitHubОб этом скилле
Robert C. Martin (Uncle Bob) TypeScript 5.x + React 19 Best Practices
Craftsmanship principles from Robert C. Martin's Clean Code (2008), re-expressed for modern TypeScript and React. Contains 61 rules across 11 categories, prioritized by cognitive cost across a code change's lifetime. Examples use TS 5.x and React 19 idioms — but the rules are about timeless principles, not specific APIs.
What Makes This Skill Different
Three things set this apart from a generic clean-code copy:
- Modern idioms as vehicle. Examples use TS 5.x (
satisfies, branded types, discriminated unions,consttype parameters) and React 19 (function components, hooks,use(), Server Components where relevant). But the rule is always the principle, never the syntax. - "When NOT to apply" is first-class. Every rule has 2-3 concrete scenarios where the principle should bend — not generic disclaimers, real situations. Loop counters can be
i. Single-use code shouldn't be DRY. Some HOCs are unavoidable. - Meta category for principle conflicts. Category 11 names the most common tensions explicitly — DRY vs Single Responsibility, small functions vs deep modules (Ousterhout), type precision vs ergonomic APIs, tests as spec vs documentation. The mark of seniority is knowing which to bend.
When to Apply
Reference these guidelines when:
- Writing new TypeScript or React code and wanting craftsmanship feedback
- Reviewing a pull request for clarity, naming, or abstraction
- Refactoring existing code for readability or maintainability
- Designing function, hook, or component APIs
- Deciding whether to extract, abstract, or duplicate
- Resolving a tension between two clean-code rules (see Category 11)
Skip this skill and use:
reactfor React 19 API patterns (concurrent rendering, Server Components, ref-as-prop,useActionState,<Context>-as-provider)typescriptfor compiler performance, tsconfig tuning, type-system perfrefactorfor mechanical refactoring workflowstddfor the TDD workflow itself
Rule Categories by Priority
Order reflects cognitive cost across a change's lifetime (read → understand → modify → verify → ship → maintain). Earlier stages cascade — bad names taint every read.
| Priority | Category | Impact | Prefix | Rules |
|---|---|---|---|---|
| 1 | Meaningful Names | CRITICAL | name- |
8 |
| 2 | Functions, Components & Hooks | CRITICAL | func- |
8 |
| 3 | Self-Documentation (Types & Comments) | HIGH | doc- |
5 |
| 4 | Formatting (Beyond Prettier) | HIGH | fmt- |
4 |
| 5 | Error Handling | HIGH | err- |
7 |
| 6 | Data Shape & Immutability | MEDIUM-HIGH | data- |
6 |
| 7 | Boundaries | MEDIUM-HIGH | bound- |
4 |
| 8 | Composition over Inheritance | MEDIUM-HIGH | comp- |
6 |
| 9 | Tests | MEDIUM | test- |
5 |
| 10 | Emergence & Simple Design | MEDIUM | emerge- |
4 |
| 11 | Meta: When Principles Conflict | MEDIUM | meta- |
4 |
Total: 61 rules.
Quick Reference
1. Meaningful Names (CRITICAL)
name-intention-revealing— Use names that reveal intentname-avoid-disinformation— Avoid misleading namesname-meaningful-distinctions— Make meaningful distinctionsname-component-pascal-case— Components are PascalCase noun phrasesname-hook-use-prefix— Hooks areuseXverb phrasesname-handler-convention— Event handlers useonX/handleXname-boolean-predicate— Boolean variables useis/has/canname-types-pascal-case— Types and interfaces are PascalCase
2. Functions, Components & Hooks (CRITICAL)
func-small— Keep functions, components & hooks smallfunc-one-thing— Do one thingfunc-abstraction-level— One level of abstraction per functionfunc-minimize-arguments— Prefer object parameters over long listsfunc-no-side-effects— Avoid hidden side effects (especially in render)func-command-query-separation— Separate commands from queriesfunc-dry— DRY — until concepts divergefunc-custom-hook-extract— Extract custom hooks for reusable stateful logic
3. Self-Documentation: Types & Comments (HIGH)
doc-types-over-comments— Prefer types over commentsdoc-satisfies-narrows-with-check— Use `satis
Установить clean-code-ts-react в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл clean-code-ts-react?
Use when writing, reviewing, or refactoring TypeScript or React code for craftsmanship — naming, function and component shape, error handling, data modeling, tests, and abstraction. Translates Robert C. Martin's Clean Code principles into modern TS+React idioms (TS 5.x, React 19), with first-class "When NOT to apply" guidance and a Meta category for principle conflicts (DRY vs SRP, small functions vs deep modules, type safety vs ergonomics). Triggers on code review, refactoring for clarity, naming, function/component design, "is this clean?", "make this more readable", "right abstraction?" — even when the user doesn't say "clean code". Does NOT cover React-specific APIs (RSC, hooks API surface) — use the `react` skill. Does NOT cover TS compiler perf or tsconfig — use the `typescript` skill.
Как установить скилл clean-code-ts-react?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл clean-code-ts-react запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic