Agent skill

Ndk Operation Timeout Wrapper

by divinevideo in divinevideo/divine-mobile

Fix NDK (Nostr Dev Kit) operations hanging indefinitely when relay connections stall.

MPL-2.0Auto-check passed

Install Ndk Operation Timeout Wrapper

skills CLI
$ npx skills add divinevideo/divine-mobile --skill ndk-operation-timeout-wrapper -a claude-code

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

GitHub CLI
$ gh skill install divinevideo/divine-mobile ndk-operation-timeout-wrapper --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/divinevideo/divine-mobile.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/ndk-operation-timeout-wrapper .claude/skills/ndk-operation-timeout-wrapper && 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
ndk-operation-timeout-wrapper
GitHub stars
266
Token cost
~935 tokens
SKILL.md length
197 words
Files
1
Skills in repo
103
Repo updated
First seen
Licence
MPL-2.0

At a glance

Fix NDK (Nostr Dev Kit) operations hanging indefinitely when relay connections stall.

  • Works in 3 steps: Throw a timeout error after the… → Allow retry logic to attempt the… → Log the specific operation that timed out
  • App freezes during fetchEvents
  • SKILL.md covers Problem, Context / Trigger Conditions, Solution and Verification, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Ndk Operation Timeout Wrapper is an agent skill from divinevideo/divine-mobile. Fix NDK (Nostr Dev Kit) operations hanging indefinitely when relay connections stall. Use when: (1) App freezes during fetchEvents or publish calls, (2) No timeout errors despite network issues, (3) Relay connection appears stuck, (4) Using NDK with unstable or slow relays. NDK operations have no built-in timeout - wrap with Promise.race.

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

The licence is MPL-2.0.

When your agent uses it

  • App freezes during fetchEvents
  • No timeout errors despite network issues
  • Relay connection appears stuck
  • Using NDK with unstable

Example prompts

  • “/ndk-operation-timeout-wrapper”

Workflow steps

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

  1. Throw a timeout error after the specified duration
  2. Allow retry logic to attempt the operation again
  3. Log the specific operation that timed out

What it can do on your machine

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

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    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 typescript).

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

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • developer.mozilla.org

    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

Ndk Operation Timeout Wrapper loads about 935 tokens when it runs. Until then it costs about 93 tokens; SKILL.md has 197 words of instructions outside code blocks.

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

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 passed

The automated check found no risky patterns in SKILL.md.

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 divinevideo/divine-mobile at commit 4c622be, republished under its MPL-2.0 licence (© divinevideo). 197 words, ~935 tokens.

