edge-case-discovery
Systematically identifies edge cases and boundary conditions for any function, API, or user flow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Systematically identifies edge cases and boundary conditions for any function, API, or user flow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Runs a systematic checklist review on any code diff or file, covering correctness, security, performance, and readability.
Writes a high-quality CLAUDE.md, .cursorrules, or .windsurfrules file that gives a coding agent the right project context, conventions, and constraints to work effectively.
Designs an eval suite for an LLM agent or pipeline including success metrics, trajectory scoring, LLM-as-judge setup, and regression test cases.
Designs a hybrid retrieval pipeline combining dense vector search and BM25 sparse search with reciprocal rank fusion, and explains when to use each configuration.
Converts a workflow description into a LangGraph node/edge graph with typed state, conditional routing, and human-in-the-loop checkpoints.
Audits an AI application for unnecessary token spend and recommends prompt caching, model routing, and token reduction techniques to cut costs.
| name | Edge Case Discovery |
| description | Systematically identifies edge cases and boundary conditions for any function, API, or user flow. |
| category | coding |
| tags | ["testing","edge-cases","qa","boundary-testing"] |
| author | simplyutils |
This skill directs the agent to systematically work through a function, API endpoint, or user flow and enumerate all edge cases and boundary conditions that could cause incorrect behavior, errors, or security issues. It applies a structured checklist across multiple dimensions (data types, boundary values, state, concurrency, authorization) and outputs a prioritized list of cases to test or guard against.
Use this before writing tests, during code review, when designing a new feature, or when a production bug makes you wonder "what else could go wrong here."
Copy this file to .agents/skills/edge-case-discovery/SKILL.md in your project root.
Then ask:
transferFunds function."POST /api/orders endpoint using the Edge Case Discovery skill."Provide the function signature, the code, or a description of the flow.
Add the instructions below to your .cursorrules or paste them into the Cursor AI pane before sharing the function or flow you want analyzed.
Paste the function or flow description and ask Codex to follow the instructions below to generate the edge case list.
When asked to discover edge cases, apply the following checklist systematically. Not every dimension applies to every input — skip the ones that clearly don't apply and note why.
For every numeric input or value in the function/flow:
For every string input:
"")" ", "\t", "\n")' OR 1=1 --<script>alert(1)</script>"null", "undefined", "true", "123"For every collection input:
[], {})null where an object is expectedundefined where a value is expectednull explicitly## Edge Cases for [Function/Endpoint/Flow]
### Critical (must handle — will cause data loss, security issue, or crash)
1. [Edge case] — [Why it's critical] — [What currently happens / what should happen]
### High (should handle — causes incorrect behavior or poor UX)
1. [Edge case] — [Expected behavior]
### Medium (nice to handle — minor issues or uncommon paths)
1. [Edge case] — [Expected behavior]
### Out of scope / acceptable to ignore
1. [Edge case] — [Why it's acceptable to not handle]
### Suggested test cases
[List the top 5–7 cases to write as unit/integration tests, in order of priority]
Input to Agent:
"Use the Edge Case Discovery skill on this function:
async function transferFunds(fromAccountId: string, toAccountId: string, amount: number) { const from = await Account.findById(fromAccountId); const to = await Account.findById(toAccountId); from.balance -= amount; to.balance += amount; await from.save(); await to.save(); } ```"
Output from Agent:
Edge Cases for
transferFundsCritical
amountis negative — Caller passes-100, which silently reverses the transfer direction. Should throw a validation error.fromAccountId === toAccountId— Transferring to the same account: balance unchanged but operation succeeds silently. May indicate a bug in the caller.- Insufficient balance —
from.balancegoes negative. No guard exists. Should check balance before deducting.- Race condition on concurrent transfers — Two simultaneous transfers from the same account can both read the same balance and both succeed, causing a negative balance. Requires a database transaction with row-level locking.
from.save()succeeds butto.save()fails — Money is deducted from sender but never credited to receiver. The whole operation must be wrapped in a database transaction that rolls back on failure.High
fromAccountIdortoAccountIdnot found —Account.findByIdreturnsnull, andfrom.balancethrowsCannot read properties of null. Add existence checks.amountis0— Technically valid but likely a bug in the caller. Consider throwing a validation error.amountisInfinityorNaN— JavaScript will not throw; balance becomesInfinityorNaNsilently.Suggested test cases
- Transfer with insufficient balance → expect error thrown, balances unchanged
- Transfer to self → expect error thrown
- Transfer with negative amount → expect validation error
- Either account not found → expect error thrown, no balance changes
to.save()throws → expectfrombalance is rolled back