Skip to content
Skillpedia
General coding12k · #11523

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.md

Copy 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

Use this skill to help me: https://github.com/trycompai/crm/blob/release/.agents/skills/pit-of-success/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

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

  1. 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.
  2. 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.
  3. 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.
  4. Delete bypasses and duplicate meanings. Replace local wrappers, parallel helper names, and comments that explain the trap with one shared implementation at the seam.
  5. 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

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills