agentleFS
bestdeejay-designbestdeejay-design/agent-skills/skills/test-generator/SKILL.md

test-generator

Skill5 starsChanged 4 months agoMITView on GitHub

Генерация pytest-скелетов из Python-модуля по AST с ghostwriter-эвристикой значений аргументов (bool→True/False, int→0/-1/1, str→sample/пустая, list/dict→пустые, Optional→None). Скрипт test_gen.py парсит функции/async-функции через ast, пропускает приватные (_), генерирует @pytest.mark.parametrize с assert-заглушками. Включает референс по генерации тестов на TypeScript (ts-morph, *.test.ts) и Go (table-driven). Триггеры: 'generate tests', 'сгенерируй тесты', 'test skeleton', 'pytest скелет', 'покрытие тестами', 'unit tests для функций', 'тесты на функции', 'создать тесты'.",

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use git-doc-updater, git-precommit and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • u9401066Skill

    git-doc-updater

    Auto-check and update key documentation before Git commits to keep docs in sync with code. Triggers: docs, 文檔, 更新文檔, sync docs, release, 發布.

    Also in 3 projects that use this

  • u9401066Skill

    git-precommit

    Orchestrate pre-commit workflow including Memory Bank sync, README/CHANGELOG/ROADMAP updates. Triggers: GIT, gc, push, commit, 提交, 準備 commit, 要提交了, git commit, pre-commit, 推送.

    Also in 3 projects that use this

  • nilecuiSkill

    code-refactor

    Perform bulk code refactoring operations like renaming variables/functions across files, replacing patterns, and updating API calls. Use when users request renaming identifiers, replacing deprecated code patterns, updating method calls, or making consistent changes across multiple locations.

    Also in 3 projects that use this

  • AutumnsGroveSkill

    api-designer

    Design and document RESTful and GraphQL APIs with OpenAPI/Swagger specifications, authentication patterns, versioning strategies, and best practices. Use for: (1) Creating API specifications, (2) Designing REST endpoints, (3) GraphQL schema design, (4) API authentication and authorization, (5) API versioning strategies, (6) Documentation generation

    Also in 3 projects that use this

  • +7 more from u9401066

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 24
  2. Distinctive:

    Do NOT use when:

    line 30
  3. Distinctive:

    Do not treat generated tests as proof of correctness.

    line 78

“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Generator

Генерация pytest-скелетов из сигнатур функций: AST-парсинг + эвристика значений, готовый параметризованный тест-файл в stdout или файл.

Загружай этот скилл когда нужно создать стартовый pytest-набор для существующих функций или модуля. Скилл читает исходник, извлекает сигнатуры и генерирует @pytest.mark.parametrize-скелеты с разумными тестовыми значениями — остаётся лишь дописать assert-ожидания.

🎯 When to use

Use this skill when:

  • Нужны тесты для нового модуля, где покрытие начинается с пустого файла
  • Просят «сгенерируй тесты», «test skeleton», «покрой функциям»
  • Нужна быстрая заготовка parametrize-кейсов с типичными значениями
  • Хочешь перейти к TDD: сгенерируй красные скелеты и реализуй

Do NOT use when:

  • Нужны осмысленные ассерты под конкретную логику — скрипт даёт заглушки, логику пишешь сам
  • Тесты уже покрывают функции — файл-генератор всё перезапишет
  • Нужны моки/фикстуры вне модуля — это уровень pytest напрямую

📦 Files

  • SKILL.md — этот файл
  • scripts/test_gen.py — генератор из AST (Python 3 stdlib)
  • references/ — примеры и референс TS/Go (в будущих версиях)

🧰 Usage

# В stdout:
python3 skills/test-generator/scripts/test_gen.py --file path/to/module.py

# В файл (рядом с модулем):
python3 skills/test-generator/scripts/test_gen.py \
    --file path/to/module.py --out tests/test_module.py

⚙️ Эвристика значений аргументов

АннотацияЗначения
boolTrue, False
int0, -1, 1
float0.0, -1.5
str / text"sample", ""
list[...][]
tuple[...]()
dict[...]{}
Optional[...]None
иноезначение не подставляется → None-заглушка

Правила:

  • Функции, начинающиеся с _, пропускаются.
  • async def оборачивается в asyncio.run(...).
  • В генерируемом коде assert-заглушка: assert result is not None — допиши реальные ожидания.

✅ Definition of Done

  • Скрипт отработал: валидный pytest-файл в stdout или --out.
  • Сгенерированный код проходит python3 -c "import ast" (синтаксис корректный).
  • Значения аргументов соответствуют эвристикам (таблица выше).

Boundaries

  • Do not treat generated tests as proof of correctness; review assertions and run the real suite.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.