Przejdź do treści
Biblioteka skilli
Programowanie · Testowanie

write-tests

/write-tests

Generuje testy jednostkowe i integracyjne dla wskazanego pliku lub funkcji: wykrywa framework, trzyma się istniejących wzorców i pokrywa ścieżkę główną, przypadki brzegowe, błędy i asynchroniczność.

Licencja
MIT
Ostatnia zmiana repozytorium
02.05.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 02.05.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Generuje testy jednostkowe i integracyjne dla wskazanego pliku lub funkcji: wykrywa framework, trzyma się istniejących wzorców i pokrywa ścieżkę główną, przypadki brzegowe, błędy i asynchroniczność.

Argumenty

/write-tests [file or function to test]
Oryginalny opis (EN)

Generates comprehensive unit and integration tests for a specified file or function. Auto-detects the test framework, follows existing patterns, and covers happy path, edge cases, error conditions, and async behavior. Use when adding tests to untested code or TDD-ing a new module.

Jak działa

  1. Detect Project Test Environment
  2. Instructions
Sekcje z nagłówków SKILL.md, w oryginale · 90 linii, 496 słów
Podgląd SKILL.md
---
name: write-tests
description: "Generates comprehensive unit and integration tests for a specified file or function. Auto-detects the test framework, follows existing patterns, and covers happy path, edge cases, error conditions, and async behavior. Use when adding tests to untested code or TDD-ing a new module."
argument-hint: "[file or function to test]"
allowed-tools: Read, Glob, Grep, Bash, Write, Edit
---

# Write Tests

## Detect Project Test Environment

### Package/Project Files
!`ls package.json pytest.ini pyproject.toml setup.cfg tox.ini go.mod Cargo.toml *.csproj *.sln Gemfile build.gradle pom.xml mix.exs deno.json 2>/dev/null`

### Existing Tests
!`find . -type f \( -name "*.test.*" -o -name "*.spec.*" -o -name "test_*" -o -name "*_test.*" -o -name "*_spec.*" -o -name "*Test.*" -o -name "*Spec.*" \) -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/vendor/*" 2>/dev/null | head -20`

### Test Config
!`cat jest.config.* vitest.config.* pytest.ini pyproject.toml setup.cfg .rspec 2>/dev/null | head -50`

---

## Instructions

### Step 1: Analyze the Target
1. Read the file or function to be tested
2. Identify all public APIs, functions, methods, and classes
3. Map out the code paths: conditionals, loops, error throws, early returns
4. Identify external dependencies that need mocking

### Step 2: Determine Test Framework
Based on the detected project files:
- **JavaScript/TypeScript**: Jest, Vitest, Mocha, or Playwright (check package.json)
- **Python**: pytest, unittest (check pyproject.toml, pytest.ini)
- **Go**: standard `testing` package
- **Rust**: built-in `#[cfg(test)]` module
- **C#/.NET**: xUnit, NUnit, or MSTest
- **Ruby**: RSpec or Minitest
- **Java**: JUnit 5 or TestNG
- **Elixir**: ExUnit

### Step 3: Follow Existing Patterns
- Find the nearest existing test file for a similar module
- Match the structure: describe/it, test classes, test functions
- Match the mocking approach: jest.mock, unittest.mock, testify, etc.
- Match the assertion style: expect, assert, should
- Match the file naming convention and directory placement

### Step 4: Generate Tests
Write tests covering ALL of the following categories:

#### Happy Path
- Normal inputs produce expected outputs
- Standard use cases work correctly
- Return values and side effects are verified

#### Edge Cases
- Empty inputs (null, undefined, empty string, empty array, zero)
- Boundary values (min, max, off-by-one)
- Unicode and special characters where relevant
- Large inputs (performance boundary)

#### Error Conditions
- Invalid inputs produce appropriate errors
- Thrown exceptions match expected types and messages
- Error callbacks/handlers are invoked correctly
- Graceful degradation for partial failures

#### Async Behavior (if applicable)
- Promises resolve/reject correctly
- Async/await error handling
- Concurrent operations
- Timeout and cancellation

#### Mocking
- Mock external dependencies at module boundaries
- Verify mock calls (called with correct args, correct number of times)
- Reset mocks between tests
- Do NOT mock the unit under test

### Step 5: Test Quality Rules
- One assertion concept per test (multiple asserts OK if testing one thing)
- Test names are full English sentences describing the scenario
- Use `beforeEach`/`setUp` for shared setup; `afterEach`/`tearDown` for cleanup
- Tests must be deterministic — no random data, no time-dependent assertions
- Tests must be independent — no shared mutable state between tests

### Step 6: Output
Generate a complete, ready-to-save test file with:
- A header comment explaining what is tested
- All necessary imports
- Properly structured test suites
- The target coverage goal (aim for >80%)

Place the file following the project's test directory convention.

Wersje

RepozytoriumWynikLicencja
Ta strona · viknesh20-20/claude-code-tool-kit90MIT
onsi/biloba100MIT
runwield/runwield100MIT
dzhng/jevgrep100MIT
lukedj78/dev-flow100MIT
dzhng/skills100MIT
rowansci/rowan-python100MIT
yaohuangguan/agent-playbook100MIT
microsoft/semantic-link-labs100MIT

Migawka bazy z 13.11.2026 · wersja paczki eaf4d98ce909 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100writing-tests
    Analizuje istniejący kod i pisze testy jednostkowe i integracyjne: wykrywa framework testowy, znajduje nieprzetestowane ścieżki i generuje mocki, przypadki brzegowe i asercje.
  • 100test-writer
    Pisze testy jednostkowe dla dowolnej funkcji: ścieżka szczęśliwa, przypadki brzegowe i błędy, także w praktyce TDD.
  • 100testing
    Tworzy i prowadzi testy jednostkowe oraz integracyjne: wykrywa framework, trzyma się konwencji projektu i uruchamia pętlę poprawek.
  • 100generate-tests
    Generuje testy dla pliku, modułu lub komponentu po rozpoznaniu frameworka i konwencji projektu, w tym testy jednostkowe, integracyjne i brzegowe.
  • 100test-generator
    Pisze testy jednostkowe i integracyjne dla istniejącego kodu: ścieżki poprawne, błędy i wartości graniczne, w stylu projektu.
  • 90test-gen
    Generuje testy dla kodu bez pokrycia: ścieżkę szczęśliwą, przypadki brzegowe i obsługę błędów.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.