From 29913ef53067096c9ca262faecfd0cc7f08481a5 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 26 Apr 2026 17:57:46 -0500 Subject: [PATCH] Extract comment system into the nostr-comments skill Moves the NIP-22 (kind 1111) commenting stack out of src/ and into .agents/skills/nostr-comments/files/ \u2014 useComments, usePostComment, and the Comment / CommentForm / CommentsSection components. Updates the existing SKILL.md with a setup preamble explaining how to copy the files back into src/ when a project needs comment functionality. No dependency changes were required; the skill only uses packages already present in the template. --- .agents/skills/nostr-comments/SKILL.md | 38 ++++++++++++++++++- .../files}/components/comments/Comment.tsx | 0 .../components/comments/CommentForm.tsx | 0 .../components/comments/CommentsSection.tsx | 0 .../files}/hooks/useComments.ts | 0 .../files}/hooks/usePostComment.ts | 0 6 files changed, 37 insertions(+), 1 deletion(-) rename {src => .agents/skills/nostr-comments/files}/components/comments/Comment.tsx (100%) rename {src => .agents/skills/nostr-comments/files}/components/comments/CommentForm.tsx (100%) rename {src => .agents/skills/nostr-comments/files}/components/comments/CommentsSection.tsx (100%) rename {src => .agents/skills/nostr-comments/files}/hooks/useComments.ts (100%) rename {src => .agents/skills/nostr-comments/files}/hooks/usePostComment.ts (100%) diff --git a/.agents/skills/nostr-comments/SKILL.md b/.agents/skills/nostr-comments/SKILL.md index 45feaa1..826792b 100644 --- a/.agents/skills/nostr-comments/SKILL.md +++ b/.agents/skills/nostr-comments/SKILL.md @@ -5,7 +5,43 @@ description: Implement Nostr comment systems, add discussion features to posts/a # Adding Nostr Comments Sections -The project includes a complete commenting system using NIP-22 (kind 1111) comments that can be added to any Nostr event, URL, hashtag, or NIP-73 external content identifier. The `CommentsSection` component provides a full-featured commenting interface with threaded replies, user authentication, and real-time updates. +This skill provides a complete commenting system using NIP-22 (kind 1111) comments that can be added to any Nostr event, URL, hashtag, or NIP-73 external content identifier. The `CommentsSection` component provides a full-featured commenting interface with threaded replies, user authentication, and real-time updates. + +**The comment system is not included in the project by default.** When the user wants comment functionality, follow the setup instructions below to install the files. + +## Files Provided by This Skill + +All files live under `.agents/skills/nostr-comments/files/` and must be copied into `src/` preserving the directory structure: + +| Skill file | Copy to | +|---|---| +| `files/hooks/useComments.ts` | `src/hooks/useComments.ts` | +| `files/hooks/usePostComment.ts` | `src/hooks/usePostComment.ts` | +| `files/components/comments/Comment.tsx` | `src/components/comments/Comment.tsx` | +| `files/components/comments/CommentForm.tsx` | `src/components/comments/CommentForm.tsx` | +| `files/components/comments/CommentsSection.tsx` | `src/components/comments/CommentsSection.tsx` | + +## Setup Instructions + +### 1. Dependencies + +No extra npm packages are required — the skill uses only packages already present in the template (`@nostrify/nostrify`, `@nostrify/react`, `@tanstack/react-query`, `nostr-tools`, `date-fns`, `lucide-react`, `react-router-dom`, and shadcn/ui components). + +### 2. Copy the Skill Files Into `src/` + +Copy every file listed in the table above from `.agents/skills/nostr-comments/files/` into its corresponding location under `src/`. Preserve the exact paths — the files use `@/hooks/...` and `@/components/...` imports that depend on these locations. + +### 3. Required Project Components + +The comment components depend on pieces that already ship with the template: + +- `@/components/NoteContent` — renders comment text (used by `Comment.tsx`) +- `@/components/auth/LoginArea` — shown to logged-out users (used by `CommentForm.tsx`) +- `@/hooks/useAuthor` — fetches comment author profile (used by `Comment.tsx`) +- `@/hooks/useCurrentUser` — determines whether to show the composer (used by `CommentForm.tsx`) +- `@/hooks/useNostrPublish` — publishes kind 1111 events (used by `usePostComment.ts`) + +All of these are standard in the template; no extra work is needed beyond copying the skill files. ## Basic Usage diff --git a/src/components/comments/Comment.tsx b/.agents/skills/nostr-comments/files/components/comments/Comment.tsx similarity index 100% rename from src/components/comments/Comment.tsx rename to .agents/skills/nostr-comments/files/components/comments/Comment.tsx diff --git a/src/components/comments/CommentForm.tsx b/.agents/skills/nostr-comments/files/components/comments/CommentForm.tsx similarity index 100% rename from src/components/comments/CommentForm.tsx rename to .agents/skills/nostr-comments/files/components/comments/CommentForm.tsx diff --git a/src/components/comments/CommentsSection.tsx b/.agents/skills/nostr-comments/files/components/comments/CommentsSection.tsx similarity index 100% rename from src/components/comments/CommentsSection.tsx rename to .agents/skills/nostr-comments/files/components/comments/CommentsSection.tsx diff --git a/src/hooks/useComments.ts b/.agents/skills/nostr-comments/files/hooks/useComments.ts similarity index 100% rename from src/hooks/useComments.ts rename to .agents/skills/nostr-comments/files/hooks/useComments.ts diff --git a/src/hooks/usePostComment.ts b/.agents/skills/nostr-comments/files/hooks/usePostComment.ts similarity index 100% rename from src/hooks/usePostComment.ts rename to .agents/skills/nostr-comments/files/hooks/usePostComment.ts