💻 Coding Prompt
Gemini for SaaS Freelance Developers: Write Unit Tests to Onboard New Developers in Half the Time
Beginner-level strategies for SaaS Freelance Developers — reduce high bug rate in production through unit testing while optimizing database queries
The Prompt
You are a senior software engineer with 10 years of experience in SaaS product development, database query optimization, and writing testable code for freelance client handoffs. Help me write unit tests so I can onboard new developers in half the time.
My situation:
SaaS product type: [e.g., project management tool / invoicing platform / customer support dashboard]
Database query being optimized: [e.g., slow report generation query / user dashboard aggregation / search query on a large dataset]
High bug rate source: [e.g., query logic changes break downstream features with no test to catch it / edge cases in the query return incorrect data silently / no tests mean every change requires manual verification]
Current test coverage state: [e.g., zero tests / unit tests exist for utilities but not for database logic / tests exist but are not run in CI]
Freelance handoff constraint: [e.g., new developer takes over in 4 weeks / client team has junior developers with no testing experience / tests must be readable without documentation]
Tech stack: [e.g., Python with Pytest and SQLAlchemy / Node.js with Jest and Knex / Ruby with RSpec and ActiveRecord]
New developer onboarding goal: [e.g., new developer can run the test suite and understand what each function does within one day / tests replace the need for a lengthy handoff call]
Deliver:
A unit test suite for the database query module: write tests covering the happy path, 3 edge cases specific to the query being optimized, and 2 failure scenarios — with test names written as plain-English descriptions of what each test confirms
A mock database setup guide: show how to set up an in-memory or fixture-based test database that runs without a live connection — with the complete setup code and a comment explaining why this approach makes tests faster and more reliable for a freelance handoff
A test-as-documentation standard: rewrite the 3 most important test names so they function as documentation — a new developer reading only the test names understands what the function does, what the edge cases are, and what failure looks like
A query optimization test: write a performance test that measures the query execution time against a baseline and fails if the optimized query regresses — with the assertion logic and the baseline value explained for a beginner
A CI integration guide: define the steps to add the test suite to the CI pipeline so it runs automatically on every push — written for a developer who has never configured CI before, using the most common CI tool for the stated stack
A beginner test reading guide: a 1-page README section that explains how to read the test file — what each section means, how to run a single test, how to interpret a failure message, and how to add a new test following the existing pattern
A test maintenance protocol: define 3 situations that require updating a test — when the query logic changes, when a new edge case is discovered in production, and when the database schema changes — with the update procedure for each
A handoff validation checklist: 5 items the new developer confirms after running the test suite for the first time — suite passes with zero failures, mock database initializes correctly, CI pipeline is green, test names are understandable without context, and coverage report shows the query module is fully tested
Write the test names before writing the test logic — a test suite where every test name is a plain-English sentence about behavior is documentation that runs, and a new developer who reads it does not need a handoff call.
💡 How to use this prompt
- Start with output #3 — the test-as-documentation standard. For a freelance handoff, the fastest way to reduce onboarding time is not more documentation — it is a test suite where the test names tell the complete story of the codebase behavior. Rewrite the test names first and the rest of the onboarding material becomes secondary.
- The most common mistake for beginner-level freelancers writing handoff tests is testing implementation details rather than behavior. A test that checks whether a specific SQL string was called breaks every time the query is refactored. A test that confirms the correct records are returned survives every internal change that preserves the behavior.
- Gemini's real-time web access gives it an edge here — use it when current data or recent sources matter. For the final narrative polish, paste Gemini's research output into Claude for cleaner professional language.
Best Tools for This Prompt
🤖 Best AI Coding Tools for This Prompt
Tested & reviewed — run this prompt with the best AI tools
About This Coding AI Prompt
This free Coding prompt is designed for Gemini and works with any modern AI assistant including ChatGPT, Claude, Gemini, and more. Simply copy the prompt above, paste it into your preferred AI tool, and customize the bracketed sections to fit your specific needs.
Coding prompts like this one help you get better, more consistent results from AI tools. Instead of starting from scratch every time, you can use this tested prompt as a foundation and adapt it to your workflow. Browse more Coding prompts →