Token导航 LogoToken导航

Agent Skill · 研究检索

ring%3adev-goroutine-leak-testing(ring%3adev goroutine 泄漏测试)

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

ring%3adev-goroutine-leak-testing 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,暂无第三方扫描结果,按安装量在研究检索类的 73,675 个 Skill 里排第 55,093。

总安装 490周安装 20GitHub Stars 180下载 158核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:ring%3adev-goroutine-leak-testing(ring%3adev goroutine 泄漏测试)
来源仓库:https://github.com/lerianstudio/ring
仓库路径:skills/ring%3Adev-goroutine-leak-testing
安装命令:
npx skills add https://github.com/lerianstudio/ring --skill ring:dev-goroutine-leak-testing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/lerianstudio/ring --skill ring:dev-goroutine-leak-testing

这个 Skill 是做什么的

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

用于辅助测试设计、自动化测试、用例整理和回归验证,适合检测并发资源泄漏。支持生成 Goroutine 生命周期监控代码。需确认项目使用 Go 语言及测试框架后再应用。通过 GitHub 仓库获取技能定义,需结合原始 README 确认具体用法。

ring%3adev-goroutine-leak-testing 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/ring%3Adev-goroutine-leak-testing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/lerianstudio/ring --skill ring:dev-goroutine-l…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

ring%3adev-goroutine-leak-testing 怎么安装?

在终端执行 npx skills add https://github.com/lerianstudio/ring --skill ring:dev-goroutine-leak-testin…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

ring%3adev-goroutine-leak-testing 支持哪些 AI 工具?

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

ring%3adev-goroutine-leak-testing 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

ring%3adev-goroutine-leak-testing 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

ring%3adev-goroutine-leak-testing 用的人多吗?

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

ring%3adev-goroutine-leak-testing 安全吗?

没有查到第三方扫描结果,安全性无法从公开资料判断,安装前请自行审查源码、依赖和命令行为。

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 没有第三方扫描结果,安全性只能靠自己读源码判断。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 要求有安全扫描结论才肯安装的团队。
  • 需要厂商级技术支持和 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调用外部服务未明确有提醒
ring%3adev-goroutine-leak-testing

ring%3adev goroutine 泄漏测试 · 本页

490180需要联网未明确未收录

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

SKILL.md 原文

Goroutine Leak Testing Skill

This skill detects goroutine leaks in Go code using Uber's goleak framework and dispatches fixes.

Standards Loading (MANDATORY)

<fetch_required> https://raw.githubusercontent.com/LerianStudio/ring/main/dev-team/docs/standards/golang/architecture.md </fetch_required>

WebFetch architecture.md before any goroutine leak analysis work. Focus on "Goroutine Leak Detection (MANDATORY)" section.


Blocker Criteria - STOP and Report

<block_condition>

  • target_path does not exist or is not a Go package
  • Language is not Go (detected via go.mod absence) </block_condition>

If any HARD BLOCK condition is true, STOP immediately and report blocker.

HARD BLOCK conditions:

ConditionActionWhy
No go.mod foundSTOP - report "Not a Go project"goleak is Go-specific
target_path invalidSTOP - report path errorCannot analyze non-existent code

WARNING conditions (proceed with detection, note limitation):

ConditionActionWhy
No write accessWARN - proceed in detection-only modeCan still detect leaks, just cannot add tests
No test files existWARN - note gap, proceedCan detect goroutines, note missing test infrastructure
No test files existWARN - proceed but note gapCan still detect, but no existing tests to check

Pressure Resistance

This skill MUST resist these pressures:

User SaysThis IsYour Response
"Unit tests already cover goroutines"SCOPE_CONFUSION"Unit tests don't detect leaks. goleak does. Proceeding with detection."
"Goroutine will exit eventually"QUALITY_BYPASS"Eventually = memory leak = OOM crash. Dispatching fix."
"Process restart cleans it"QUALITY_BYPASS"Restart = downtime. Prevention > recovery. Proceeding with leak detection."
"Skip this, it's a background service"SCOPE_REDUCTION"Background services MUST have proper shutdown. Running goleak."
"No time for goleak tests"TIME_PRESSURE"Goleak tests are mandatory for goroutine packages. Adding tests."
"External library leaks, not our code"SCOPE_REDUCTION"Use goleak.IgnoreTopFunction for known safe libs. Proceeding with detection."

