jpskill.com
📦 その他 コミュニティ

nostr-event-builder

自然な言葉で説明からNostrイベントを構築し、種類に応じたタグ構造を作成、NIP-10スレッドやNIP-22コメントを実装、適切なe/p/aタグとJSON形式でイベントを生成するSkill。

📜 元の英語説明(参考)

Use when constructing Nostr events from natural language descriptions, building kind-specific tag structures, implementing NIP-10 threading for kind:1 replies, creating NIP-22 comments on non-note content, or generating correct event JSON with proper e/p/a tag markers and serialization format.

🇯🇵 日本人クリエイター向け解説

一言でいうと

自然な言葉で説明からNostrイベントを構築し、種類に応じたタグ構造を作成、NIP-10スレッドやNIP-22コメントを実装、適切なe/p/aタグとJSON形式でイベントを生成するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o nostr-event-builder.zip https://jpskill.com/download/9135.zip && unzip -o nostr-event-builder.zip && rm nostr-event-builder.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9135.zip -OutFile "$d\nostr-event-builder.zip"; Expand-Archive "$d\nostr-event-builder.zip" -DestinationPath $d -Force; ri "$d\nostr-event-builder.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して nostr-event-builder.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → nostr-event-builder フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Nostr Event Builder

概要

自然言語による記述から、正しい Nostr イベント構造を構築します。 このスキルは、自明ではない部分、つまり適切な kind の選択、正しいマーカーを持つ適切なタグ配列の構築、NIP-10 と NIP-22 のスレッド化ルールの適用、署名可能な有効なイベント JSON の生成を処理します。

どのような時に使うか

  • 開発者が Nostr で公開したい内容を記述する場合
  • 返信スレッドの構築 (NIP-10 kind:1 の返信)
  • ノート以外のコンテンツへのコメント (NIP-22 kind:1111 のコメント)
  • ユーザープロファイルの作成または更新 (kind:0 メタデータ)
  • 任意の Nostr イベントの構築で、タグ構造が不明な場合
  • 不正な形式のイベントのデバッグ (間違ったマーカー、タグの欠落)

使用すべきでない場合:

  • リレーの WebSocket ロジックの実装 (これはリレープロトコルであり、イベント構築ではありません)
  • NIP-19 のエンコード/デコードの操作 (bech32 に関するものであり、イベント構造ではありません)
  • サブスクリプションフィルターの構築 (REQ メッセージであり、EVENT メッセージではありません)

ワークフロー

1. イベントの種類を特定する

質問: 「開発者は何を公開しようとしていますか?」

意図 Kind カテゴリ 主要な NIP
短いテキストノートを投稿する 1 通常 NIP-10
kind:1 のノートに返信する 1 通常 NIP-10
kind:1 以外のコンテンツにコメントする 1111 通常 NIP-22
ユーザープロファイルを設定/更新する 0 置換可能 NIP-01
フォローリストを更新する 3 置換可能 NIP-02
イベントを削除する 5 通常 NIP-09
ノートをリポストする 6 通常 NIP-18
イベントにリアクションする 7 通常 NIP-25
長文記事を公開する 30023 アドレス指定可能 NIP-23

完全な kind から構造へのマッピングについては、references/event-kinds.md を参照してください。

重要なルーティングルール:

ターゲットは kind:1 のノートですか?
  YES → NIP-10 の e-tag マーカーを持つ kind:1 の返信を使用する
  NO  → NIP-22 の大文字/小文字タグを持つ kind:1111 のコメントを使用する

2. タグ配列を構築する

タグは最も難しい部分です。kind に応じたタグガイドに従ってください。

kind:1 の返信の場合 (NIP-10):

ルートへの直接返信 (中間返信なし):

{
  "kind": 1,
  "tags": [
    ["e", "<root-event-id>", "<relay-url>", "root", "<root-author-pubkey>"],
    ["p", "<root-author-pubkey>"]
  ],
  "content": "返信テキスト"
}

スレッド内の返信への返信:

{
  "kind": 1,
  "tags": [
    ["e", "<root-event-id>", "<relay-url>", "root", "<root-author-pubkey>"],
    [
      "e",
      "<parent-event-id>",
      "<relay-url>",
      "reply",
      "<parent-author-pubkey>"
    ],
    ["p", "<root-author-pubkey>"],
    ["p", "<parent-author-pubkey>"]
  ],
  "content": "返信テキスト"
}