Download SKILL.mdSave it as .claude/skills/ndk-operation-timeout-wrapper/SKILL.md (or your agent's skills folder).
name
ndk-operation-timeout-wrapper
description
Fix NDK (Nostr Dev Kit) operations hanging indefinitely when relay connections stall. Use when: (1) App freezes during fetchEvents or publish calls, (2) No timeout errors despite network issues, (3) Relay connection appears stuck, (4) Using NDK with unstable or slow relays. NDK operations have no built-in timeout - wrap with Promise.race.
author
Claude Code
version
1.0.0
date
2026-01-31

NDK Operation Timeout Wrapper

Problem

NDK (nostr-dev-kit) operations like fetchEvents() and ndkEvent.publish() have no built-in timeout. When relay connections stall or become unresponsive, these operations hang indefinitely, causing the application to freeze without any error message.

Context / Trigger Conditions

  • Application freezes during Nostr operations
  • No timeout error thrown despite minutes of waiting
  • Works sometimes, hangs randomly (relay-dependent)
  • Log shows operation started but never completes
  • Using NDK with multiple relays where some may be unreliable

Solution

Create a timeout wrapper function:

typescript
const NDK_TIMEOUT_MS = 30000; // 30 seconds

async function withTimeout<T>(
  promise: Promise<T>,
  ms: number,
  operation: string
): Promise<T> {
  let timeoutId: ReturnType<typeof setTimeout>;
  const timeoutPromise = new Promise<never>((_, reject) => {
    timeoutId = setTimeout(
      () => reject(new Error(`${operation} timed out after ${ms}ms`)),
      ms
    );
  });

  try {
    const result = await Promise.race([promise, timeoutPromise]);
    clearTimeout(timeoutId!);
    return result;
  } catch (error) {
    clearTimeout(timeoutId!);
    throw error;
  }
}

Wrap all NDK operations:

typescript
// Connect with timeout
await withTimeout(ndk.connect(), NDK_TIMEOUT_MS, "NDK connect");

// Fetch events with timeout
const events = await withTimeout(
  ndk.fetchEvents({ kinds: [0], authors: [pubkey] }),
  NDK_TIMEOUT_MS,
  "fetch profile"
);

// Publish with timeout
const relaySet = NDKRelaySet.fromRelayUrls(relayUrls, ndk);
await withTimeout(
  ndkEvent.publish(relaySet),
  NDK_TIMEOUT_MS,
  "relay publish"
);

Also ensure timeout errors are retryable:

typescript
function isRetryableError(error: unknown): boolean {
  if (error instanceof Error) {
    const message = error.message.toLowerCase();
    const errorName = error.name.toLowerCase();
    if (
      message.includes("timeout") ||
      message.includes("aborted") ||
      errorName.includes("timeout") ||
      errorName.includes("abort")
    ) {
      return true;
    }
  }
  return false;
}

Verification

After implementing, operations that previously hung should now:

  1. Throw a timeout error after the specified duration
  2. Allow retry logic to attempt the operation again
  3. Log the specific operation that timed out

Example

Before (hangs forever):

typescript
const events = await ndk.fetchEvents({ kinds: [34236], "#d": [vineId] });

After (times out and can retry):

typescript
const events = await withTimeout(
  ndk.fetchEvents({ kinds: [34236], "#d": [vineId] }),
  30000,
  "check video exists"
);

Notes

  • 30 seconds is a reasonable default; adjust based on expected operation duration
  • Consider shorter timeouts for existence checks, longer for batch operations
  • Wrap ALL NDK operations, not just problematic ones (any can hang)
  • This pattern applies to any async library without built-in timeouts
  • For AbortController support (if library supports it), prefer that over Promise.race

References

© divinevideo, MPL-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/ndk-operation-timeout-wrapper of divinevideo/divine-mobile.

Open the folder on GitHubat commit 4c622be

Compare with similar skills

Ndk Operation Timeout Wrapper 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.

Ndk Operation Timeout Wrapper compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ndk Operation Timeout Wrapper this skilldivinevideo/divine-mobile266—~935Automated safety check: PassMPL-2.0
Block Kitopenclaw/openclaw392k—~624Automated safety check: PassMIT
It Operationsdavila7/claude-code-templates32k1 repos~3.7kAutomated safety check: PassMIT
Operator Approval Loopaffaan-m/ECC275k—~3.3kAutomated safety check: PassMIT
Kit AutomationComposioHQ/awesome-claude-skills77k3 repos~715Automated safety check: PassNone
Business Operations Skillsalirezarezvani/claude-skills28k—~2.3kAutomated safety check: PassMIT

Similar skills

  • Block Kit

    openclaw/openclaw

    Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

    392k GitHub stars~624 tokensUpdated today
    Auto-check passed
  • It Operations

    davila7/claude-code-templates

    Manages IT infrastructure, monitoring, incident response, and service reliability.

    32k GitHub starsUsed in 1 repo~3.7k tokens
    DevOps & CloudAuto-check passed
  • Operator approval contract with internal filing notices for agent-drafted outbound messages, hashed drafts, epoch-keyed decisions, durable delivery claims and receipts, and a pre-draft baseline gate.

    275k GitHub stars~3.3k tokensUpdated 3 days ago
    Auto-check passed
  • Kit Automation

    ComposioHQ/awesome-claude-skills

    Automate Kit tasks via Rube MCP (Composio). An agent skill from ComposioHQ/awesome-claude-skills.

    77k GitHub starsUsed in 3 repos~715 tokens
    Productivity & AutomationAuto-check passed
  • Business Operations Skills

    alirezarezvani/claude-skills

    A skill your agent uses when running, diagnosing, or designing internal business operations — process documentation, vendor SLAs, capacity planning, internal comms, SOP/runbook authoring…

    28k GitHub stars~2.3k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Context Kit

    sickn33/agentic-awesome-skills

    Evaluate, adapt, and safely install Context Kit personal context artifacts for Claude Code or adjacent agent workflows.

    47k GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed

More from divinevideo/divine-mobile

All 103 skills in this repo
  • Fix ArgoCD ExternalSecret deployment failing with "namespace X is not permitted in project Y".

    266 GitHub stars~931 tokensUpdated today
    Auto-check passed
  • Art Direct

    divinevideo/divine-mobile

    Art direction for any content — reads text, PDF, Word, HTML, PPT, then proposes 2-3 creative directions with photography style, mood, and visual language.

    266 GitHub stars~4.8k tokensUpdated today
    Auto-check passed
  • Async Await Null Race Condition

    divinevideo/divine-mobile

    Fix "Null check operator used on a null value" errors when an object is set to null during an async await.

    266 GitHub stars~881 tokensUpdated today
    Auto-check passed
  • AWS V4 Signing Custom Headers Gcs

    divinevideo/divine-mobile

    Add custom metadata headers (x-amz-meta-) to AWS v4 signed requests for GCS S3-compatible API.

    266 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Bash Herestring Newline Secrets

    divinevideo/divine-mobile

    Fix password/secret authentication failures caused by trailing newlines when creating Google Cloud secrets (or similar) with bash here-strings.

    266 GitHub stars~791 tokensUpdated today
    Auto-check passed
  • Fix silent video/media processing failures caused by URL extraction code that filters on file extensions (.mp4, .webm, .webp).

    266 GitHub stars~1.1k tokensUpdated today
    Auto-check passed

Questions about Ndk Operation Timeout Wrapper

What does Ndk Operation Timeout Wrapper do?

Fix NDK (Nostr Dev Kit) operations hanging indefinitely when relay connections stall. Ndk Operation Timeout Wrapper is an agent skill from divinevideo/divine-mobile. Fix NDK (Nostr Dev Kit) operations hanging indefinitely when relay connections stall.

When should I use Ndk Operation Timeout Wrapper?

Ndk Operation Timeout Wrapper fits situations like: app freezes during fetchEvents; no timeout errors despite network issues; relay connection appears stuck; using NDK with unstable.

How do I install Ndk Operation Timeout Wrapper in Claude Code?

Run `npx skills add divinevideo/divine-mobile --skill ndk-operation-timeout-wrapper -a claude-code`. Or copy the skill folder (.agents/skills/ndk-operation-timeout-wrapper in divinevideo/divine-mobile) into .claude/skills/ndk-operation-timeout-wrapper in your project. Claude Code loads it when a task matches its description.

How do I install Ndk Operation Timeout Wrapper in Codex?

Run `npx skills add divinevideo/divine-mobile --skill ndk-operation-timeout-wrapper -a codex`. Or copy the skill folder (.agents/skills/ndk-operation-timeout-wrapper in divinevideo/divine-mobile) into .agents/skills/ndk-operation-timeout-wrapper in your project. Codex loads it when a task matches its description.

Can I use Ndk Operation Timeout Wrapper 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 divinevideo/divine-mobile --skill ndk-operation-timeout-wrapper -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ndk-operation-timeout-wrapper, .gemini/skills/ndk-operation-timeout-wrapper, .github/skills/ndk-operation-timeout-wrapper and .opencode/skills/ndk-operation-timeout-wrapper in your project.

What does Ndk Operation Timeout Wrapper need to run?

SKILL.md names no scripts, command-line tools or credentials: Ndk Operation Timeout Wrapper is instructions for the agent only.

Does Ndk Operation Timeout Wrapper access the network?

SKILL.md names 2 domains. As links in the text: github.com and developer.mozilla.org. This is read from the text; nothing was executed.

Is Ndk Operation Timeout Wrapper safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Ndk Operation Timeout Wrapper use?

Ndk Operation Timeout Wrapper is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Ndk Operation Timeout Wrapper use?

About 935 tokens (SKILL.md is roughly 3.7k 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 Ndk Operation Timeout Wrapper?

Skills that share tags, products or a category with Ndk Operation Timeout Wrapper: Block Kit (openclaw/openclaw, 392k stars), It Operations (davila7/claude-code-templates, 32k stars), Operator Approval Loop (affaan-m/ECC, 275k stars) and Kit Automation (ComposioHQ/awesome-claude-skills, 77k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ndk Operation Timeout Wrapper?

divinevideo (a GitHub organization) maintains it in divinevideo/divine-mobile, which has 266 GitHub stars. The repository holds 103 skills in this directory. The repository was last updated on October 8, 2026.

Source: divinevideo/divine-mobile on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.