Token导航 LogoToken导航

Agent Skill · 研究检索

error-boundaries(误差边界)

error-boundaries 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

error-boundaries 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证为 MIT,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 46,597。

总安装 774周安装 31GitHub Stars 10下载 250核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:error-boundaries(误差边界)
来源仓库:https://github.com/yanko-belov/code-craft
仓库路径:skills/error-boundaries
安装命令:
npx skills add https://github.com/yanko-belov/code-craft --skill error-boundaries
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/yanko-belov/code-craft --skill error-boundaries

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

在架构边界设置错误捕获点,防止级联故障并实现优雅降级处理。适用于 Codex、Claude、Cursor、Gemini CLI 中设计高可用系统架构。强调不应随机散布 try/catch,而应在组件间、服务调用层等关键位置设置边界。使用前需识别系统边界,避免过度捕获掩盖真实问题或降低调试效率。

error-boundaries 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/error-boundaries

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/yanko-belov/code-craft --skill error-boundarie…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

error-boundaries 怎么安装?

在终端执行 npx skills add https://github.com/yanko-belov/code-craft --skill error-boundaries。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

error-boundaries 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

error-boundaries 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/yanko-belov/code-craft --skill error-boundaries;npx skills add yanko-belov/code-craft --skill "error-boundaries" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

error-boundaries 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

error-boundaries 用的人多吗?

公开数据是累计安装 774 次,近一周安装 31 次,下载 250 次,GitHub 10 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

error-boundaries 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
error-boundaries

误差边界 · 本页

77410执行命令MIT有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Error Boundaries

Overview

Catch errors at logical boundaries, not random points in the call stack.

Error boundaries are strategic catch points that prevent cascading failures while enabling graceful degradation. Place them at architectural boundaries—not scattered throughout business logic.

When to Use

  • Designing application architecture
  • Deciding where try/catch belongs
  • Preventing one failure from crashing everything
  • Implementing graceful degradation
  • Isolating components from each other

The Iron Rule

NEVER scatter try/catch randomly. Place catches at ARCHITECTURAL BOUNDARIES only.

No exceptions:

  • Not for "defensive programming"
  • Not for "safety wrapper"
  • Not for "just in case"
  • Not for "the function might throw"

Boundaries are intentional. Random catches hide bugs.

What Is a Boundary?

Boundaries are points where context changes:

┌─────────────────────────────────────────────────────────────┐
│                         ENTRY BOUNDARIES                     │
│  HTTP Request → [BOUNDARY] → Application                    │
│  Message Queue → [BOUNDARY] → Handler                       │
│  CLI Command → [BOUNDARY] → Execution                       │
│  Cron Job → [BOUNDARY] → Task                               │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│                       INTERNAL BOUNDARIES                    │
│  Application → [BOUNDARY] → External API                    │
│  Business Logic → [BOUNDARY] → Database                     │
│  Core → [BOUNDARY] → Third-party Library                    │
│  Parent Component → [BOUNDARY] → Child Component            │
└─────────────────────────────────────────────────────────────┘

Strategic Boundary Placement

Entry Boundary: HTTP Controller

// ✅ CORRECT: Top-level error middleware
app.use(errorMiddleware);

function errorMiddleware(
  error: Error,
  req: Request,
  res: Response,
  next: NextFunction
) {
  // This is THE boundary between HTTP and application

  if (error instanceof ValidationError) {
    return res.status(400).json({ error: error.message, fields: error.fields });
  }

  if (error instanceof NotFoundError) {
    return res.status(404).json({ error: error.message });
  }

  if (error instanceof UnauthorizedError) {
    return res.status(401).json({ error: 'Unauthorized' });
  }

  // Log unknown errors, return generic response
  logger.error('Unhandled error', { error, request: req.path });
  return res.status(500).json({ error: 'Internal server error' });
}

// ❌ WRONG: try/catch in every controller
async function getUser(req: Request, res: Response) {
  try {
    const user = await userService.findById(req.params.id);
    res.json(user);
  } catch (error) {
    // Scattered catch - duplicated across all controllers
    res.status(500).json({ error: 'Failed' });
  }
}