kind:1111 のコメントの場合 (NIP-22):

通常のイベントへのトップレベルのコメント:

{
  "kind": 1111,
  "tags": [
    ["E", "<root-event-id>", "<relay-url>", "<root-author-pubkey>"],
    ["K", "<root-event-kind>"],
    ["P", "<root-author-pubkey>", "<relay-url>"],
    ["e", "<root-event-id>", "<relay-url>", "<root-author-pubkey>"],
    ["k", "<root-event-kind>"],
    ["p", "<root-author-pubkey>", "<relay-url>"]
  ],
  "content": "コメントテキスト"
}

アドレス指定可能なイベントへのトップレベルのコメント (kind 30000-39999):

{
  "kind": 1111,
  "tags": [
    ["A", "<kind>:<pubkey>:<d-tag>", "<relay-url>"],
    ["K", "<root-event-kind>"],
    ["P", "<root-author-pubkey>", "<relay-url>"],
    ["a", "<kind>:<pubkey>:<d-tag>", "<relay-url>"],
    ["e", "<event-id>", "<relay-url>"],
    ["k", "<root-event-kind>"],
    ["p", "<root-author-pubkey>", "<relay-url>"]
  ],
  "content": "コメントテキスト"
}

URL または外部識別子へのコメント:

{
  "kind": 1111,
  "tags": [
    ["I", "<url-or-identifier>"],
    ["K", "<identifier-type>"],
    ["i", "<url-or-identifier>"],
    ["k", "<identifier-type>"]
  ],
  "content": "コメントテキスト"
}

既存のコメントへの返信:

{
  "kind": 1111,
  "tags": [
    ["E", "<original-root-event-id>", "<relay-url>", "<root-author-pubkey>"],
    ["K", "<original-root-kind>"],
    ["P", "<root-author-pubkey>"],
    [
      "e",
      "<parent-comment-id>",
      "<relay-url>",
      "<parent-comment-author-pubkey>"
    ],
    ["k", "1111"],
    ["p", "<parent-comment-author-pubkey>"]
  ],
  "content": "コメントへの返信"
}

完全なタグのセマンティクスについては、references/tag-guide.md を参照してください。

3. Content フィールドを設定する

Content の形式は kind によって異なります。

Kind Content の形式
0 文字列化された JSON: {"name":"...","about":"...","picture":"..."}
1 プレーンテキスト (マークダウン、HTML は不可)
5 オプションの削除理由テキスト
6 リポストされたイベントの文字列化された JSON
7 + (いいね)、- (よくないね)、または絵文字
1111 プレーンテキストのコメント
30023 マークダウン形式の記事本文

4. 完全なイベントを構築する

署名されていないイベントオブジェクトを組み立てます。

{
  "pubkey": "<32-bytes-lowercase-hex-public-key>",
  "created_at": "<unix-timestamp-seconds>",
  "kind": "<integer>",
  "tags": [["..."]],
  "content": "<string>"
}

id は、シリアライズされた形式の SHA-256 として計算されます。

[0, "<pubkey>", <created_at>, <kind>, <tags>, "<content>"]

シリアライズのルール:

  • UTF-8 エンコーディング、空白/フォーマットなし
  • content 内のエスケープ: \n, \", \\, \r, \t, \b, \f
  • その他のすべての文字はそのまま

sig は、id の Schnorr 署名 (secp256k1) です。

5. 署名前に検証する

イベントの準備が整う前のチェックリスト:

  • [ ] kind が意図に対して正しい
  • [ ] この kind に必要なすべてのタグが存在する
  • [ ]

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Nostr Event Builder

Overview

Construct correct Nostr event structures from natural language descriptions. This skill handles the non-obvious parts: choosing the right kind, building proper tag arrays with correct markers, enforcing NIP-10 vs NIP-22 threading rules, and producing valid event JSON ready for signing.

When to Use

  • Developer describes what they want to publish on Nostr
  • Building reply threads (NIP-10 kind:1 replies)
  • Commenting on non-note content (NIP-22 kind:1111 comments)
  • Creating or updating user profiles (kind:0 metadata)
  • Constructing any Nostr event and unsure about tag structure
  • Debugging malformed events (wrong markers, missing tags)