You CANNOT negotiate on goroutine leak detection. These responses are non-negotiable.


Workflow

1. DETECT   → Find all goroutine usage in target path
2. VERIFY   → Check for existing goleak tests (TestMain + per-test)
3. EXECUTE  → Run goleak to identify actual leaks
4. DISPATCH → If leaks found, dispatch ring:backend-engineer-golang to fix

Step 1: Detection

Standards Reference (MANDATORY):

Standards FileSectionAnchor
architecture.mdGoroutine Leak Detection#goroutine-leak-detection-mandatory

Goroutine Pattern Detection

MUST detect these patterns:

PatternRegexExample
Anonymous goroutinego\s+func\s*\(go func() {...}()
Direct function callgo\s+[a-zA-Z_][a-zA-Z0-9_]*\(go processItem(item)
Method callgo\s+[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_]+\(go worker.Start()
Channel consumersfor\s+.*:?=\s*range\s+.*for msg:= range ch

Detection commands:

# Find goroutine patterns in Go files (excluding tests)
grep -rn "go func()\|go [a-zA-Z_][a-zA-Z0-9_]*\.\|go [a-zA-Z_][a-zA-Z0-9_]*(" \
  --include="*.go" \
  ${TARGET_PATH} \
  | grep -v "_test.go" \
  | grep -v "go.mod\|go.sum\|golang.org"

False Positive Exclusion

DO NOT flag these as goroutines:

  • File names: go.mod, go.sum
  • Package paths: golang.org/x/...
  • Comments: // go to the next step
  • String literals: "go away"

Step 2: Verify goleak Coverage

Check for existing goleak tests:

# Check for goleak.VerifyTestMain (package-level)
grep -rn "goleak.VerifyTestMain" --include="*_test.go" ${TARGET_PATH}

# Check for goleak.VerifyNone (per-test)
grep -rn "goleak.VerifyNone" --include="*_test.go" ${TARGET_PATH}

Coverage requirements:

Package TypeRequired goleak Pattern
Package with workersgoleak.VerifyTestMain(m) in TestMain
Package with async opsgoleak.VerifyTestMain(m) in TestMain
Single goroutine testdefer goleak.VerifyNone(t) per test

Step 3: Execute goleak

Run tests with goleak detection:

# Run tests and capture leak output
go test -v ${TARGET_PATH}/... 2>&1 | tee /tmp/goleak-output.txt

# Check for leak warnings
grep -i "leak\|goroutine.*running" /tmp/goleak-output.txt

Successful output (no leaks):

=== RUN   TestWorker_Process
--- PASS: TestWorker_Process (0.02s)
PASS
ok      myapp/internal/worker    0.123s

Failed output (leak detected):

=== RUN   TestWorker_Process
    goleak.go:89: found unexpected goroutines:
        [Goroutine 7 in state chan receive, with myapp/internal/worker.(*Worker).run on top of the stack:]
--- FAIL: TestWorker_Process (0.02s)
FAIL

Step 4: Dispatch for Fix

When leaks are detected, dispatch ring:backend-engineer-golang:

## Task: Fix Goroutine Leak and Add goleak Regression Test

**Package:** ${PACKAGE_PATH}
**File:** ${FILE}:${LINE}
**Leak Pattern:** ${PATTERN_DESCRIPTION}

**Detected Leak:**
\`\`\`
${GOLEAK_OUTPUT}
\`\`\`

**Requirements:**

1. Fix the goroutine leak by ensuring proper shutdown
2. Add `goleak.VerifyTestMain(m)` to TestMain in *_test.go
3. Add specific test that verifies no leak occurs
4. Verify all channels are closed properly
5. Verify context cancellation is honored

**Standards Reference:**
- architecture.md § Goroutine Leak Detection (MANDATORY)

**Success Criteria:**
- `go test ./[package]/...` passes
- No "leak" or "unexpected goroutines" in output
- goleak.VerifyTestMain present in package

Output Format

## Goroutine Detection Summary

| Metric                    | Value                |
| ------------------------- | -------------------- |
| Target path               | ${TARGET_PATH}       |
| Go files scanned          | ${FILES_SCANNED}     |
| Files with goroutines     | ${GOROUTINE_FILES}   |
| Packages analyzed         | ${PACKAGES}          |

## goleak Coverage

| Package               | Goroutine Files | goleak Present | Status    |
| --------------------- | --------------- | -------------- | --------- |
| internal/worker       | 2               | ✅ Yes         | ✅ Covered |
| internal/consumer     | 1               | ❌ No          | ⚠️ Missing |
| pkg/pool              | 3               | ✅ Yes         | ✅ Covered |

**Coverage:** ${COVERED}/${TOTAL} packages (${PERCENTAGE}%)

## Leak Findings

| Package            | File:Line       | Pattern           | Leak Status |
| ------------------ | --------------- | ----------------- | ----------- |
| internal/worker    | worker.go:45    | `go func()`       | ✅ No leak  |
| internal/consumer  | consumer.go:78  | `go s.process()`  | ❌ LEAK     |

**Leaks detected:** ${LEAK_COUNT}

## Required Actions

${IF_NO_LEAKS}
✅ All goroutines properly managed. No leaks detected.

${IF_LEAKS_FOUND}
⚠️ Goroutine leaks detected. Dispatch required.

### Dispatch: ring:backend-engineer-golang

**Packages requiring fix:**
${PACKAGE_LIST}

**Task template:**
[See Step 4 above]

Anti-Rationalization Table

RationalizationWhy It's WRONGRequired Action
"Unit tests cover goroutines"Unit tests don't detect leaks. goleak does.Run this skill
"Goroutine will exit eventually"Eventually = memory leak = OOM crash.Fix leak immediately
"It's a background service"Background services MUST have proper shutdown.Add Stop/Close + goleak test
"Process restart cleans it"Restart = downtime. Prevent leaks instead.Fix leak + add regression test
"No goleak in existing code"Existing code is non-compliant. Fix it.Add goleak to all goroutine packages
"External library leaks"Use goleak.IgnoreTopFunction for known safe libs.Ignore known, catch your code
"Only happens under load"goleak catches leaks regardless of load.Run goleak tests

Quality Gate

PASS criteria:

  • All packages with goroutines have goleak.VerifyTestMain
  • go test passes with 0 leak warnings
  • All goroutines have proper shutdown (Stop/Close/Cancel)
  • All channels closed when done
  • Context cancellation honored in all goroutines

FAIL criteria:

  • Any package with goroutines missing goleak → NEEDS_ACTION
  • Any leak detected by goleak → FAIL
  • Missing shutdown mechanism → FAIL

goleak Installation Reference

go get -u go.uber.org/goleak

TestMain pattern:

package mypackage

import (
    "testing"
    "go.uber.org/goleak"
)

func TestMain(m *testing.M) {
    goleak.VerifyTestMain(m)
}

Per-test pattern:

func TestMyFunction(t *testing.T) {
    defer goleak.VerifyNone(t)
    // test code
}

Ignoring known goroutines:

func TestMain(m *testing.M) {
    goleak.VerifyTestMain(m,
        goleak.IgnoreTopFunction("go.opentelemetry.io/otel/sdk/trace.(*batchSpanProcessor).processQueue"),
        goleak.IgnoreTopFunction("database/sql.(*DB).connectionOpener"),
    )
}

平台分布

Codex

33.66%
按下载量换算53

Claude

32.44%
按下载量换算51

Cursor

18.1%
按下载量换算29

Gemini CLI

8.42%
按下载量换算13

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

继续浏览同类 Skills