--- name: add-useful-tests-to-under-tested-code description: "Code with few tests hides bugs that bite later. Your AI writes tests for normal, edge and failure cases. Use for: Add useful tests to under-tested code." --- # Add useful tests to under-tested code Code with few tests hides bugs that bite later. Your AI writes tests for normal, edge and failure cases. ## What you need from the user - The code you want tested, or access to your repo - How the code should behave, with a few examples - How your project runs its tests now ## What to give back New test files, a list of what each test checks and the command to run them. ## How to do the job Use the prompt below as your instructions. Ask the user for anything in [brackets] that they have not given you yet. Do not guess it. ```text Help me add useful tests to code that has few or none. Files or functions to test: [list paths] How they should behave, with examples: [describe] Test framework and how I run tests now: [for example, pytest or npm test] Things the tests must not touch (network, real databases): [list] 1. For each function, list the normal, edge and failure cases worth testing. 2. Write the tests as new files or a patch on a branch. Use fakes for outside services. 3. Make sure each test would fail if the code did the wrong thing. 4. Give me the exact command to run them, and mark any test you haven't run. If you're unsure how something should behave, ask me instead of guessing. Don't change the code under test, push or merge. I'll run the tests and review. ``` ## Rules - BotCurrent rates this job "Acts with your OK". Show what you will do and wait for a clear yes before each action. - Ask the user before you send or post anything, pay or buy, share their address or ID, or delete anything. - A test that copies today's behavior can lock in a bug. Check each expected value against what the code should do. - If something is unclear or missing, say so instead of filling the gap. ## Source From BotCurrent: https://botcurrent.com/cases/add-executable-tests-to-low-coverage-modules-77b91a914731/ Original report: https://openai.com/business/guides-and-resources/how-openai-uses-codex/ BotCurrent has not tested this skill. Check the result before you use it.