This prompt is for QA leads and test architects who need to move beyond happy-path acceptance criteria and systematically discover edge cases, boundary conditions, and error states from a feature specification. The job-to-be-done is translating a product requirement or user story into a prioritized, actionable catalog of edge cases that can be immediately converted into Gherkin scenarios or automated test scripts. The ideal user has a written feature specification—even a rough one—and needs to ensure the test plan covers null inputs, timeouts, concurrency races, malformed payloads, and resource exhaustion before development begins.
Prompt
Edge Case Discovery Prompt for Acceptance Criteria

When to Use This Prompt
Define the job, reader, and constraints for the Edge Case Discovery Prompt for Acceptance Criteria.
Use this prompt when you have a stable-enough feature spec and need to front-load quality by identifying failure modes early. It is particularly effective during sprint planning, refinement sessions, or test plan reviews where the team is asking 'what could go wrong?' The prompt requires a [FEATURE_SPECIFICATION] input that describes the intended behavior, actors, system boundaries, and any known constraints. You should also provide a [FAILURE_CATEGORIES] list to guide the model toward the types of edge cases that matter for your domain—such as authentication bypass, data validation edge cases, or third-party dependency failures. Do not use this prompt when the specification is still in flux or when you need creative brainstorming rather than structured, coverage-aware analysis. It is not a replacement for exploratory testing; it is a systematic discovery tool that complements human intuition.
The output is a prioritized edge case catalog, not a final test suite. Each edge case includes preconditions, expected behavior, and a Gherkin-ready scenario outline, but you will still need to review the results for relevance, fill in implementation-specific details, and validate that the model did not hallucinate system behaviors not described in the specification. For high-risk domains—such as financial transactions, healthcare data handling, or access control—always require human review of the generated edge cases before they enter your test management system. The next step after using this prompt is to feed the discovered edge cases into your Gherkin scenario generation workflow and your test automation framework.
Use Case Fit
Where this prompt works and where it does not. Use it to surface hidden edge cases before they become production incidents.
Good Fit: Structured Feature Specs
Use when: you have a written feature specification, user story, or PRD with defined inputs, outputs, and constraints. The prompt excels at systematically deriving boundary conditions, error states, and concurrency scenarios from explicit requirements. Guardrail: always provide the full spec text as [INPUT] rather than paraphrasing; missing details lead to generic edge cases.
Bad Fit: Undefined or Oral Requirements
Avoid when: the feature exists only as a verbal description or a one-line ticket. Without explicit constraints, the model hallucinates plausible-sounding but irrelevant edge cases. Guardrail: require a written spec of at least 200 words before invoking this prompt. If one doesn't exist, use the Ambiguous Requirement Clarification Prompt first.
Required Inputs
What you must provide: a feature specification with functional requirements, input/output schemas, user roles, and system boundaries. Optional but high-value inputs include API contracts, state machine diagrams, and known failure modes. Guardrail: missing role definitions produce incomplete authorization edge cases; missing schema constraints skip entire boundary-value categories.
Operational Risk: False Confidence
What to watch: the prompt produces a prioritized catalog that looks comprehensive but may miss domain-specific failure modes unique to your system. Teams sometimes treat the output as exhaustive. Guardrail: always run a manual coverage review against your known failure categories. Pair this prompt with the Race Condition Scenario Generation Prompt for concurrency-heavy systems.
Operational Risk: Over-Specification
What to watch: the prompt can generate edge cases for constraints that don't exist in your system, especially when the spec is ambiguous. This wastes QA cycles on irrelevant tests. Guardrail: require a senior engineer or QA lead to triage the output within one sprint. Discard any edge case that doesn't map to a real system boundary or constraint.
Integration: Automation Pipeline
What to watch: the Gherkin-ready scenario outlines still need human refinement before test automation. Directly feeding output into test frameworks produces flaky tests. Guardrail: treat the output as a discovery artifact, not executable code. Use the Test Automation Feasibility Prompt to assess which scenarios are automation-ready before scripting.
Copy-Ready Prompt Template
A reusable prompt template for discovering edge cases from a feature specification, with placeholders for inputs, constraints, and output schema.
The following prompt template is designed to be copied directly into your AI harness, notebook, or prompt management system. It accepts a feature specification and produces a prioritized catalog of edge cases, boundary conditions, and failure modes. Each placeholder in square brackets must be replaced with concrete values before execution. The template assumes you have a feature specification ready and want structured, testable edge cases rather than freeform brainstorming.
textYou are a QA architect specializing in edge case discovery. Your task is to analyze a feature specification and produce a comprehensive, prioritized catalog of edge cases, boundary conditions, error states, and unexpected input scenarios. ## INPUT Feature Specification: [FEATURE_SPECIFICATION] Additional Context (optional): [ADDITIONAL_CONTEXT] ## CONSTRAINTS - Risk Level: [RISK_LEVEL] (choose: low, medium, high, critical) - Target Test Layer: [TEST_LAYER] (choose: unit, integration, end-to-end, all) - Maximum Edge Cases: [MAX_EDGE_CASES] - Required Coverage Categories: [COVERAGE_CATEGORIES] (e.g., null inputs, timeouts, concurrency, authorization, data validation, dependency failure) ## OUTPUT SCHEMA Return a JSON object with the following structure: { "feature_summary": "One-sentence summary of the feature under analysis", "coverage_categories_analyzed": ["category1", "category2"], "edge_cases": [ { "id": "EC-001", "category": "boundary_value | error_state | concurrency | authorization | null_handling | timeout | data_validation | dependency_failure | state_transition | other", "priority": "critical | high | medium | low", "title": "Short descriptive title", "preconditions": "System state and inputs required to trigger this edge case", "trigger": "Specific action, input, or condition that activates the edge case", "expected_behavior": "What the system should do when this edge case occurs", "failure_impact": "What happens if this edge case is not handled correctly", "gherkin_outline": "Given [precondition] When [trigger] Then [expected outcome]", "test_layer": "unit | integration | e2e", "related_requirements": ["Reference to spec section or requirement ID"] } ], "coverage_gaps": ["Categories or scenarios not covered by the specification"], "recommended_test_approach": "Brief guidance on how to prioritize and execute these edge cases" } ## INSTRUCTIONS 1. Read the feature specification carefully. Identify all system boundaries, external dependencies, user inputs, and state changes. 2. For each coverage category listed in [COVERAGE_CATEGORIES], generate at least one edge case if applicable. 3. Prioritize edge cases by: (a) likelihood of occurrence, (b) severity of failure impact, (c) detectability in testing. 4. Ensure every edge case has a clear, executable Gherkin outline. 5. Flag any coverage gaps where the specification is silent on behavior that should be defined. 6. If [RISK_LEVEL] is "critical" or "high", include additional scrutiny on security, data integrity, and availability edge cases. 7. Do not invent requirements. Base all edge cases on the provided specification and reasonable inferences from common failure patterns in [TEST_LAYER] testing. ## EXAMPLES Example edge case for a login feature: { "id": "EC-001", "category": "concurrency", "priority": "high", "title": "Simultaneous login attempts from same account", "preconditions": "User account exists with valid credentials. No active session.", "trigger": "Two login requests with correct credentials arrive within 100ms of each other", "expected_behavior": "Both requests succeed or one succeeds and the other receives a session-conflict error. No duplicate sessions created.", "failure_impact": "Duplicate sessions may cause data corruption, inconsistent state, or security audit failures.", "gherkin_outline": "Given a user account with no active session When two valid login requests arrive simultaneously Then exactly one session is created and the second request receives a clear error", "test_layer": "integration", "related_requirements": ["REQ-AUTH-003", "REQ-SESSION-001"] }
To adapt this template, replace each placeholder with values specific to your feature and testing context. For [COVERAGE_CATEGORIES], select from the list provided or add domain-specific categories such as "rate limiting," "data residency," or "accessibility." If you do not have a [MAX_EDGE_CASES] limit, set it to a reasonable number like 20 to keep the output focused. The [RISK_LEVEL] placeholder controls how aggressively the prompt searches for severe failure modes—use "critical" for payment systems, authentication, or data deletion features. After generating edge cases, validate the output against your specification to ensure no fabricated requirements were introduced. For high-risk features, always have a human QA lead review the edge case catalog before committing it to your test plan.
Prompt Variables
Required inputs for the Edge Case Discovery Prompt. Each placeholder must be populated before execution to ensure reliable, coverage-aware edge case generation.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[FEATURE_SPECIFICATION] | The complete feature description, user story, or requirement document to analyze for edge cases | As a user, I want to reset my password so that I can regain access to my account. The reset link expires after 15 minutes. | Must be non-empty and contain at least one actor, action, and constraint. Reject if input is fewer than 50 characters or contains only placeholder text. |
[SYSTEM_BOUNDARIES] | A list of external dependencies, APIs, databases, and services the feature interacts with | Auth service, email delivery API (SendGrid), user database (PostgreSQL), rate limiter | Must be a structured list. Each boundary should map to at least one edge case category in the output. Null allowed if feature has no external dependencies. |
[CONSTRAINT_DEFINITIONS] | Explicit numeric, temporal, or logical constraints from the specification | Password reset link TTL: 15 minutes; Max reset attempts per hour: 5; Minimum password length: 8 characters | Parse each constraint for type correctness: numeric ranges must have min/max, temporal constraints must have units, logical constraints must have boolean conditions. Reject malformed constraints. |
[ACTOR_ROLES] | The user roles, personas, or system actors that interact with the feature | Unauthenticated user, authenticated user, admin, support agent, system scheduler | Each role must be a distinct noun. Validate that at least one role is present. Output must include edge cases for each role where applicable. |
[FAILURE_CATEGORIES] | A predefined taxonomy of failure modes to guide edge case discovery | Null inputs, timeout, concurrency, invalid state, authorization bypass, resource exhaustion, data corruption | Must be a non-empty list. Validate against a known taxonomy: each category must match a recognized failure class. Default to standard categories if not provided. |
[COVERAGE_TARGET] | The minimum number of edge cases or coverage percentage required | At least 20 edge cases covering all failure categories; minimum 80% boundary value coverage | Must be a measurable target: integer count or percentage. Validate that output meets or exceeds this target. Retry with adjusted temperature if coverage is insufficient. |
[OUTPUT_FORMAT] | The desired structure for edge case documentation | Gherkin scenario outlines with tags, priority, precondition, steps, and expected result fields | Must specify a valid schema. Validate output against this schema: check for required fields, tag format, and Gherkin keyword correctness. Repair or retry on schema violation. |
Implementation Harness Notes
How to wire the edge case discovery prompt into a QA pipeline with validation, retries, and human review gates.
This prompt is designed to be called programmatically as part of a feature review workflow, not as a one-off chat interaction. The application layer should supply the feature specification, known constraints, and a risk profile. The model returns a structured JSON catalog of edge cases, each with a priority, precondition, expected behavior, and a Gherkin-ready scenario outline. The primary integration point is after a feature spec is drafted but before test case authoring begins, ensuring that boundary conditions and failure modes are explicitly documented.
To wire this into an application, construct a request that injects the [FEATURE_SPECIFICATION], [KNOWN_CONSTRAINTS], and [RISK_PROFILE] into the prompt template. The [OUTPUT_SCHEMA] placeholder should be replaced with a strict JSON schema definition that your application can validate. After receiving the model response, run a structural validator to confirm every edge case object has the required fields (id, priority, category, precondition, expected_behavior, gherkin_outline). If validation fails, implement a retry loop (maximum 2 retries) that feeds the validation errors back into the prompt as additional context. For high-risk domains such as payments or access control, route any edge cases marked priority: critical to a human review queue before they are accepted into the test plan.
Choose a model with strong structured output capabilities and a context window large enough to hold the full specification plus the output schema. GPT-4o or Claude 3.5 Sonnet are suitable defaults. Log every prompt version, input hash, and output for auditability. The most common production failure mode is the model omitting entire failure categories (e.g., concurrency or timeout scenarios). Mitigate this by including a [COVERAGE_CHECKLIST] in the prompt that explicitly lists required categories, and add a post-processing step that flags any missing categories for manual review. Do not use this prompt for safety-critical systems without a human-in-the-loop approval step on the final edge case catalog.
Common Failure Modes
Edge case discovery prompts fail in predictable ways. Here are the most common failure modes and how to guard against them before they reach your test suite.
Happy-Path Bias in Edge Case Generation
What to watch: The model generates edge cases that are really just variations of the happy path—slightly different valid inputs, minor boundary tweaks, or cosmetic error states. True edge cases like null propagation, resource exhaustion, or ordering violations are missing. This happens because the prompt implicitly anchors on the specification's success scenarios. Guardrail: Explicitly require coverage across a fixed taxonomy of failure categories (null/missing inputs, timeouts, concurrency, malformed payloads, dependency failures, resource limits). Validate output against this taxonomy before accepting results.
Unverifiable Expected Behavior
What to watch: Generated edge cases describe expected behavior in vague terms like 'system should handle gracefully' or 'appropriate error message displayed' without specifying exact error codes, response bodies, log signals, or observable state changes. These scenarios cannot be automated or verified. Guardrail: Require each edge case to include a concrete, measurable expected outcome—specific error codes, exact field values in error responses, required log entries, or state machine position after the event. Add a post-generation validation step that rejects scenarios without machine-verifiable assertions.
Missing Precondition Chains
What to watch: Edge cases describe failure triggers without specifying the system state required to reach that failure point. For example, a race condition scenario might describe concurrent writes without specifying the initial database state, isolation level, or transaction boundaries. Testers cannot reproduce these scenarios. Guardrail: Require each edge case to include explicit preconditions as a structured block—system state, data setup, configuration values, and any prerequisite actions. Use a schema that makes preconditions a required field, and validate that every scenario has at least one non-trivial precondition.
Coverage Illusion from Surface Variety
What to watch: The model generates many edge cases that look different but test the same underlying failure mode. For example, five scenarios about invalid input formats that all exercise the same validation layer, while zero scenarios cover timeout behavior or dependency failure. The count looks good but coverage is hollow. Guardrail: Map generated edge cases to a coverage matrix of failure categories (input validation, authentication, authorization, resource limits, concurrency, external dependencies, data integrity, observability). Flag categories with zero scenarios and re-prompt specifically for uncovered areas.
Specification Leakage into Edge Cases
What to watch: The model generates edge cases that assume implementation details from the specification are correct, missing edge cases that arise when those assumptions break. For example, if the spec says 'system validates email format,' the model might generate edge cases around email validation but miss edge cases where the validation service itself is unavailable. Guardrail: Add a constraint requiring edge cases that assume each external dependency, service, or assumption in the specification can fail independently. Require at least one edge case per external dependency that exercises its unavailability or degraded state.
Priority Inversion in Edge Case Catalog
What to watch: The model generates a flat list of edge cases without risk-based prioritization, mixing critical security edge cases with cosmetic boundary conditions. Teams either waste time testing low-impact scenarios or miss high-risk ones because they're buried in the list. Guardrail: Require each edge case to include a risk score based on likelihood and impact. Structure the output so high-risk scenarios appear first. Add a post-generation check that verifies risk distribution is not uniform—if every scenario has the same priority, the prioritization is broken.
Evaluation Rubric
Use this rubric to evaluate the quality of edge case catalogs produced by the prompt. Each criterion targets a specific failure mode common in automated test design.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Edge Case Completeness | Output covers at least 5 of the 7 common failure categories (null, timeout, concurrency, boundary, auth, data integrity, dependency failure) | Catalog focuses only on obvious input boundaries and ignores system-level or environmental failures | Manual review of category coverage against the input specification |
Precondition Validity | Every edge case includes a specific, reproducible precondition that is not a restatement of the trigger | Precondition field contains generic text like 'system is running' or repeats the trigger description | Parse precondition field; check for concrete state descriptions (e.g., 'database connection pool exhausted') |
Expected Behavior Specificity | Expected behavior describes a concrete system response (error code, message, state change, or timeout) rather than a vague outcome | Expected behavior uses phrases like 'handles gracefully' or 'appropriate error' without specifying the exact mechanism | Schema check for [ERROR_CODE], [HTTP_STATUS], or [STATE_TRANSITION] tokens in the expected behavior field |
Gherkin Scenario Executability | Generated Gherkin outlines contain distinct Given/When/Then clauses that can be directly translated into automation steps | Gherkin steps mix preconditions and triggers in the same clause or omit the Then step entirely | Parse output for Given/When/Then structure; validate each clause contains a single, actionable statement |
Priority Justification | Each edge case includes a priority rating (P0-P3) with a risk rationale tied to user impact or data loss potential | Priority is assigned without explanation or all items are marked P0 without differentiation | Check that [PRIORITY] field is not null and [RATIONALE] field references user impact, data integrity, or SLA breach |
False Positive Avoidance | Catalog does not include edge cases that are impossible given the system architecture (e.g., testing SQL injection on a NoSQL-only endpoint) | Output includes generic security or failure scenarios that do not match the input system context | Cross-reference edge case triggers with the [SYSTEM_ARCHITECTURE] input; flag mismatches for human review |
Traceability to Source | Each edge case references the specific requirement, API endpoint, or user story line that motivated it | Edge cases appear disconnected from the input specification with no source mapping | Check for [SOURCE_REF] field populated with a line number, story ID, or endpoint path from the input |
Output Schema Conformance | All required fields ([ID], [TITLE], [CATEGORY], [PRECONDITION], [TRIGGER], [EXPECTED_BEHAVIOR], [PRIORITY], [GHERKIN_OUTLINE]) are present and non-null | Output is missing fields, contains null values for required fields, or adds unstructured commentary outside the schema | Automated JSON schema validation against the expected output contract |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single feature spec and lighter validation. Replace the structured JSON output schema with a simpler markdown checklist to speed up iteration. Drop the coverage matrix and focus on generating 10-15 edge cases across the most common failure categories (null inputs, empty strings, max-length boundaries).
Watch for
- The model may skip entire failure categories unless you explicitly enumerate them in [FAILURE_CATEGORIES]
- Without schema enforcement, edge case descriptions may drift into prose instead of structured preconditions
- Concurrency and race condition edge cases are often missed when the spec describes only sequential behavior

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us