Agent skill

Nostr REST API Field Mapping Gap

by divinevideo in divinevideo/divine-mobile

Fix features broken by REST API responses that flatten Nostr events, losing tag data.

MPL-2.0Auto-check passedBackend & APIs

Install Nostr REST API Field Mapping Gap

skills CLI
$ npx skills add divinevideo/divine-mobile --skill nostr-rest-api-field-mapping-gap -a claude-code

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

GitHub CLI
$ gh skill install divinevideo/divine-mobile nostr-rest-api-field-mapping-gap --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/nostr-rest-api-field-mapping-gap .claude/skills/nostr-rest-api-field-mapping-gap && 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
nostr-rest-api-field-mapping-gap
GitHub stars
266
Token cost
~1.5k tokens
SKILL.md length
594 words
Files
1
Skills in repo
103
Repo updated
First seen
Licence
MPL-2.0

At a glance

Fix features broken by REST API responses that flatten Nostr events, losing tag data.

  • Works in 4 steps: Identify the mapping gap → Add fallback mappings → Validate the fallback is safe → …
  • A feature works for WebSocket-loaded events but not REST API-loaded ones
  • SKILL.md covers Problem, Context / Trigger Conditions, Root Cause and Solution, plus 4 more sections
  • Calls curl and jq

What it does

Nostr REST API Field Mapping Gap is an agent skill from divinevideo/divine-mobile. Fix features broken by REST API responses that flatten Nostr events, losing tag data. Use when: (1) A feature works for WebSocket-loaded events but not REST API-loaded ones, (2) A model field (like sha256, textTrackRef) is null for REST API data but set for WebSocket data, (3) REST API returns denormalized fields (dtag, videourl) but omits raw tags array, (4) hasSubtitles/hasFeature returns false for REST-loaded videos. Common in Nostr clients that use both REST APIs (for analytics/bulk queries) and WebSocket…

Its SKILL.md is about 1.5k 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 Backend & APIs, covering REST APIs and Realtime and WebSockets. The licence is MPL-2.0.

