pit-of-success
하는 일
AI가 잘못 쓰일 수 있는 API 호출, 세터, props를 찾아 필요한 동작을 공유 코드로 옮기도록 안내합니다. 코드를 검토하거나 리팩터링하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓API, 세터 또는 컴포넌트 props에 자연스러운 호출이 빠질 수 있는 함정이 있을 때.
- ✓안전한 방법이 기본이 되도록 코드를 리팩터링할 때.
- ✓중복된 헬퍼나 래퍼를 하나의 공유 구현으로 바꾸고 싶을 때.
스킬 링크
https://github.com/trycompai/crm/blob/release/.agents/skills/pit-of-success/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 세터는 누군가 null을 넘기면 깨집니다. 일반적인 호출이 항상 동작하도록 코드를 바꿔 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI가 공개 진입점을 호출하는 모든 곳을 찾고, 자연스러운 호출이 동작을 깨는지 확인한 뒤, 규칙을 공유 코드로 옮깁니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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.
자주 묻는 질문
호출하는 한 곳만 고치나요?
아닙니다. API 자체가 잘못된 경우에는 한 호출부가 아니라 공유 지점을 고치라고 안내합니다.
어떤 순서로 수정하나요?
기존 API를 안전하게 만드는 것을 먼저 하고, 그다음 타입을 좁히고, API를 나눕니다. 헬퍼 추가는 마지막에 합니다.
수정이 제대로 됐는지 어떻게 확인하나요?
초점이 맞춰진 테스트나 타입 검사로 일반적인 호출이 이제 동작함을 보이고, 오래된 호출부가 남아 있지 않은지 검색으로 확인합니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 12k
- 순위
- #11523
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
ai-elements
12k에이전트가 대화, 메시지, 도구 표시, 프롬프트 입력을 위한 기성 컴포넌트로 AI 채팅 화면을 만들도록 돕습니다.
ai-sdk
12k에이전트가 Vercel AI SDK로 텍스트 생성, 스트리밍, 도구 호출, 에이전트를 포함한 AI 기능을 만들도록 돕습니다.
better-accessibility
12k에이전트가 키보드와 스크린 리더로도 사용할 수 있도록 인터페이스를 만들며, 포커스, 레이블, ARIA, 양식을 다루도록 돕습니다.
better-auth-best-practices
12k에이전트가 TypeScript 앱에서 문서에 나온 단계에 따라 Better Auth로 로그인, 세션, OAuth, 플러그인을 설정하도록 돕습니다.