Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

smart-test

БесплатноБез исполняемых скриптовНе проверен

Intelligent test engineering skill with blast-radius lane system for fast CI. Use when creating tests (create), auditing test quality (audit), or optimizing…

sharkrebelот sharkrebel★ 94 звезды на GitHub

Об этом скилле

Smart Test Engineering Skill

Tests are not checkbox compliance. They are executable specifications of real behavior. Every test must earn its place. Every failure must be explained. Every skip must be justified.


ENTRY: COMMAND DISPATCH

When invoked, identify the sub-command from the user's message:

Command Trigger Action
/test create or tạo test / viết test Missing coverage, new feature, bug fix → Run CREATE PROTOCOL
/test audit or audit test / review test / tìm test rác Suspect tests, pre-refactor, CI cleanup → Run AUDIT PROTOCOL
/test optimize or tăng tốc CI / optimize CI CI too slow, expensive runner cost → Run OPTIMIZE PROTOCOL
/test optimize --ultra Need multiple competing strategies → Run ULTRA OPTIMIZE PROTOCOL

CREATE PROTOCOL: Build Coverage Around Real Behavior

Phase 1 — Scout First (Do Not Write Yet)

Before touching any test file, answer all five questions:

1. What behavior actually changed?
   → Trace the diff. Name the specific function, route, state transition, or contract.

2. What can break?
   → Think about callers, downstream consumers, edge cases, race conditions, error paths.

3. What tests already prove this?
   → Grep for existing coverage. Never duplicate proof.

4. What is the lowest-trust layer that can verify this?
   → Unit > Integration > E2E (prefer lower cost, lower trust level).

5. Do we need additional tests?
   → Only if a gap exists after answering 1–4.

Do not write a single test until you can answer all five.

Phase 2 — Test Architecture Rules

✅ Test behavior, not implementation.
   - WRONG: "calls saveToDatabase() with payload"
   - RIGHT:  "persists user after successful registration"

✅ Test at the right trust level.
   - Unit:        Pure functions, isolated logic, single responsibility
   - Integration: Cross-module contracts, DB writes, API responses
   - E2E:         Critical user journeys ONLY (≤10% of total test count)

✅ Each test must be independently falsifiable.
   - One reason to fail. One assertion of real consequence.

✅ Test names describe behavior, not code.
   - WRONG: test_calculateTax_line42
   - RIGHT:  "returns 0 tax for tax-exempt organizations"

Phase 3 — Blast Radius Lane Assignment

Every new test MUST be tagged with its blast-radius lane:

# Lane taxonomy
LANE: core        → Domain logic, critical business rules (always runs in CI)
LANE: api         → HTTP routes, controllers, API contracts
LANE: db          → Migrations, queries, data integrity
LANE: ui          → Components, rendering, interactions
LANE: integration → Cross-service, queue consumers, webhooks
LANE: e2e         → Full user journeys (runs on release candidates ONLY)

# Tag format (add to test file header or describe block):
@blast-radius: core
@blast-radius: api, db

Rule: If you can't assign a lane, the test scope is too broad — split it.

Phase 4 — Write (RED → GREEN)

  • Write minimal test code that proves the behavior.
  • Run it. Watch it fail first (RED).
  • Only then implement the fix (GREEN).
  • Do not refactor production code while making tests pass.

AUDIT PROTOCOL: Find Tests That Lie, Hide, or Waste

Step 1 — Scan for Problem Categories

❌ DEAD:      Skipped indefinitely with no ticket/issue reference.
              → grep: .skip, xit, it.todo, @Ignore with no linked issue

❌ HOLLOW:    Always passes, even when the code is broken.
              → No assertions, assertion on constants, unconditional mock returns

❌ REDUNDANT: Multiple tests proving the exact same thing.
              → Cluster by behavior. Keep one. Delete the rest.

❌ OVERFIT:   Breaks when you rename a variable or extract a helper.
              → Tests internal state, method call counts, exact implementation shape

❌ OUTDATED:  Tests for code that was deleted or behavior that changed.
              → Importing non-existent modules, testing deprecated API shapes

❌ SLOW/DEAD: Takes >3s and has zero unique coverage vs lower-level tests.
              → Measure. If no unique value, delete or convert to unit.

Step 2 — Verdict Per Test

Verdict Meaning Action
🔴 DELETE No behavior value, misleading, or duplicate Remove + commit message explains why
🟡 REWRITE Good intent, bad form Fix assertion, scope, or name
🟢 KEEP Proves real, unique behavior at right layer No action
⏸ ESCALATE Skip/ignore needs human decision Flag with full context

Step 3 — Never Silently Delete

For every deleted test, write a one-liner in the commit:

test: remove test_X — hollow (asserted mock return, not real behavior)
test: remove test_Y — redundant with test_Z which covers same contract

OPTIMIZE PROTOCOL: Make CI Fast Based on Evidence, Not Vibes

Step 1 — Measure Before Touching Anything

# Jest
npx jest --verbose 2>&1 | grep -E "PASS|FAIL|●" | sort -t ' '
Полный SKILL.md на GitHub

Установить smart-test в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Glob
Grep
Bash

FAQ

Что делает скилл smart-test?

Intelligent test engineering skill with blast-radius lane system for fast CI. Use when creating tests (create), auditing test quality (audit), or optimizing CI speed (optimize). Enforces behavior-first reasoning: never test implementation, never comment out tests without explaining why, never skip without permission. Triggers on: 'viết test', 'tạo test', 'kiểm thử', 'test coverage', 'audit test', 'xóa test', 'tìm test rác', 'cải thiện CI', 'tăng tốc CI', 'blast radius test'.

Как установить скилл smart-test?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл smart-test запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить smart-test с