When your agent uses it

  • A feature works for WebSocket-loaded events but not REST API-loaded ones
  • A model field (like sha256
  • TextTrackRef) is null for REST API data but set for WebSocket data
  • REST API returns denormalized fields (dtag

Example prompts

  • “/nostr-rest-api-field-mapping-gap”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Identify the mapping gap
  2. Add fallback mappings
  3. Validate the fallback is safe
  4. Add tests

What it can do on your machine

Read from SKILL.md and the folder at commit 6487b05. 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

    Shell commands in SKILL.md call:

    • curl
    • jq

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

  • Network

    No URLs in SKILL.md. Its commands use curl, which can reach the network depending on how they are called.

    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

Nostr REST API Field Mapping Gap loads about 1.5k tokens when it runs. Until then it costs about 143 tokens; SKILL.md has 594 words of instructions outside code blocks.

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

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 6487b05, republished under its MPL-2.0 licence (© divinevideo). 594 words, ~1,529 tokens.

Download SKILL.mdSave it as .claude/skills/nostr-rest-api-field-mapping-gap/SKILL.md (or your agent's skills folder).
name
nostr-rest-api-field-mapping-gap
description
Fix features broken by REST API responses that flatten Nostr events, losing tag data. Use when: (1) A feature works for WebSocket-loaded events but not REST API-loaded ones, (2) A model field (like sha256, textTrackRef) is null for REST API data but set for WebSocket data, (3) REST API returns denormalized fields (d_tag, video_url) but omits raw tags array, (4) hasSubtitles/hasFeature returns false for REST-loaded videos. Common in Nostr clients that use both REST APIs (for analytics/bulk queries) and WebSocket (for real-time events).
author
Claude Code
version
1.0.0
date
2026-02-23

Nostr REST API Field Mapping Gap

Problem

Nostr clients that use both REST APIs and WebSocket connections to load events can have features that work inconsistently. Features that depend on Nostr tag values (like the x tag for sha256, or custom tags for text tracks) work when events are loaded via WebSocket (which provides the full raw event with all tags), but break when the same events are loaded via REST API (which returns flattened/denormalized JSON without the raw tags array).

Context / Trigger Conditions

  • A feature works for some videos/events but not others (data source dependent)
  • A UI element (like a CC button) shows for WebSocket-loaded events but not REST ones
  • A model has null fields that should be populated (sha256, textTrackRef, etc.)
  • The REST API response has fields like d_tag, video_url, title but NO tags array
  • The fromJson() factory parses tags for values like x (sha256), but the REST API doesn't include raw tags
  • hasSubtitles, hasFeature, or similar getters return false for REST API data

Root Cause

REST APIs that index Nostr events typically:

  1. Extract commonly-used tag values into dedicated columns (d_tag, title, thumbnail, etc.)
  2. Do NOT return the full raw tags array in their response
  3. May have semantically equivalent fields under different names

For example, in a Blossom-based video system:

  • The Nostr x tag contains the SHA256 content hash
  • The REST API returns d_tag (which for Blossom uploads IS the SHA256) but not sha256
  • The model's fromJson() tries to find sha256 from direct field or x tag, finds neither
  • Features that depend on sha256 (like subtitle fetching) break silently

Solution

Step 1: Identify the mapping gap

Compare what the REST API returns vs what the model needs:

bash
# Fetch a sample REST API response
curl -s "https://your-api.example.com/api/videos?limit=1" | jq '.[0] | keys'

Check which model fields are null after parsing:

  • Look at the fromJson() factory method
  • Identify fields populated from tag parsing (tags array) that won't exist in REST response
  • Check if any REST API fields are semantically equivalent but differently named
Step 2: Add fallback mappings

In the model's fromJson(), add fallback logic AFTER the primary parsing:

dart
// Primary: try direct field and tags
var sha256 = eventData['sha256']?.toString() ?? json['sha256']?.toString();

// Parse from tags if available
if (eventData['tags'] is List) {
  // ... tag parsing for 'x' tag ...
}

// Normalize
if (sha256 != null && sha256.isEmpty) sha256 = null;

// FALLBACK: Use semantically equivalent field from REST API
// For Blossom uploads, d_tag IS the content hash (64 hex chars)
if (sha256 == null && dTag.length == 64 && _isHex(dTag)) {
  sha256 = dTag;
}
Step 3: Validate the fallback is safe

Ensure the fallback only triggers when appropriate:

  • Check format/length (SHA256 = 64 hex chars)
  • Don't override explicitly-set values
  • Handle edge cases (classic imports where d_tag is NOT a hash)
Show full SKILL.md (221 more words)Show less
Step 4: Add tests
dart
test('falls back to d_tag as sha256 when d_tag is 64-char hex', () {
  final json = {
    'd_tag': 'a04b70820ef370e90aae19d23e46b1482d3af0e7c9d994d1594a1384a62d3972',
    // No sha256 field, no tags array (REST API response)
    ...otherFields,
  };
  final model = Model.fromJson(json);
  expect(model.sha256, equals(json['d_tag']));
});

test('does not use d_tag as sha256 when d_tag is not a hex hash', () {
  final json = {'d_tag': 'my-video-slug', ...otherFields};
  final model = Model.fromJson(json);
  expect(model.sha256, isNull);
});

test('does not override explicit sha256 with d_tag', () {
  final json = {
    'd_tag': 'a04b708...', // 64 hex
    'sha256': 'explicit-value',
    ...otherFields,
  };
  final model = Model.fromJson(json);
  expect(model.sha256, equals('explicit-value'));
});

Verification

  1. Load the app and navigate to a feed that uses the REST API (e.g., trending/discovery)
  2. Verify the feature works (e.g., CC button shows AND subtitles display when toggled)
  3. Also verify WebSocket-loaded events still work (e.g., home feed from followed users)
  4. Check that non-hash d_tags (classic imports, custom slugs) don't get false positives

Debugging Approach

When a feature works inconsistently across events:

  1. Identify data source: Is the broken event from REST API or WebSocket?
  2. Compare raw data: Fetch the same event from both sources, diff the fields
  3. Trace the pipeline: API response -> fromJson() -> model -> getter -> UI condition
  4. Check conditional guards: Look for if (model.hasX) or if (field != null) in UI
  5. Log at the model level: Add temporary logging in fromJson() to see what's null

Notes

  • This pattern applies to ANY Nostr client that uses both REST and WebSocket data sources
  • The REST API may evolve to include more fields over time, so the fallback approach is forward-compatible (explicit fields take priority over fallbacks)
  • Consider requesting the REST API team add the missing fields directly
  • The _isHex() validation prevents false positives from non-hash d_tag values
  • Similar gaps may exist for other tag-derived fields (textTrackRef, duration, etc.)
  • rest-api-optimistic-update-race-condition - Another REST API data consistency issue
  • nostr-addressable-event-d-tag-requirement - Related d_tag handling

© 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/nostr-rest-api-field-mapping-gap of divinevideo/divine-mobile.

Open the folder on GitHubat commit 6487b05

Compare with similar skills

Nostr REST API Field Mapping Gap 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.

Nostr REST API Field Mapping Gap compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Nostr REST API Field Mapping Gap this skilldivinevideo/divine-mobile266—~1.5kAutomated safety check: PassMPL-2.0
Use Yaakmountain-loop/yaak19k—~1.9kAutomated safety check: PassMIT
Binance Datatoollostleaf/binance-datatool148—~2.5kAutomated safety check: NotesBSD-3-Clause
Action Cable PatternsThibautBaissac/rails_ai_agents665—~1.2kAutomated safety check: PassMIT
Cb Realtime APIBlkLeg/CircuitBreaker201—~1.7kAutomated safety check: PassMIT
Domain Webfjrevoredo/mini-diarium3081 repos~1kAutomated safety check: PassMIT

Similar skills

  • Use Yaak

    mountain-loop/yaak

    A skill your agent uses when the user mentions Yaak, a Yaak workspace, or the yaak command, or asks to call, hit, or smoke test HTTP/REST endpoints, save or organize API requests for reuse or manual…

    19k GitHub stars~1.9k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Binance Datatool

    lostleaf/binance-datatool

    Manage Binance historical market data from data.binance.vision using the binance-datatool CLI.

    148 GitHub stars~2.5k tokensUpdated 5 mo ago
    Backend & APIsAuto-check: notes
  • Action Cable Patterns

    ThibautBaissac/rails_ai_agents

    Implements real-time features with Action Cable and WebSockets.

    665 GitHub stars~1.2k tokensUpdated 4 mo ago
    Backend & APIsAuto-check passed
  • Cb Realtime API

    BlkLeg/CircuitBreaker

    How Circuit Breaker moves data between backend and frontend — the NATS internal bus, Redis pub/sub, the WebSocket stream endpoints and their first-message JWT handshake, SSE log/event streams, and…

    201 GitHub stars~1.7k tokensUpdated 4 days ago
    Backend & APIsAuto-check passed
  • Domain Web

    fjrevoredo/mini-diarium

    A skill your agent uses when building web services. An agent skill from fjrevoredo/mini-diarium.

    308 GitHub starsUsed in 1 repo~1k tokens
    Backend & APIsAuto-check passed
  • FastAPI Expert

    Jeffallan/claude-skills

    Builds async Python APIs with FastAPI and Pydantic V2, covering endpoints, JWT authentication, async SQLAlchemy, WebSockets and pytest checks against the OpenAPI docs.

    12k GitHub stars~1.8k tokensUpdated 6 days ago
    Backend & APIsAuto-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

Categories

Questions about Nostr REST API Field Mapping Gap

What does Nostr REST API Field Mapping Gap do?

Fix features broken by REST API responses that flatten Nostr events, losing tag data. Nostr REST API Field Mapping Gap is an agent skill from divinevideo/divine-mobile. Fix features broken by REST API responses that flatten Nostr events, losing tag data.

When should I use Nostr REST API Field Mapping Gap?

Nostr REST API Field Mapping Gap fits situations like: A feature works for WebSocket-loaded events but not REST API-loaded ones; A model field (like sha256; textTrackRef) is null for REST API data but set for WebSocket data; REST API returns denormalized fields (dtag.

How do I install Nostr REST API Field Mapping Gap in Claude Code?

Run `npx skills add divinevideo/divine-mobile --skill nostr-rest-api-field-mapping-gap -a claude-code`. Or copy the skill folder (.agents/skills/nostr-rest-api-field-mapping-gap in divinevideo/divine-mobile) into .claude/skills/nostr-rest-api-field-mapping-gap in your project. Claude Code loads it when a task matches its description.

How do I install Nostr REST API Field Mapping Gap in Codex?

Run `npx skills add divinevideo/divine-mobile --skill nostr-rest-api-field-mapping-gap -a codex`. Or copy the skill folder (.agents/skills/nostr-rest-api-field-mapping-gap in divinevideo/divine-mobile) into .agents/skills/nostr-rest-api-field-mapping-gap in your project. Codex loads it when a task matches its description.

Can I use Nostr REST API Field Mapping Gap 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 nostr-rest-api-field-mapping-gap -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/nostr-rest-api-field-mapping-gap, .gemini/skills/nostr-rest-api-field-mapping-gap, .github/skills/nostr-rest-api-field-mapping-gap and .opencode/skills/nostr-rest-api-field-mapping-gap in your project.

What does Nostr REST API Field Mapping Gap need to run?

Going by SKILL.md and its folder, Nostr REST API Field Mapping Gap needs the command-line tools its instructions call (curl and jq).

Does Nostr REST API Field Mapping Gap access the network?

SKILL.md contains no URLs. Its commands use curl, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Nostr REST API Field Mapping Gap 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 Nostr REST API Field Mapping Gap use?

Nostr REST API Field Mapping Gap 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 Nostr REST API Field Mapping Gap use?

About 1.5k tokens (SKILL.md is roughly 6.1k 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 Nostr REST API Field Mapping Gap?

Skills that share tags, products or a category with Nostr REST API Field Mapping Gap: Use Yaak (mountain-loop/yaak, 19k stars), Binance Datatool (lostleaf/binance-datatool, 148 stars), Action Cable Patterns (ThibautBaissac/rails_ai_agents, 665 stars) and Cb Realtime API (BlkLeg/CircuitBreaker, 201 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Nostr REST API Field Mapping Gap?

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 9, 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.