Спеціально для каналу Сашко пише код
Chapter 05 · The predictable shape

How to actually
create a skill.

Start with a clear, action-oriented description (this is what triggers it). Write a short body with concrete rules and at least one example. Link out to supporting files for anything long.

Example 01 · Component standards

Auto-attach on React components.

A focused skill that loads on .tsx files and teaches the agent your project's React component conventions — the exact shape Cursor's docs recommend for per-file-type rules.

---
name: react-component-standards
description: React component standards for frontend UI files. Use when
  creating or editing React components, presentational patterns, or
  anything under src/components.
globs: src/components/**/*.tsx, src/components/**/*.ts
alwaysApply: false
---

# React Component Guidelines

When writing or reviewing React components, enforce:

1. **Component type**: functional components only — no class components
2. **Props**: define a typed 'interface' at the top of the file
3. **Exports**: named exports only; never default-export components
4. **Styling**: Tailwind utility classes; avoid inline 'style={}' objects
5. **Server state**: use TanStack Query; never 'useEffect' + 'fetch'

## ExampleBad:  'export default function card(props: any) { ... }'Good: 'export function Card({ title, onSelect }: CardProps) { ... }'

@component-template.tsx
Example 02 · Custom hooks review

An agent-decided skill for hooks.

A different activation style — description-only so the agent loads it when it detects hook work. Different area: logic, not presentation. Enforces the rules-of-hooks and cleanup patterns.

---
name: review-react-hooks
description: When reviewing or writing React custom hooks — functions
  prefixed with 'use', files under src/hooks, or any code that calls
  useState, useEffect, useMemo, or useCallback.
---

# React Hooks Review

When reviewing React hooks, check for:

1. **Naming**: custom hooks must start with 'use' (e.g. 'useAuth', 'useCart')
2. **Rules of Hooks**: never call hooks inside loops, conditions, or nested functions
3. **Dependencies**: every value referenced inside 'useEffect'/'useMemo'/'useCallback' must appear in the deps array
4. **Cleanup**: any subscription, timer, or abort controller must return a cleanup function
5. **Return shape**: return a stable object or tuple — not a new reference on every render

## ExampleBad:  'useEffect(() => { fetchUser(id) }, [])'  // missing depGood: 'useEffect(() => { const c = new AbortController(); fetchUser(id, c.signal); return () => c.abort(); }, [id])'
Example 03 · Accessibility audit

A manual, user-invoked skill.

Auditing a component for accessibility is explicit, occasional work — so this skill has empty frontmatter and is invoked with @a11y-audit. Covers yet another area: compliance.

---
name: a11y-audit
description: Audits React components for WCAG 2.1 AA accessibility issues —
  semantic HTML, ARIA attributes, keyboard navigation, and color contrast.
  Use when the user asks for an accessibility review or types @a11y-audit.
---

# Accessibility Audit for React

When auditing a React component, verify:

1. **Semantic HTML**: use '<button>', '<nav>', '<main>' — never '<div onClick>' for interactive controls
2. **Keyboard support**: all interactive elements must be reachable by 'Tab' and activatable with 'Enter'/'Space'
3. **ARIA labels**: icon-only buttons need 'aria-label'; form fields need a '<label>' or 'aria-labelledby'
4. **Focus management**: visible focus outline; modals trap focus and return it on close
5. **Images**: every '<img>' has a meaningful 'alt' or 'alt=""' for decorative images

## ExampleBad:  '<div onClick={close}>×</div>'Good: '<button type="button" aria-label="Close dialog" onClick={close}>×</button>'
Four rules that ship

The shape that works.

Synthesized from Anthropic's best-practices docs and Ivan Seleznov's 650-trial study on Medium in 2026.

01

Write descriptions like search queries, not documentation

"React helper" is vague. "Use when reviewing React components for prop typing, naming, or Tailwind usage" is specific enough that semantic matching actually works.

02

Include explicit trigger phrases

Mention the file types, user intents, and keywords that should fire the skill.

03

Be "a little bit pushy"

Skills tend to under-trigger by default. Anthropic's own skill-creator docs recommend this — vague descriptions cause skills to never fire.

04

Third person, action-first

"Processes Excel files" — not "I can help with Excel." Matches how agents reason about tool choice.

Naming & organization

Kebab-case, verb-first.

review-react-components.mdc is better than react.mdc. Keep each skill single-purpose — Atlan's engineering team recommends 1–3 "always-on" rules maximum; everything else is auto-attach or agent-requested.

  • Coding standards — great as auto-attach on file globs
  • Project context — architecture + tech stack, CLAUDE.md/AGENTS.md under 60 lines
  • Framework-specific conventions — ideal auto-attach use case
  • Workflow steps — like commit hooks; better as deterministic scripts than skills
  • Testing patterns — fixture locations, mocking conventions
  • Comprehensive vs focused — monolithic 500-line skills underperform. Use progressive disclosure.