Communitygithub.com

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

What is skills?

skills is a Cursor agent skill that threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

Works with~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/comments-discussions

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Comments & Discussions

Rules

  • Threaded comments: parent_id foreign key on comments table — null for top-level, references parent for replies
  • Optimistic UI: add comment to UI immediately, confirm with server response, rollback on error
  • @mentions: parse @username in comment body — trigger user lookup dropdown on @ keystroke, notify mentioned users
  • Reactions: separate reactions table (commentId, userId, emoji) — unique constraint on (commentId, userId, emoji)
  • Moderation: status field (published, flagged, removed) — moderation queue for flagged content, auto-flag with word list
  • Soft delete: set deletedAt timestamp — show "deleted" placeholder for comments with replies, fully hide orphaned deleted comments
  • Cursor pagination: cursor (commentId) + limit — ordered by createdAt, load older comments on scroll
  • Edit history: store edits in separate table or JSON array — show "edited" indicator with last edit timestamp

Patterns

// Comment data model
// comments: id, postId, authorId, parentId (nullable), body, status, deletedAt, createdAt, updatedAt
// reactions: id, commentId, userId, emoji, createdAt (unique: [commentId, userId, emoji])
// mentions: id, commentId, mentionedUserId, createdAt

// Threaded query — fetch top-level + nested replies
const comments = await db.query.comments.findMany({
  where: and(eq(comments.postId, postId), isNull(comments.parentId)),
  with: {
    author: { columns: { id: true, name: true, avatar: true } },
    replies: {
      with: { author: { columns: { id: true, name: true, avatar: true } } },
      orderBy: [asc(comments.createdAt)],
    },
    reactions: true,
  },
  orderBy: [desc(comments.createdAt)],
  limit: 20,
});

// Optimistic comment add (React Query)
const addComment = useMutation({
  mutationFn: (body: string) => api.post(`/posts/${postId}/comments`, { body }),
  onMutate: async (body) => {
    await queryClient.cancelQueries({ queryKey: ["comments", postId] });
    const previous = queryClient.getQueryData(["comments", postId]);
    queryClient.setQueryData(["comments", postId], (old: Comment[]) => [
      { id: `temp-${Date.now()}`, body, author: currentUser, createdAt: new Date() },
      ...old,
    ]);
    return { previous };
  },
  onError: (_err, _body, context) => {
    queryClient.setQueryData(["comments", postId], context?.previous);
  },
  onSettled: () => queryClient.invalidateQueries({ queryKey: ["comments", postId] }),
});

Avoid

  • Unlimited nesting depth — cap at 2-3 levels, then flatten deeper replies
  • Loading all comments at once — use cursor pagination, especially for active discussions
  • Client-side mention parsing only — validate and extract mentions server-side for notifications
  • Hard deleting comments with replies — this orphans the thread; soft delete and show placeholder
  • Reactions without unique constraints — allows duplicate reactions from the same user

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Tool-use patterns, multi-step reasoning, agent orchestration, and structured outputs.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Web analytics integration — event tracking, custom dashboards, privacy-first.

YepAPI/skills

Framer Motion — transitions, scroll animations, layout animations.

YepAPI/skills

OpenAPI 3.1 from Zod schemas, interactive docs with Swagger/Scalar, versioning, and example requests for every endpoint.

YepAPI/skills

Authentication security — bcrypt/argon2 hashing, brute force protection, secure password resets.

YepAPI/skills

Session auth, social providers, CSRF protection, and secure cookie patterns.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Link building research and backlink audit using YepAPI.

YepAPI/skills

MDX blog setup, RSS feed generation, sitemap.xml, structured data/JSON-LD, and related posts.

YepAPI/skills

Redis caching, CDN cache headers, stale-while-revalidate, cache invalidation, React Query.

YepAPI/skills

Recharts/Chart.js data visualization — bar, line, area, pie charts.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Blog engine setup, CMS integration, SEO-optimized content workflows, and editorial calendars.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

Related Skills