pit-of-success
What it does
It guides the AI to find API calls, setters and props that could be misused, then move the required behavior into the shared code. It is for developers reviewing or refactoring code.
When to use it
- ✓When an API, setter or component prop has a trap that a natural call can fall into.
- ✓When you refactor code so the safe path becomes the default path.
- ✓When you want duplicate helpers or wrappers replaced by one shared implementation.
Skill link
https://github.com/trycompai/crm/blob/release/.agents/skills/pit-of-success/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“This setter breaks when someone passes null. Can you change the code so the normal call always works?”
5 new skills a week. 1 minute to read.
How it works
The AI finds every caller of the public entry point, checks whether the obvious call breaks behavior and then moves the rule into the shared code.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Pit of Success
Make misuse hard and the obvious call correct.
Steps
- Find the public seam being used: exported function, hook return value, setter, component prop, route body, schema, or command. Then search every caller of that seam. Done when you know the natural call a future maintainer would write.
- Run the footgun test: “If someone does the obvious thing without knowing the hidden helper or convention, does behavior break?” Examples:
setSelection(null)should mean the product’s normal clear behavior; a schema should reject states the UI never wants; a prop should not require sibling props in the right combo. - Move the invariant into the seam. Prefer, in order:
- make the existing API do the safe thing,
- narrow the type/schema so bad states cannot be represented,
- rename/split the API so the dangerous path is explicit,
- only then add a helper, and only if all natural callers use it.
- Delete bypasses and duplicate meanings. Replace local wrappers, parallel helper names, and comments that explain the trap with one shared implementation at the seam.
- Prove the pit with one check: a focused test or type/schema assertion showing the obvious call now preserves behavior, plus a grep confirming no caller still uses the old footgun.
Rules
- Do not fix only the named callsite. If the seam is wrong, fix the seam.
- Do not rely on “remember to call this helper first” when callers can still call the raw API.
- Do not add comments as a substitute for making misuse impossible or obvious.
- Keep the diff boring: one invariant, one owner, no speculative abstraction.
- If compatibility prevents changing the seam, name the dangerous API accordingly and expose a safe default API beside it.
FAQ
Does it only fix one call site?
No. When the API itself is wrong, the skill says to fix the shared seam rather than one caller.
What order of fixes does it prefer?
It prefers making the existing API safe first, then narrowing types, then splitting APIs, and adds helpers last.
How does it prove the fix?
It uses a focused test or type check to show the obvious call now works, plus a search to confirm no old callers remain.
Details
Original description by the author
Review or refactor code so the correct behavior is the default path; use when APIs, setters, hooks, helpers, or component props have footguns where a natural call bypasses required semantics.
repo: trycompai/crm
Popularity
- GitHub stars
- 12k
- Ranking position
- #11523
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
ai-elements
12kHelps your agent build AI chat interfaces with ready-made components for conversations, messages, tool displays and prompt inputs.
ai-sdk
12kHelps your agent build AI features with the Vercel AI SDK, including text generation, streaming, tool calling and agents.
better-accessibility
12kHelps your agent make interfaces usable with a keyboard and screen readers, covering focus, labels, ARIA and forms.
better-auth-best-practices
12kHelps your agent set up Better Auth for login, sessions, OAuth and plugins in a TypeScript app, following its documented steps.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.