ndk-operation-timeout-wrapper

ndk-operation-timeout-wrapper is a skill for Claude Code, Codex from divinevideo/divine-mobile. It costs 88 tokens per session (899 once invoked), scanned A, original, MPL-2.0.

A guide to adding time limits around NDK, the Nostr Dev Kit, operations such as fetching or publishing events. It makes a stalled network operation stop with an error instead of waiting forever.

In plain words
What is it for?
Use it when NDK relay operations hang or behave inconsistently on unreliable networks. It helps wrap event fetches and publishes with a controlled timeout.
Why use it?
It removes application freezes caused by relay connections that become slow or unresponsive. Without a timeout, the operation may never report that it failed.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code; installed under .agents/ (shared by several agents).

Good fit Use it when NDK relay operations hang or behave inconsistently on unreliable networks. It helps wrap event fetches and publishes with a controlled timeout.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/divinevideo/divine-mobile/ndk-operation-timeout-wrapper
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add divinevideo/divine-mobile --skill ndk-operation-timeout-wrapper
Clone the repo
git clone --depth 1 https://github.com/divinevideo/divine-mobile

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ndk-operation-timeout-wrapper

README.md
[![agentmods](https://agentmods.dev/badge/skills/divinevideo/divine-mobile/ndk-operation-timeout-wrapper/github.svg)](https://agentmods.dev/skills/divinevideo/divine-mobile/ndk-operation-timeout-wrapper)
Your own site
<a href="https://agentmods.dev/skills/divinevideo/divine-mobile/ndk-operation-timeout-wrapper"><img src="https://agentmods.dev/badge/skills/divinevideo/divine-mobile/ndk-operation-timeout-wrapper/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ndk-operation-timeout-wrapper

Your own site · 80×15
<a href="https://agentmods.dev/skills/divinevideo/divine-mobile/ndk-operation-timeout-wrapper"><img src="https://agentmods.dev/badge/skills/divinevideo/divine-mobile/ndk-operation-timeout-wrapper.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 899 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00088 $0.00899
Opus 5 $0.00044 $0.00449
Sonnet 5 $0.00018 $0.00180
Haiku 4.5 $0.00009 $0.00090

Measured 7d ago against content hash 4d5b7d6541aa, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

ndk-operation-timeout-wrapper scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/ndk-operation-timeout-wrapper/SKILL.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

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:

// 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:

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;
}

Read the full file on GitHub · 132 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 132 lines · 88 tokens per session scan A 4d5b7d6541aa

Subscribe to this mod's changes

ndk-operation-timeout-wrapper is a skill published in the GitHub repository divinevideo/divine-mobile (265 stars, last pushed today), licensed MPL-2.0. It adds 88 tokens to every session and 899 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

code-changes

Orchestration workflow for any task that ends in code changes: issue analysis, pull request review, feature implementation, bug fixes, refactors, or fleshing out an idea. MUST be invoked at the start of such a task, before reading or writing any code. Defines how to analyze first, gate on user approval, plan, pick the…

JanDeDobbeleer/oh-my-posh · 88 tokens

cross-environment-semantic-drift

L1 trigger - audits L1/L2 boundary bugs, precompile context assumptions, integer width mismatches at environment boundaries, and EVM-on-non-EVM drift.

PlamenTSV/plamen · 43 tokens

consensus-math-correctness

L1 trigger - audits consensus arithmetic for truncation, unused bounds, EMA direction, and threshold edge errors.

PlamenTSV/plamen · 30 tokens

alchemy-cli

Use the Alchemy CLI (@alchemy/cli) for live blockchain data, transaction lookups, NFT/token/portfolio queries, simulation, tracing/debugging, contract reads/writes, wallet-signed sends, swaps and cross-chain bridges, Solana RPC/DAS plus wallet sends, webhook management, and Alchemy app administration. Preferred…

alchemyplatform/skills · 166 tokens

finish-it

Scope-cutting and shipping discipline from Derek Yu's 'Finishing a Game' and 'Death Loops', jam culture, and veteran shipping practice — diagnose why a game project stalled, cut to a shippable core, define a binary finish line, ship it. Use when: a game project is stalled or sprawling, 'I keep adding features', 'it's…

kyh/vibedgames · 115 tokens

skmtc-debug

Diagnose failures in SKMTC sessions — no output, wrong output, error messages, bundle freshness, parseIssues, "Registered definition mismatch", ref cycles, "Module not found" in generated code, or any other broken behavior. Applies across both CLI usage and generator authoring contexts. Use this skill when the user…

skmtc/skmtc · 213 tokens