// ✅ CORRECT: Let errors propagate to middleware
async function getUser(req: Request, res: Response) {
  const user = await userService.findById(req.params.id);
  res.json(user);
  // Errors propagate to errorMiddleware
}

Internal Boundary: External Service Adapter

// ✅ CORRECT: Boundary between your code and external service
class PaymentGatewayAdapter {
  async charge(amount: number, token: string): Promise<ChargeResult> {
    try {
      // External call - this is a boundary
      const response = await this.stripeClient.charges.create({
        amount,
        source: token,
      });
      return this.mapToChargeResult(response);
    } catch (error) {
      // Translate external error to domain error
      if (error instanceof Stripe.CardError) {
        throw new PaymentDeclinedError(error.message, error.code);
      }
      if (error instanceof Stripe.RateLimitError) {
        throw new PaymentServiceUnavailableError('Rate limited');
      }
      if (error instanceof Stripe.APIConnectionError) {
        throw new PaymentServiceUnavailableError('Connection failed');
      }
      throw new PaymentError('Unexpected payment error', { cause: error });
    }
  }
}

// ❌ WRONG: Let Stripe errors leak into business logic
// ❌ WRONG: Catch in OrderService instead of adapter

UI Boundary: React Error Boundary

// ✅ CORRECT: Component-level error isolation
class ErrorBoundary extends React.Component<Props, State> {
  state = { hasError: false, error: null };

  static getDerivedStateFromError(error: Error) {
    return { hasError: true, error };
  }

  componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
    // Log to monitoring service
    errorService.report(error, errorInfo);
  }

  render() {
    if (this.state.hasError) {
      return this.props.fallback || <DefaultErrorUI />;
    }
    return this.props.children;
  }
}

// Usage: Isolate features from each other
function App() {
  return (
    <Layout>
      <ErrorBoundary fallback={<DashboardError />}>
        <Dashboard />
      </ErrorBoundary>

      <ErrorBoundary fallback={<SidebarError />}>
        <Sidebar />
      </ErrorBoundary>

      {/* Sidebar error doesn't crash Dashboard */}
    </Layout>
  );
}

The Boundary Checklist

Before adding try/catch, verify:

QuestionIf No...
Is this a context transition point?Don't catch here
Would catching prevent meaningful propagation?Don't catch here
Can I translate to a meaningful domain error?Don't catch here
Is there a specific recovery action?Don't catch here
Does the boundary change ownership?Don't catch here

Correct Propagation Pattern

Let errors propagate through business logic:

// ✅ CORRECT: No random catches in service layer
class OrderService {
  async createOrder(data: OrderData): Promise<Order> {
    // Validate (may throw ValidationError)
    this.validator.validate(data);

    // Get user (may throw NotFoundError)
    const user = await this.userRepo.findById(data.userId);

    // Check business rules (may throw BusinessRuleError)
    this.rules.assertCanCreateOrder(user, data);

    // Process payment (may throw PaymentError from adapter)
    const payment = await this.paymentAdapter.charge(data.amount, user.paymentToken);

    // Create order (may throw DatabaseError from repo)
    const order = await this.orderRepo.create({
      ...data,
      paymentId: payment.id,
    });

    return order;
    // ALL errors propagate to controller boundary
  }
}

// ❌ WRONG: Defensive try/catch in service
class OrderService {
  async createOrder(data: OrderData): Promise<Order | null> {
    try {
      // ... same logic ...
      return order;
    } catch (error) {
      logger.error('Order creation failed', error);
      return null;  // Lost context, hidden failure
    }
  }
}

Graceful Degradation at Boundaries

Boundaries can provide fallbacks:

// ✅ CORRECT: Graceful degradation at recommendation boundary
class ProductPage {
  async load(productId: string) {
    // Core data - must succeed
    const product = await this.productService.getById(productId);

    // Recommendations - can fail gracefully
    let recommendations: Product[] = [];
    try {
      recommendations = await this.recommendationService.getFor(productId);
    } catch (error) {
      // Log but don't fail the page
      logger.warn('Recommendations unavailable', { productId, error });
      // Empty recommendations is acceptable fallback
    }

    return { product, recommendations };
  }
}

