Communitygithub.com

YepAPI/skills

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

skills とは?

skills is a Claude Code agent skill that cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/command-palette

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Command Palette

Rules

  • Use cmdk library — composable, accessible, fast fuzzy search built-in
  • Trigger: Cmd+K (Mac) / Ctrl+K (Windows/Linux) — register global keyboard listener
  • Group actions: Navigation (pages), Commands (actions), Recent (last used) — show group headings
  • Keyboard navigation: arrow keys to move, Enter to select, Escape to close — all handled by cmdk
  • Fuzzy search: cmdk filters automatically — match highlighting with score-based ranking
  • Recent items: store last 5-10 selected items in localStorage — show at top when input is empty
  • Dynamic actions: register actions from different parts of the app — context-aware (show different actions on different pages)
  • Loading state: async search results (e.g., API search) — show loading indicator in results area

Patterns

import { Command } from "cmdk";
import { useEffect, useState } from "react";
import { useRouter } from "next/navigation";

function CommandPalette() {
  const [open, setOpen] = useState(false);
  const router = useRouter();

  // Global keyboard shortcut
  useEffect(() => {
    const handleKeyDown = (e: KeyboardEvent) => {
      if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
        e.preventDefault();
        setOpen((prev) => !prev);
      }
    };
    document.addEventListener("keydown", handleKeyDown);
    return () => document.removeEventListener("keydown", handleKeyDown);
  }, []);

  return (
    <Command.Dialog open={open} onOpenChange={setOpen} label="Command palette">
      <Command.Input placeholder="Search or type a command..." />
      <Command.List>
        <Command.Empty>No results found.</Command.Empty>

        <Command.Group heading="Recent">
          {recentItems.map((item) => (
            <Command.Item key={item.id} onSelect={() => { router.push(item.href); setOpen(false); }}>
              {item.label}
            </Command.Item>
          ))}
        </Command.Group>

        <Command.Group heading="Navigation">
          <Command.Item onSelect={() => { router.push("/dashboard"); setOpen(false); }}>
            Dashboard
          </Command.Item>
          <Command.Item onSelect={() => { router.push("/settings"); setOpen(false); }}>
            Settings
          </Command.Item>
        </Command.Group>

        <Command.Group heading="Commands">
          <Command.Item onSelect={() => { toggleTheme(); setOpen(false); }}>
            Toggle dark mode
          </Command.Item>
          <Command.Item onSelect={() => { logout(); setOpen(false); }}>
            Sign out
          </Command.Item>
        </Command.Group>
      </Command.List>
    </Command.Dialog>
  );
}

Avoid

  • Building custom fuzzy search — cmdk handles filtering, scoring, and ranking out of the box
  • Forgetting e.preventDefault() on Cmd+K — without it, the browser's default search/address bar opens
  • Missing Escape key handling — cmdk handles this via onOpenChange, but ensure focus returns to previous element
  • Static-only actions — register actions dynamically from page context (e.g., "Edit this post" only on post pages)
  • No empty state — always show "No results found" when search matches nothing

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

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

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.

関連スキル