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

test-generator

Skill6 starsChanged 3 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 для функций', 'тесты на функции', 'создать тесты'.",

25 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use refactor-advisor, log-analyzer and 2 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.
  • aidankaokaoSkill

    refactor-advisor

    分析程式碼的重構機會,給出有優先順序的建議,但不直接改寫程式碼。當使用者說「這段程式碼怎麼改比較好」、「幫我分析重構方向」、「這樣寫有什麼問題」、「refactor」、「技術債」時觸發。

    Also in 3 projects that use this

  • nek1987Skill

    log-analyzer

    Parse and analyze application logs to identify errors, patterns, and insights.

    Also in 3 projects that use this

  • JeffallanSkill

    security-reviewer

    Identifies security vulnerabilities, generates structured audit reports with severity ratings, and provides actionable remediation guidance. Use when conducting security audits, reviewing code for vulnerabilities, or analyzing infrastructure security. Invoke for SAST scans, penetration testing, DevSecOps practices, cloud security reviews, dependency audits, secrets scanning, or compliance checks. Produces vulnerability reports, prioritized recommendations, and compliance checklists.

    Also in 3 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 3 projects that use this

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 15 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 15 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.