Skip to content

Instantly share code, notes, and snippets.

@koteitan
Created January 17, 2026 16:29
Show Gist options
  • Select an option

  • Save koteitan/ec58fd86d825384c39392ca04fa1d54d to your computer and use it in GitHub Desktop.

Select an option

Save koteitan/ec58fd86d825384c39392ca04fa1d54d to your computer and use it in GitHub Desktop.
custom slash command for nostr programming. put it in ~/.claude/commands/ and use it by /nostrproject

nostr use in this project

Nostr usage

to get app user's pubkey

to get follow list

  • fetch relay list:
    • from bootstrap relays
    • by rx-nostr backword strategy
    • by the filter kinds:[10002,3], limit:2, authors[pubkey you need]
    • with 5sec eose timeout
    • retry with adding the new rules:
      • with 30 sec eose timeout
      • go to the next step after getting the first kind:10002 event
    • basically use only kind:10002 relay list.
      • if there is no kind:10002 event, use kind:3 relay list for fall back.
      • if there is no relay list event, use fallback relays.
    • use a relay list with the newest created_at timestamp
    • remove relays only with "read" tag

to read app user's name, display_name and profile icon

  • after reading NIP-07:
    • read kind:0, limit:1, authors:[pubkey]
    • use the event with the newest created_at
    • read them:
      • profile icon:content.picture
      • name:content.name
      • display_name:content.display_name

to fetch follow list

  • fetch follow list:
    • from relay list + bootstrap relays
    • by rx-nostr backword strategy
    • by the filter kinds:[3], limit:1, authors:[pubkey]
    • with 5 sec eose timeout
    • retry with adding the new rules:
      • with 30 sec eose timeout
      • go to the next step after getting the first kind:10002 event
  • use a follow list with the newest created_at timestamp

to fetch kind:1 notes with forward strategy

  • subscribe kind:1 notes:
    • from relay list
    • by rx-nostr backword strategy
    • by the filter kinds:[1], authors:follow list pubkeys, limit:0
      • if there are over 1000 followings, use multiple subscriptions with 1000 authors each

to fetch kind:0 profiles of followers

  • fetch kind:0 profiles:
    • from relay list
    • by rx-nostr backword strategy
    • by the filter kinds:[0], authors:[200 following pubkeys each], limit:200

bootstrap relays

  • wss://directory.yabu.me
  • wss://purplepag.es
  • wss://relay.nostr.band
  • wss://indexer.coracle.social

fallback relays

  • if browser locale is "ja":
    • wss://yabu.me
    • wss://nostr.compile-error.net
    • wss://r.kojira.io
    • wss://relay-jp.nostr.wirednet.jp
    • wss://nrelay-jp.c-stellar.net
    • wss://nostream.ocha.one
    • wss://snowflare.cc
  • else:
    • wss://relay.damus.io
    • wss://nostr-pub.wellorder.net
    • wss://offchain.pub
    • wss://relay.snort.social

main project

  • the aboves are the part of main project.
  • ask what is the main project to me.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment