Test writer

From hamzafarooq/multi-agent-course · View interactive version

Test writer is an AI agent skill from the GitHub repository hamzafarooq/multi-agent-course. Write unit tests for any function — happy path, edge cases, and error cases. Use when the user asks for tests, wants to add test coverage, or is practicing TDD.

How to use this skill

Skill file

Ask the user to share the function or code they want tests for.

Then write tests covering:

Tests for `[functionName]`

Testing framework: [detect from package.json — Jest, Vitest, pytest, etc. Ask if unclear]


Happy path

Test the expected behavior with valid inputs. One test per meaningful variation.

test('returns [expected] when given [input]', () => {
  // arrange
  // act
  // assert
})

Edge cases

Tests for boundary conditions and unusual but valid inputs:

Error cases

Tests that verify the function fails correctly:

Mock requirements

List any external dependencies (API calls, database queries, file system) that need mocking, with example mock setup.


Coverage target: Aim for all branches, not just lines. Flag any branch that is difficult to test and explain why.

Write tests that read like documentation — the test name should be a sentence explaining what the function does in that scenario.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.