Claudecodeintermediate

Write Unit Tests for a Function

Act as a test-driven developer. Write unit tests using [TEST FRAMEWORK, e.g. PHPUnit, Jest or pytest] for the function below. Function: [PASTE FUNCTION] Cover normal cases, edge cases, invalid inputs and error handling. Use descriptive test names, keep each test focused on one behaviour, and add a comment above each group. List any cases you could not test and what extra information you would need.
Open in Claude

Updated Nov 22, 2026 · Copied 0 times

Tip

Add a failing test first when fixing a bug so it never returns.

Advertisement

More prompts

ChatGPT code

Debug an Error Message Step by Step

You are a senior developer helping me debug. Language and framework: [LANGUAGE / FRAMEWORK]. Error message: [PASTE ERROR]. Relevant code: […

Claude code

Explain Code Line by Line

Act as a patient programming mentor. Explain the code below to a [BEGINNER / INTERMEDIATE] developer. Language: [LANGUAGE]. Code: [PASTE CO…

ChatGPT code

SQL Query from Plain English

Act as a database expert. Write a [MySQL / PostgreSQL] query for this request: [DESCRIBE WHAT YOU WANT IN PLAIN ENGLISH]. Tables and column…

ChatGPT code

PHP MySQL CRUD Helper with PDO

You are a PHP 8 developer. Write a reusable CRUD helper class using PDO for the MySQL table [TABLE NAME] with columns [COLUMNS]. Include me…