Official agent skill

Fix Continuation Leakage

by DataDog in DataDog/dd-trace-java

Diagnose and fix scope or continuation lifecycle failures in dd-trace-java instrumentation tests.

OfficialApache-2.0Auto-check: notesDevelopment

Install Fix Continuation Leakage

skills CLI
$ npx skills add DataDog/dd-trace-java --skill fix-continuation-leakage -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install DataDog/dd-trace-java fix-continuation-leakage --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/DataDog/dd-trace-java.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/fix-continuation-leakage .claude/skills/fix-continuation-leakage && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fix-continuation-leakage
GitHub stars
736
Token cost
~1.6k tokens
SKILL.md length
803 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

Diagnose and fix scope or continuation lifecycle failures in dd-trace-java instrumentation tests.

  • Works in 6 steps: Resolve the actual Gradle module path… → Verify the selected test ran in that… → Follow the failing record from its first… → …
  • A test reports a continuation leak
  • SKILL.md covers Work the failure, Fixture failures, Do not hide evidence and Assess production impact, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Fix Continuation Leakage is an agent skill from DataDog/dd-trace-java, published by the product's own GitHub organization. Diagnose and fix scope or continuation lifecycle failures in dd-trace-java instrumentation tests. Use when a test reports a continuation leak, double resolution, activation after resolve, or an unclosed scope. Reads the automatic diagnostic timeline, finds the broken lifecycle edge, fixes it, and explains it with a compact Mermaid diagram.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Observability. It works with Java, Datadog and Mermaid. The repository describes itself as: Datadog APM client for Java. The licence is Apache-2.0.

When your agent uses it

  • A test reports a continuation leak
  • Double resolution
  • Activation after resolve
  • An unclosed scope

Example prompts

  • “/fix-continuation-leakage”

Requirements

  • Pre-approved tools (allowed-tools): Bash, Read, Edit, Glob, Grep, AskUserQuestion

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Resolve the actual Gradle module path and failing suite from CI or the module's tasks. Nesting
  2. Verify the selected test ran in that task's XML results; a successful build with no discovered
  3. Follow the failing record from its first event
  4. Classify the captured work before changing code
  5. Prefer a test-lifecycle fix when production behavior is correct. Otherwise fix ownership where
  6. Rerun the failing test, then its module. Validate the leaked record and root-trace publication

What it can do on your machine

Read from SKILL.md and the folder at commit 1c373d5. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash
    • Read
    • Edit
    • Glob
    • Grep
    • AskUserQuestion

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Fix Continuation Leakage loads about 1.6k tokens when it runs. Until then it costs about 92 tokens; SKILL.md has 803 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~92
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash, Read, Edit, Glob, Grep, AskUserQuestion

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from DataDog/dd-trace-java at commit 1c373d5, republished under its Apache-2.0 licence (© DataDog). 803 words, ~1,624 tokens.