Key distinction: This is a boundary between "required" and "optional" features. It's NOT random defensive programming—it's intentional graceful degradation.

Pressure Resistance Protocol

1. "Wrap Everything in Try/Catch for Safety"

Pressure: "Be defensive, catch all errors"

Response: Scattered catches hide bugs and prevent proper handling at boundaries. Errors propagate for a reason.

Action: Remove interior catches. Handle at boundaries only.

2. "The Function Might Throw"

Pressure: "I should catch just in case"

Response: That's what boundaries are for. Business logic shouldn't know about error handling.

Action: Let it throw. Boundary will catch.

3. "I Want to Add Context to Errors"

Pressure: "Catch, add info, re-throw"

Response: Only if you're adding genuinely useful context. Most catch-and-rethrow just adds noise.

Action: Only wrap if context is truly lost otherwise. Usually it isn't.

4. "Each Component Should Handle Its Errors"

Pressure: "Encapsulation means local handling"

Response: Components should THROW appropriate errors. CATCHING is for boundaries.

Action: Component throws. Boundary catches. Separation of concerns.

Red Flags - STOP and Reconsider

If you notice ANY of these, remove the catch:

  • try/catch in pure business logic functions
  • Catching and re-throwing without translation
  • try/catch that just logs and continues
  • Empty catch blocks
  • Catch in every method of a class
  • try/catch for "defensive programming"
  • Catching errors you can't meaningfully handle

All of these mean: Let the error propagate to a real boundary.

Boundary Inventory

Map your application's boundaries:

// Document where boundaries exist
const BOUNDARIES = {
  // Entry points
  HTTP: 'errorMiddleware in app.ts',
  GraphQL: 'formatError in apollo.ts',
  MessageQueue: 'errorHandler in consumer.ts',
  CronJobs: 'wrapWithErrorHandling in scheduler.ts',

  // Internal boundaries
  ExternalAPIs: [
    'PaymentGatewayAdapter',
    'EmailServiceAdapter',
    'SearchServiceAdapter',
  ],

  // UI boundaries
  React: 'ErrorBoundary components per feature',

  // Optional/degradable features
  Degradable: [
    'RecommendationService (fallback: empty)',
    'AnalyticsService (fallback: skip)',
  ],
};

Common Rationalizations (All Invalid)

ExcuseReality
"Defensive programming is good"Defensive = validate inputs. Not = scatter catches.
"Catch errors where they occur"Catch at boundaries. Throw where they occur.
"Add context with catch-rethrow"Usually adds noise. Boundaries have context.
"Prevent cascading failures"Boundaries prevent cascades. Random catches hide bugs.
"Component independence"Components throw. Boundaries catch. Still independent.
"Safety wrapper"Wrappers hide failures. Fail fast instead.

Quick Reference

LocationAction
HTTP middleware✅ Catch and translate to responses
Message handler✅ Catch, ack/nack, log
External adapter✅ Catch and translate to domain errors
React error boundary✅ Catch and show fallback UI
Service method❌ Let errors propagate
Repository method❌ Let errors propagate (unless wrapping DB errors)
Utility function❌ Let errors propagate
Pure business logic❌ Let errors propagate

The Bottom Line

Boundaries are architectural. Catches are strategic.

Place try/catch at context transitions: HTTP entry, external adapters, UI component isolation, optional feature degradation. Never in business logic. Let errors propagate to boundaries where they can be translated, logged, and handled appropriately.

平台分布

Codex

27.64%
按下载量换算69

Claude Code

20.01%
按下载量换算50

windsurf

17.78%
按下载量换算44

Antigravity

11%
按下载量换算28

trae

8.34%
按下载量换算21

OpenCode

3.23%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/yanko-belov/code-craft --skill error-boundaries;npx skills add yanko-belov/code-craft --skill "error-boundaries" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills