Agent Skillstrycompai/crm › pit-of-success

pit-of-success

GitHub

旨在重构代码以消除 API 和组件的潜在陷阱,确保正确行为成为默认路径。通过识别公共接口、测试误用场景并将不变量移入接口层,使错误使用变得困难,提升代码安全性和可维护性。

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

Trigger Scenarios

发现 API 或组件存在易被误用的陷阱 需要重构代码以提高默认行为的安全性

Install

npx skills add trycompai/crm --skill pit-of-success -g -y
More Options

Non-standard path

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

Use without installing

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.

Version History

  • c26a08d Current 2026-08-08 08:04

Same Skill Collection

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

Metadata

Files
0
Version
14cd220
Hash
f9d943c7
Indexed
2026-08-08 08:04

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-13 07:09
浙ICP备14020137号-1 $お客様$