Download SKILL.mdSave it as .claude/skills/fix-continuation-leakage/SKILL.md (or your agent's skills folder).
name
fix-continuation-leakage
description
Diagnose and fix scope or continuation lifecycle failures in dd-trace-java instrumentation tests. Use when a test reports a continuation leak, double resolution, activation after resolve, or an unclosed scope. Reads the automatic diagnostic timeline, finds the broken lifecycle edge, fixes it, and explains it with a compact Mermaid diagram.
allowed-tools
Bash, Read, Edit, Glob, Grep, AskUserQuestion
user-invocable
true
context
fork

Fix continuation leakage

Instrumentation tests run the diagnostic automatically. A failure includes the capture, resume, resolution, scope, thread, timing, and callsite data needed to find the missing lifecycle edge.

Work the failure

  1. Resolve the actual Gradle module path and failing suite from CI or the module's tasks. Nesting varies (for example, netty:netty-4.1 versus kotlin-coroutines-1.3). Use forkedTest for *ForkedTest* classes, or the suite-specific forked task such as latestDepForkedTest. Run the smallest failing test with full output:
bash
set -o pipefail
./gradlew :dd-java-agent:instrumentation:<module-path>:<test-task> --tests '<FQCN-or-pattern>' --info 2>&1 | tee /tmp/scopediag-run.txt
  1. Verify the selected test ran in that task's XML results; a successful build with no discovered tests is not validation. Find Scope/continuation timeline in the output. If Gradle hides it, inspect the test XML's <system-out> under the module's build/test-results directory.
  2. Follow the failing record from its first event:
    • LEAKED / NEVER_CLOSED: find the success, error, cancellation, and rejection exits that skipped release() or close().
    • DOUBLE_FINISH: find two owners of the same cleanup.
    • ACTIVATE_AFTER_RESOLVE: find work scheduled after ownership ended.
    • LATE_FINISH / CLOSE_WRONG_THREAD: advisory evidence; verify whether ordering is valid.
    • [deferred-cleanup]: a root iteration scope transferred cleanup to the bounded iteration cleaner. It may remain open at the test boundary and is not a leak. Do not generalize this to other ITERATION scopes; an unregistered iteration scope must still close normally.
  3. Classify the captured work before changing code:
    • For a real asynchronous operation, repair success, failure, cancellation, and rejection cleanup.
    • If the test started the work, wait for its terminal event and dispose or close it before the test ends.
    • If a framework initializer creates a permanent sentinel with no context consumer, disable propagation only around that creation boundary. Match the exact type and method, and update knownMatchingTypes() when shortcut matching is used. Check static initialization (<clinit>): first use under an active request can capture its context in singleton tasks, including shaded Netty GlobalEventExecutor sentinels. Reproduce first use in a fresh JVM; prewarming can hide the bug. Do not suppress all class initializers.
    • If an executor replaces a task before delegating, avoid capturing the discarded task while preserving capture for the task actually submitted.
    • For intentionally delayed work, wait for its documented terminal event rather than suppressing propagation.
    • For a context swap, verify both restoration and resource cleanup. Restore or close the returned ownership object in finally; do not ignore every swap.
  4. Prefer a test-lifecycle fix when production behavior is correct. Otherwise fix ownership where it breaks, with one owner and try/finally cleanup across every exit.
  5. Rerun the failing test, then its module. Validate the leaked record and root-trace publication separately from trace-count or arrival-order assertions; fixing a leak may expose an unrelated flaky assertion.

Fixture failures

Automatic recording covers Spock setupSpec() / cleanupSpec() and JUnit @BeforeAll / @AfterAll, in addition to per-test setup and cleanup. The failure output identifies whether the problem belongs to suite setup, one test, or suite cleanup. Code that runs before the instrumentation-test harness initializes the tracer remains outside this window.

Apply process-wide configuration before starting servers, actor systems, executors, or other long-lived fixtures. Use a forked test or recreate the fixture when its static state cannot be reset safely.

Show full SKILL.md (292 more words)Show less

Do not hide evidence

Instrumentation tests always use strict trace writes; there is no harness opt-out. Do not replace the harness tracer or add a new escape hatch to weaken that invariant.

Fix the continuation lifecycle when possible. If it cannot be fixed in the current change, quarantine the test with @Flaky and a useful reason or tracked issue instead of weakening strict trace writes. Keep continuation tracking enabled so the failure remains diagnosable.

Use @TrackScopeContinuations(enabled = false, reason = "...") only when the diagnostic itself is incompatible with the test, not when it has found a real unresolved leak. Scope the opt-out as narrowly as possible. The reason must describe the incompatibility and when the opt-out can be removed; strict trace writes remain enabled.

Assess production impact

An unresolved continuation blocks normal reference-count completion, not necessarily publication. The production PendingTrace buffer can still write finished spans; strict tests remove that delayed-write fallback, but partial flush remains possible. Do not infer lost traces or a fixed UI delay from a diagnostic failure. Check the collector and configuration; see continuation effects.

Memory retention requires a reachable owner of the continuation/context; it does not prove the whole trace remains retained or memory grows without bound. Wrong parentage requires activation of unrelated context or a leaked active scope. Separate the observed lifecycle defect from its possible production effects and from test-only cleanup failures.

Explain it to a human

Lead with one sentence: what was captured, which cleanup edge was missing, and where. Cite the timeline callsites. Then include a small Mermaid flowchart LR; use green for healthy edges, red for the broken edge, and label thread handoffs. Use a Gantt only when timing itself caused the bug.

End with the code fix and the exact tests that passed.

© DataDog, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/fix-continuation-leakage of DataDog/dd-trace-java.

Open the folder on GitHubat commit 1c373d5

Compare with similar skills

Fix Continuation Leakage next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Fix Continuation Leakage compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Fix Continuation Leakage this skillDataDog/dd-trace-java736—~1.6kAutomated safety check: NotesApache-2.0
Logging Patternsdecebals/claude-code-java7511 repos~3.3kAutomated safety check: PassMIT
Agent Observability Trace Rcadatadog-labs/agent-skills177—~10kAutomated safety check: PassMIT
Code To Diagramzebbern/claude-code-guide4.7k—~972Automated safety check: PassMIT
Dt Obs ServicesDynatrace/dynatrace-for-ai162—~3.3kAutomated safety check: PassApache-2.0
Golang Samber Slogcontext-labs/whip1.1k2 repos~3kAutomated safety check: PassMIT

Similar skills

  • Logging Patterns

    decebals/claude-code-java

    Java logging best practices with SLF4J, structured logging (JSON), and MDC for request tracing.

    751 GitHub starsUsed in 1 repo~3.3k tokens
    DevelopmentAuto-check passed
  • Agent Observability Trace Rca

    datadog-labs/agent-skills

    Root cause analysis on production LLM traces. An agent skill from datadog-labs/agent-skills.

    177 GitHub stars~10k tokensUpdated today
    DevelopmentAuto-check passed
  • Code To Diagram

    zebbern/claude-code-guide

    Analyze codebases and automatically generate architecture diagrams, flowcharts, and org charts.

    4.7k GitHub stars~972 tokensUpdated today
    DevelopmentAuto-check passed
  • Dt Obs Services

    Dynatrace/dynatrace-for-ai

    Service performance monitoring with RED metrics (Rate, Errors, Duration) and runtime-specific telemetry for Java, .NET, Node.js, Python, PHP, and Go.

    162 GitHub stars~3.3k tokensUpdated 7 days ago
    DevOps & CloudAuto-check passed
  • Golang Samber Slog

    context-labs/whip

    Structured logging extensions for Golang using samber/slog- — multi-handler pipelines, sampling, attribute formatting, HTTP middleware (gin, echo, fiber, chi), backend routing (datadog, sentry…

    1.1k GitHub starsUsed in 2 repos~3k tokens
    DevOps & CloudAuto-check passed
  • Code To Chart

    rongxinzy/RongxinAI

    解析代码仓库的 import/依赖关系,自动生成架构图、流程图和组织架构图,输出 Mermaid 文本或 SVG 图片。支持 Python、JavaScript、TypeScript、Go 和 Java 项目。当用户需要可视化代码结构、分析模块依赖、生成架构文档,或提及“代码架构图”、“依赖关系图”、“流程图”、“组织架构图”、“Mermaid 图”等关键词时触发。

    154 GitHub stars~596 tokensUpdated today
    DevelopmentAuto-check passed

More from DataDog/dd-trace-java

All 9 skills in this repo
  • Apm Integrations

    DataDog/dd-trace-java

    Official

    Write a new library instrumentation end-to-end. An agent skill from DataDog/dd-trace-java.

    736 GitHub stars~3.7k tokensUpdated today
    Auto-check: notes
  • Perf Review

    DataDog/dd-trace-java

    Official

    Performance-overhead review of a code diff / branch / PR for the dd-trace-java tracer.

    736 GitHub stars~3.6k tokensUpdated today
    Auto-check: notes
  • Resolve Muzzle CI

    DataDog/dd-trace-java

    Official

    Diagnose and resolve dd-trace-java CI failures from a module's muzzle task or the runMuzzle aggregate.

    736 GitHub stars~3.2k tokensUpdated today
    Auto-check passed
  • Techdebt

    DataDog/dd-trace-java

    Official

    Review a code diff / branch / PR for technical debt — code duplication, unnecessary complexity / over-engineering, and redundant or dead code.

    736 GitHub stars~565 tokensUpdated today
    Auto-check: notes
  • Clarify Java Comments

    DataDog/dd-trace-java

    Official

    Clarify or review Java Javadocs, Javadoc tags, and explanatory code comments for legibility, accuracy, and source alignment.

    736 GitHub stars~2.3k tokensUpdated today
    Auto-check: notes
  • Migrate Groovy To Java

    DataDog/dd-trace-java

    Official

    Converts Spock/Groovy test files in a Gradle module to equivalent JUnit 5 Java tests.

    736 GitHub stars~1.3k tokensUpdated today
    Auto-check passed

Questions about Fix Continuation Leakage

What does Fix Continuation Leakage do?

Diagnose and fix scope or continuation lifecycle failures in dd-trace-java instrumentation tests. Fix Continuation Leakage is an agent skill from DataDog/dd-trace-java, published by the product's own GitHub organization. Diagnose and fix scope or continuation lifecycle failures in dd-trace-java instrumentation tests.

When should I use Fix Continuation Leakage?

Fix Continuation Leakage fits situations like: A test reports a continuation leak; double resolution; activation after resolve; an unclosed scope.

How do I install Fix Continuation Leakage in Claude Code?

Run `npx skills add DataDog/dd-trace-java --skill fix-continuation-leakage -a claude-code`. Or copy the skill folder (.agents/skills/fix-continuation-leakage in DataDog/dd-trace-java) into .claude/skills/fix-continuation-leakage in your project. Claude Code loads it when a task matches its description.

How do I install Fix Continuation Leakage in Codex?

Run `npx skills add DataDog/dd-trace-java --skill fix-continuation-leakage -a codex`. Or copy the skill folder (.agents/skills/fix-continuation-leakage in DataDog/dd-trace-java) into .agents/skills/fix-continuation-leakage in your project. Codex loads it when a task matches its description.

Can I use Fix Continuation Leakage in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add DataDog/dd-trace-java --skill fix-continuation-leakage -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fix-continuation-leakage, .gemini/skills/fix-continuation-leakage, .github/skills/fix-continuation-leakage and .opencode/skills/fix-continuation-leakage in your project.

What does Fix Continuation Leakage need to run?

SKILL.md names no scripts, command-line tools or credentials: Fix Continuation Leakage is instructions for the agent only. Its frontmatter pre-approves these tools: Bash, Read, Edit, Glob, Grep, AskUserQuestion.

Does Fix Continuation Leakage access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Fix Continuation Leakage safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Fix Continuation Leakage use?

Fix Continuation Leakage is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Fix Continuation Leakage use?

About 1.6k tokens (SKILL.md is roughly 6.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Fix Continuation Leakage?

Skills that share tags, products or a category with Fix Continuation Leakage: Logging Patterns (decebals/claude-code-java, 751 stars), Agent Observability Trace Rca (datadog-labs/agent-skills, 177 stars), Code To Diagram (zebbern/claude-code-guide, 4.7k stars) and Dt Obs Services (Dynatrace/dynatrace-for-ai, 162 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Fix Continuation Leakage?

DataDog (a GitHub organization, an official publisher) maintains it in DataDog/dd-trace-java, which has 736 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 8, 2026.

Source: DataDog/dd-trace-java on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.