본문으로 건너뛰기
Skillpedia
일반 코딩12k · #11523

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

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.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 세터는 누군가 null을 넘기면 깨집니다. 일반적인 호출이 항상 동작하도록 코드를 바꿔 주실 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI가 공개 진입점을 호출하는 모든 곳을 찾고, 자연스러운 호출이 동작을 깨는지 확인한 뒤, 규칙을 공유 코드로 옮깁니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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.
자주 묻는 질문

호출하는 한 곳만 고치나요?

아닙니다. 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