Do NOT use when:

  • Implementing relay WebSocket logic (that's relay protocol, not event building)
  • Working with NIP-19 encoding/decoding (bech32 concerns, not event structure)
  • Building subscription filters (REQ messages, not EVENT messages)

Workflow

1. Identify the Event Kind

Ask: "What is the developer trying to publish?"

Intent Kind Category Key NIP
Post a short text note 1 Regular NIP-10
Reply to a kind:1 note 1 Regular NIP-10
Comment on non-kind:1 content 1111 Regular NIP-22
Set/update user profile 0 Replaceable NIP-01
Update follow list 3 Replaceable NIP-02
Delete events 5 Regular NIP-09
Repost a note 6 Regular NIP-18
React to an event 7 Regular NIP-25
Publish a long-form article 30023 Addressable NIP-23

See references/event-kinds.md for full kind-to-structure mapping.

Critical routing rule:

Is the target a kind:1 note?
  YES → Use kind:1 reply with NIP-10 e-tag markers
  NO  → Use kind:1111 comment with NIP-22 uppercase/lowercase tags

2. Build the Tag Array

Tags are the hardest part. Follow the tag guide for your kind:

For kind:1 replies (NIP-10):

Direct reply to root (no intermediate replies):

{
  "kind": 1,
  "tags": [
    ["e", "<root-event-id>", "<relay-url>", "root", "<root-author-pubkey>"],
    ["p", "<root-author-pubkey>"]
  ],
  "content": "Your reply text"
}

Reply to a reply in a thread:

{
  "kind": 1,
  "tags": [
    ["e", "<root-event-id>", "<relay-url>", "root", "<root-author-pubkey>"],
    [
      "e",
      "<parent-event-id>",
      "<relay-url>",
      "reply",
      "<parent-author-pubkey>"
    ],
    ["p", "<root-author-pubkey>"],
    ["p", "<parent-author-pubkey>"]
  ],
  "content": "Your reply text"
}

For kind:1111 comments (NIP-22):

Top-level comment on a regular event:

{
  "kind": 1111,
  "tags": [
    ["E", "<root-event-id>", "<relay-url>", "<root-author-pubkey>"],
    ["K", "<root-event-kind>"],
    ["P", "<root-author-pubkey>", "<relay-url>"],
    ["e", "<root-event-id>", "<relay-url>", "<root-author-pubkey>"],
    ["k", "<root-event-kind>"],
    ["p", "<root-author-pubkey>", "<relay-url>"]
  ],
  "content": "Your comment text"
}

Top-level comment on an addressable event (kind 30000-39999):

{
  "kind": 1111,
  "tags": [
    ["A", "<kind>:<pubkey>:<d-tag>", "<relay-url>"],
    ["K", "<root-event-kind>"],
    ["P", "<root-author-pubkey>", "<relay-url>"],
    ["a", "<kind>:<pubkey>:<d-tag>", "<relay-url>"],
    ["e", "<event-id>", "<relay-url>"],
    ["k", "<root-event-kind>"],
    ["p", "<root-author-pubkey>", "<relay-url>"]
  ],
  "content": "Your comment text"
}

Comment on a URL or external identifier:

{
  "kind": 1111,
  "tags": [
    ["I", "<url-or-identifier>"],
    ["K", "<identifier-type>"],
    ["i", "<url-or-identifier>"],
    ["k", "<identifier-type>"]
  ],
  "content": "Your comment text"
}

Reply to an existing comment:

{
  "kind": 1111,
  "tags": [
    ["E", "<original-root-event-id>", "<relay-url>", "<root-author-pubkey>"],
    ["K", "<original-root-kind>"],
    ["P", "<root-author-pubkey>"],
    [
      "e",
      "<parent-comment-id>",
      "<relay-url>",
      "<parent-comment-author-pubkey>"
    ],
    ["k", "1111"],
    ["p", "<parent-comment-author-pubkey>"]
  ],
  "content": "Your reply to the comment"
}

See references/tag-guide.md for complete tag semantics.

3. Set the Content Field

Content format depends on the kind:

Kind Content Format
0 Stringified JSON: {"name":"...","about":"...","picture":"..."}
1 Plaintext (no markdown, no HTML)
5 Optional deletion reason text
6 Stringified JSON of the reposted event
7 + (like), - (dislike), or emoji
1111 Plaintext comment
30023 Markdown-formatted article body

4. Construct the Complete Event

Assemble the unsigned event object:

{
  "pubkey": "<32-bytes-lowercase-hex-public-key>",
  "created_at": "<unix-timestamp-seconds>",
  "kind": "<integer>",
  "tags": [["..."]],
  "content": "<string>"
}

The id is computed as SHA-256 of the serialized form:

[0, "<pubkey>", <created_at>, <kind>, <tags>, "<content>"]

Serialization rules:

  • UTF-8 encoding, no whitespace/formatting
  • Escape in content: \n, \", \\, \r, \t, \b, \f
  • All other characters verbatim

The sig is a Schnorr signature (secp256k1) of the id.

5. Validate Before Signing

Checklist before the event is ready:

  • [ ] kind is correct for the intent
  • [ ] All required tags present for this kind
  • [ ] e tags have correct markers (root/reply for kind:1)
  • [ ] p tags include ALL participants in the thread
  • [ ] NIP-10 kind:1 replies only target other kind:1 events
  • [ ] NIP-22 kind:1111 comments do NOT target kind:1 events
  • [ ] K and k tags present for kind:1111 comments
  • [ ] Uppercase tags (E/A/I/K/P) point to root scope in kind:1111
  • [ ] Lowercase tags (e/a/i/k/p) point to parent item in kind:1111
  • [ ] content format matches the kind's requirements
  • [ ] created_at is a Unix timestamp in seconds (not milliseconds)
  • [ ] All hex values are 32-byte lowercase

Common Mistakes

Mistake Why It Breaks Fix
Using kind:1 to reply to a kind:30023 article NIP-10 kind:1 replies MUST only reply to other kind:1 events Use kind:1111 (NIP-22 comment) for non-kind:1 targets
Using kind:1111 to reply to a kind:1 note NIP-22 comments MUST NOT reply to kind:1 Use kind:1 with NIP-10 e-tag markers
Missing root marker on e tags in kind:1 Clients can't reconstruct the thread tree Always use marked e tags: ["e", "<id>", "<relay>", "root"]
Only one e tag with reply marker (no root) Direct replies to root need root marker, not reply Single e tag = use root marker only
Missing p tags for thread participants Users don't get notified of replies Include p tags for ALL pubkeys in the thread
Lowercase e/k/p tags for root scope in kind:1111 Root scope MUST use uppercase E/K/P tags Uppercase = root scope, lowercase = parent item
Missing K or k tags in kind:1111 Both are REQUIRED by NIP-22 Always include ["K", "<root-kind>"] and ["k", "<parent-kind>"]
created_at in milliseconds Nostr uses seconds, not milliseconds Use Math.floor(Date.now() / 1000)
Content as object instead of string for kind:0 Content must be stringified JSON Use JSON.stringify({name: "...", ...})
Missing d tag on addressable events (30000-39999) Relay can't address the event properly Always include ["d", "<identifier>"]
Positional e tags without markers Deprecated; creates ambiguity in thread reconstruction Always use marked e tags with root/reply

Kind Category Quick Reference

Range Category Behavior
1000-9999, 4-44, 1, 2 Regular Stored by relays, all kept
10000-19999, 0, 3 Replaceable Latest per pubkey+kind kept
20000-29999 Ephemeral Not stored by relays
30000-39999 Addressable Latest per pubkey+kind+d-tag kept

Example: Complete Event Construction

User says: "I want to reply to my friend's note in an existing thread"

Step 1 — Identify kind: Replying to a kind:1 note → use kind:1 (NIP-10)

Step 2 — Determine thread position: This is a reply to a reply (not the root), so we need both root and reply e tags.

Step 3 — Build the event:

{
  "pubkey": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2",
  "created_at": 1709827200,
  "kind": 1,
  "tags": [
    ["e", "aaa111...", "wss://relay.example.com", "root", "f7234bd4..."],
    ["e", "bbb222...", "wss://relay.example.com", "reply", "93ef2eba..."],
    ["p", "f7234bd4...", "wss://relay.example.com"],
    ["p", "93ef2eba...", "wss://relay.example.com"]
  ],
  "content": "Great point! I totally agree with this take."
}

Step 4 — Validate: Root e tag has root marker ✓, reply e tag has reply marker ✓, p tags include both the root author and the parent author ✓, content is plaintext ✓.