Coding
Browse our collection of 9 ready-to-use coding prompts
Prompt
Code Review Assistant
Review your code for security vulnerabilities, performance, and best practices.
Prompt
API Documentation Generator
Generate complete API endpoint docs with request/response schemas and examples.
Prompt
Unit Test Generator
Write a thorough unit test suite covering happy paths and edge cases.
Write a thorough unit test suite that validates correct behavior, guards against edge cases, and verifies error handling, producing tests that serve as living documentation of the function's contract. TESTING STRATEGY: 1. Understand the Function Contract - Analyze the function signature, parameters, return type, and side effects - Identify the implicit and explicit preconditions and postconditions - Determine what constitutes a "unit" here (pure function, method with dependencies, async operation, etc.) 2. Happy Path Tests - Test the primary use case with typical, realistic input - Test with multiple valid input variations to cover different code branches - Verify both the return value AND any side effects (state changes, calls to dependencies) - Test with minimum valid input and maximum valid input 3. Edge Case Tests - Boundary values: zero, one, empty collections, single-element collections, max values - Null, undefined, or missing optional parameters - Unicode, special characters, and extremely long strings if strings are accepted - Concurrent or repeated calls if the function has state - Type coercion boundaries if the language allows it - Empty objects, nested nulls, or partial data structures 4. Error Handling Tests - Invalid input types and out-of-range values - Missing required parameters - Dependency failures (network errors, database timeouts, file not found) - Verify the correct error type/message is thrown or returned - Ensure errors do not leave the system in an inconsistent state 5. Test Quality Principles - Each test should have a single, clear assertion focus (one logical concept per test) - Test names should describe the scenario and expected outcome in plain language - Use the Arrange-Act-Assert pattern consistently - Mock external dependencies; never test the framework or standard library - Tests must be independent and runnable in any order OUTPUT CONSTRAINTS: - Produce complete, runnable test code (not pseudocode) - Include all necessary imports, setup, teardown, and mock configuration - Use descriptive test names following the pattern: "should [expected behavior] when [condition]" - Add a brief comment above each test group explaining what aspect is being tested - If the function has dependencies that need mocking, set up mocks with realistic behavior - Target at minimum: 3 happy path tests, 3 edge case tests, 2 error handling tests FORMAT: [Complete test file with imports, setup, and organized test groups] // Group: Happy Path // Group: Edge Cases // Group: Error Handling --- MY INFO: Testing Framework: (required - e.g., Jest, pytest, JUnit, Go testing, Mocha) Function to Test: (required - include the full function code) Programming Language: (optional - can usually be inferred from the function) Dependencies to Mock: (optional - external services, databases, APIs the function calls) Specific Scenarios to Cover: (optional - any particular cases you want tested)
Prompt
Refactoring Assistant
Refactor code for readability, performance, or maintainability with explanations.
Agent
System Architecture Diagrammer
Generate a system architecture diagram in Mermaid from your stack description.