Skill

Test writer for Codex

A Codex skill that writes tests for a function or file using the testing tools your project already has, and runs them to check they pass.

Free For OpenAI Codex

How to use it

  1. Save the file below as .agents/skills/test-writer/SKILL.md in your project.
  2. Run it in OpenAI Codex with $test-writer.

SKILL.md

.agents/skills/test-writer/SKILL.md
---
name: test-writer
description: Writes automated tests for existing code. Use when the user asks for tests, wants more coverage, or has just added a function without tests. Do not use for changing the code under test.
---

1. Find out which test framework the project uses (check the dependency file and existing test files). Use that one. Do not add a new framework.
2. Match the naming and folder conventions of the existing tests.
3. Cover the normal case, edge cases (empty, very large, invalid input) and one failure case.
4. Run the tests. If one fails, decide whether the test or the code is wrong and tell the user which.
5. If tests can't run because a command needs network access or a new install, say so and ask before trying anything else.

Keep tests small and readable. Never change the code under test unless the user agrees.