Token导航 LogoToken导航TokenDH.com
开发操作浏览器github未标认证来源可访问许可证需确认审计通过

electric-debugging电气调试

Agent Skill

electric-debugging 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

672

周安装

28

GitHub Stars

10,132

下载量

224
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/electric-sql/electric --skill electric-debugging

简介

electric-debugging 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合围绕仓库状态和代码变更进行整理。

  • 适用于 Electric SQL 同步问题的调试和重试机制分析场景。
  • 提供 ShapeStream 配置、错误处理和状态机行为的可视化调试能力。
  • 安装命令:npx skills add https://github.com/electric-sql/electric --skill electric-debugging
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。

SKILL.md

This skill builds on electric-shapes and electric-proxy-auth. Read those first.

Electric — Debugging Sync Issues

Setup

Enable debug logging to see retry and state machine behavior:

import { ShapeStream, FetchError } from '@electric-sql/client'

const stream = new ShapeStream({
  url: '/api/todos',
  backoffOptions: {
    initialDelay: 1000,
    maxDelay: 32000,
    multiplier: 2,
    debug: true, // Logs retry attempts
  },
  onError: (error) => {
    if (error instanceof FetchError) {
      console.error(`Sync error: ${error.status} at ${error.url}`, error.json)
    }
    return {} // Always return {} to retry
  },
})

Core Patterns

Error retry behavior

ErrorAuto-retry?Action
5xx server errorsYes (exponential backoff)Wait and retry
429 rate limitYes (respects Retry-After)Wait and retry
Network errorsYes (exponential backoff)Wait and retry
4xx (non-429)NoCalls onError — return {} to retry manually
409 shape expiredYes (automatic reset)Client resets and refetches
MissingHeadersErrorNeverFix CORS/proxy — not retryable even if onError returns {}

Diagnosing MissingHeadersError

This error means Electric response headers (electric-offset, electric-handle) are being stripped, usually by CORS:

MissingHeadersError: This is often due to a proxy not setting CORS correctly
so that all Electric headers can be read by the client.

Fix: expose Electric headers in proxy CORS configuration:

headers.set(
  'Access-Control-Expose-Headers',
  'electric-offset, electric-handle, electric-schema, electric-cursor'
)

Diagnosing fast-loop detection

Console message: "Detected possible fast loop" with diagnostic info.

Cause: proxy/CDN cache key doesn't include handle and offset query params, so the client gets the same stale response repeatedly.

Fix: ensure your proxy/CDN includes all query parameters in its cache key.

For Vercel, add to vercel.json:

{
  "headers": [
    {
      "source": "/api/(.*)",
      "headers": [
        { "key": "CDN-Cache-Control", "value": "no-store" },
        { "key": "Vercel-CDN-Cache-Control", "value": "no-store" }
      ]
    }
  ]
}

Common Mistakes

HIGH Proxy or CDN not including query params in cache key

Wrong:

# nginx caching without query params in key
proxy_cache_key $scheme$host$uri;

Correct:

# Include query params (handle, offset) in cache key
proxy_cache_key $scheme$host$request_uri;

Fast-loop detection fires after 5 requests in 500ms at the same offset. The client auto-clears caches once, then applies backoff, then throws after 5 consecutive detections.

Source: packages/typescript-client/src/client.ts:929-1002

HIGH SSE responses buffered by proxy

Wrong:

location /v1/shape {
  proxy_pass http://electric:3000;
  # Default: proxy_buffering on — SSE responses delayed
}

Correct:

location /v1/shape {
  proxy_pass http://electric:3000;
  proxy_buffering off;
}

For Caddy:

reverse_proxy localhost:3000 {
  flush_interval -1
}

Nginx and Caddy buffer responses by default, causing long delays for SSE live updates. Disable buffering for Electric endpoints. Do NOT disable caching entirely — Electric uses cache headers for request collapsing.

Source: website/docs/guides/troubleshooting.md:69-109

MEDIUM Running 6+ shapes in local dev without HTTP/2

Wrong:

# Running Electric directly on localhost:3000
# With 7+ shapes, browser HTTP/1.1 queues all requests (6 connection limit)

Correct:

# Run Caddy as HTTP/2 proxy on host (not in Docker — Docker prevents HTTP/2)
caddy run --config - --adapter caddyfile <<EOF
localhost:3001 {
  reverse_proxy localhost:3000
}
EOF

Browser HTTP/1.1 limits to 6 TCP connections per origin. With many shapes, requests queue behind each other. Use Caddy as a local HTTP/2 proxy.

Source: website/docs/guides/troubleshooting.md:28-53

HIGH Leaving replication slot active when Electric is stopped

Wrong:

docker stop electric
# Replication slot retains WAL indefinitely — disk fills up

Correct:

docker stop electric

# Drop slot when stopping for extended periods
psql -c "SELECT pg_drop_replication_slot('electric_slot_default');"

# Or set a safety limit
psql -c "ALTER SYSTEM SET max_slot_wal_keep_size = '10GB';"
psql -c "SELECT pg_reload_conf();"

Replication slots retain WAL indefinitely when Electric is disconnected. Postgres disk fills up. Either drop the slot or set max_slot_wal_keep_size.

Source: website/docs/guides/troubleshooting.md:203-316

See also: electric-deployment/SKILL.md — Many sync issues stem from deployment configuration. See also: electric-shapes/SKILL.md — onError semantics and backoff behavior.

Version

Targets @electric-sql/client v1.5.10.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.36%
按下载量换算77

Claude

28.86%
按下载量换算65

Cursor

20.21%
按下载量换算45

Gemini CLI

9.93%
按下载量换算22

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills