Agent Skillstrycompai/crm › pit-of-success

pit-of-success

GitHub

指导如何重构API、Hook或组件,使正确用法成为默认路径,消除误用陷阱。通过识别公共接口、运行脚坑测试、将不变量移入接口及删除绕过逻辑,确保调用者无需额外知识即可安全使用。

.agents/skills/pit-of-success/SKILL.md trycompai/crm

触发场景

代码存在易被误用的API设计 需要消除开发中的隐性约定和陷阱 重构以提高接口的安全性和易用性

安装

npx skills add trycompai/crm --skill pit-of-success -g -y
更多选项

非标准路径

npx skills add https://github.com/trycompai/crm/tree/release/.agents/skills/pit-of-success -g -y

不安装直接使用

npx skills use trycompai/crm@pit-of-success

指定 Agent (Claude Code)

npx skills add trycompai/crm --skill pit-of-success -a claude-code -g -y

安装 repo 全部 skill

npx skills add trycompai/crm --all -g -y

预览 repo 内 skill

npx skills add trycompai/crm --list

SKILL.md

Frontmatter
{
    "name": "pit-of-success",
    "description": "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.",
    "user-invocable": true
}

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.

版本历史

  • c26a08d 当前 2026-08-08 08:04

同 Skill 集合

.agents/skills/ai-elements/SKILL.md
.agents/skills/better-auth-best-practices/SKILL.md
.agents/skills/better-colors/SKILL.md
.agents/skills/better-interface/SKILL.md
.agents/skills/better-ui/SKILL.md
.agents/skills/better-writing/SKILL.md
.agents/skills/code-refactor-review/SKILL.md
.agents/skills/create-draft-pr/SKILL.md
.agents/skills/diffs/SKILL.md
.agents/skills/eve/SKILL.md
.agents/skills/ga-pr/SKILL.md
.agents/skills/ga/SKILL.md
.agents/skills/gh-stack/SKILL.md
.agents/skills/install-anti-slop/SKILL.md
.agents/skills/nestjs-best-practices/SKILL.md
.agents/skills/no-use-effect/SKILL.md
.agents/skills/nuqs/SKILL.md
.agents/skills/posthog-instrumentation/SKILL.md
.agents/skills/prepare-branch-context/SKILL.md
.agents/skills/prisma-database-setup/SKILL.md
.agents/skills/shadcn/SKILL.md
.agents/skills/skill-creator/SKILL.md
.agents/skills/turborepo/SKILL.md
.agents/skills/typescript-advanced-types/SKILL.md
.agents/skills/ux-flow-plan/SKILL.md
.agents/skills/vercel-composition-patterns/SKILL.md
.agents/skills/vercel-react-best-practices/SKILL.md
.agents/skills/web-design-guidelines/SKILL.md
.agents/skills/zero-tech-debt/SKILL.md
.agents/skills/ai-sdk/SKILL.md
.agents/skills/better-accessibility/SKILL.md
.agents/skills/better-layout/SKILL.md
.agents/skills/better-typography/SKILL.md
.agents/skills/nestjs-trpc/SKILL.md
.agents/skills/seo-audit/SKILL.md

元信息

文件数
0
版本
6d4793d
Hash
f9d943c7
收录时间
2026-08-08 08:04

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-30 05:54
浙ICP备14020137号-1 $访客地图$