PixelPilot uiux-fuzzy-search.instructions.md

PixelPilot uiux-fuzzy-search.instructions.md is an instructions file for GitHub Copilot from dev-lou/PixelPilot. It costs 4,344 tokens per session, scanned A, original, MIT.

Instructions for adding typo-tolerant search to a website or app. It uses tools such as Fuse.js or Lunr.js to find likely matches even when a search term is not exact.

In plain words
What is it for?
Use it to build client-side search over fields such as titles, descriptions, categories, and tags, with match highlighting and “did you mean?” suggestions.
Why use it?
It helps users find results despite spelling mistakes and explains how to handle delayed typing, highlighted matches, suggestions, and empty results.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/dev-lou/pixelpilot/uiux-fuzzy-search
Clone the repo
git clone --depth 1 https://github.com/dev-lou/PixelPilot

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for PixelPilot uiux-fuzzy-search.instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/dev-lou/pixelpilot/uiux-fuzzy-search.svg)](https://agentmods.dev/instructions/dev-lou/pixelpilot/uiux-fuzzy-search)
Your own site
<a href="https://agentmods.dev/instructions/dev-lou/pixelpilot/uiux-fuzzy-search"><img src="https://agentmods.dev/badge/instructions/dev-lou/pixelpilot/uiux-fuzzy-search.svg" alt="Measured on agentmods" height="20"></a>
Per session 4,344 This file is loaded in full into every session.
When invoked 4,344 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.04344 $0.04344
Opus 5 $0.02172 $0.02172
Sonnet 5 $0.00869 $0.00869
Haiku 4.5 $0.00434 $0.00434

Measured 5d ago against content hash d1765c72c749, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

PixelPilot uiux-fuzzy-search.instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

vscode/.github/instructions/uiux-fuzzy-search.instructions.md · 735 lines

How it starts

The opening of the file, as written. The whole thing — 735 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implement typo-tolerant search with match highlighting and suggestions. Uses Fuse.js for client-side fuzzy matching with token-aware styling.


OVERVIEW

This skill covers:

  1. Fuse.js/lunr.js setup and configuration
  2. Debounced input handling
  3. Match highlighting
  4. "Did you mean?" suggestions
  5. Empty state and no results handling
  6. Token-aware styling

INSTALLATION

# Fuse.js (recommended for most use cases)
npm install fuse.js

# lunr.js (for larger datasets with full-text search)
npm install lunr

FUSE.JS IMPLEMENTATION

Basic Setup

import Fuse from 'fuse.js';

interface SearchItem {
  id: string;
  title: string;
  description: string;
  category: string;
  tags: string[];
}

const fuseOptions: Fuse.IFuseOptions<SearchItem> = {
  // Which keys to search
  keys: [
    { name: 'title', weight: 2 },      // Higher weight = more important
    { name: 'description', weight: 1 },
    { name: 'category', weight: 1.5 },
    { name: 'tags', weight: 1 }
  ],
  
  // Fuzzy matching settings
  threshold: 0.4,          // 0 = exact match, 1 = match anything
  distance: 100,           // How far to search for a match
  minMatchCharLength: 2,   // Minimum characters before searching
  
  // Include match info for highlighting
  includeScore: true,
  includeMatches: true,
  
  // Performance
  ignoreLocation: true,    // Search entire string, not just beginning
  useExtendedSearch: true, // Enable advanced search patterns
};

// Create the search index
const fuse = new Fuse(items, fuseOptions);

// Search
const results = fuse.search('serch query'); // Typo-tolerant!

Search Component

import { useState, useMemo, useCallback } from 'react';
import Fuse from 'fuse.js';
import { Search, X, Loader2 } from 'lucide-react';
import { useDebounce } from '@/hooks/useDebounce';

interface FuzzySearchProps<T> {
  items: T[];
  keys: Fuse.FuseOptionKey<T>[];
  placeholder?: string;
  onSelect?: (item: T) => void;
  renderItem?: (item: T, matches: Fuse.FuseResultMatch[]) => React.ReactNode;
  emptyMessage?: string;
  threshold?: number;
}

export function FuzzySearch<T extends { id: string }>({
  items,
  keys,
  placeholder = 'Search...',
  onSelect,
  renderItem,
  emptyMessage = 'No results found',
  threshold = 0.4
}: FuzzySearchProps<T>) {
  const [query, setQuery] = useState('');
  const [isOpen, setIsOpen] = useState(false);
  const [selectedIndex, setSelectedIndex] = useState(0);
  
  const debouncedQuery = useDebounce(query, 200);
  
  // Create Fuse instance
  const fuse = useMemo(() => {
    return new Fuse(items, {
      keys,
      threshold,
      includeMatches: true,
      includeScore: true,
      minMatchCharLength: 2,
    });
  }, [items, keys, threshold]);
  
  // Get search results
  const results = useMemo(() => {
    if (!debouncedQuery.trim()) return [];
    return fuse.search(debouncedQuery).slice(0, 10);
  }, [fuse, debouncedQuery]);
  
  // Handle keyboard navigation
  const handleKeyDown = useCallback((e: React.KeyboardEvent) => {
    switch (e.key) {
      case 'ArrowDown':
        e.preventDefault();
        setSelectedIndex(i => Math.min(i + 1, results.length - 1));
        break;
      case 'ArrowUp':
        e.preventDefault();
        setSelectedIndex(i => Math.max(i - 1, 0));
        break;
      case 'Enter':
        e.preventDefault();
        if (results[selectedIndex]) {
          onSelect?.(results[selectedIndex].item);
          setQuery('');
          setIsOpen(false);
        }
        break;
      case 'Escape':
        setIsOpen(false);
        break;
    }
  }, [results, selectedIndex, onSelect]);
  
  return (
    <div className="fuzzy-search" role="combobox" aria-expanded={isOpen}>
      <div className="fuzzy-search__input-wrap">
        <Search className="fuzzy-search__icon" aria-hidden="true" />
        <input
          type="text"
          className="fuzzy-search__input"
          value={query}
          onChange={(e) => {
            setQuery(e.target.value);
            setIsOpen(true);
            setSelectedIndex(0);
          }}
          onFocus={() => setIsOpen(true)}
          onBlur={() => setTimeout(() => setIsOpen(false), 200)}
          onKeyDown={handleKeyDown}
          placeholder={placeholder}
          aria-label="Search"
          aria-autocomplete="list"
          aria-controls="search-results"
        />
        {query && (
          <button 
            className="fuzzy-search__clear"
            onClick={() => setQuery('')}
            aria-label="Clear search"
          >
            <X size={16} />
          </button>
        )}
      </div>
      
      {isOpen && query.length >= 2 && (
        <ul 
          id="search-results"
          className="fuzzy-search__results"
          role="listbox"
        >
          {results.length > 0 ? (
            results.map((result, index) => (
              <li
                key={result.item.id}
                className={`fuzzy-search__result ${
                  index === selectedIndex ? 'fuzzy-search__result--selected' : ''
                }`}
                role="option"
                aria-selected={index === selectedIndex}
                onClick={() => {
                  onSelect?.(result.item);
                  setQuery('');
                  setIsOpen(false);
                }}
              >
                {renderItem ? (
                  renderItem(result.item, result.matches || [])
                ) : (
                  <HighlightedText 
                    text={(result.item as any).title || ''} 
                    matches={result.matches?.find(m => m.key === 'title')?.indices || []}
                  />
                )}
                {result.score !== undefined && (
                  <span className="fuzzy-search__score">
                    {Math.round((1 - result.score) * 100)}% match
                  </span>
                )}
              </li>
            ))
          ) : (
            <li className="fuzzy-search__empty">
              {emptyMessage}
              <DidYouMean query={query} items={items} keys={keys} />
            </li>
          )}
        </ul>
      )}
    </div>
  );
}

Read the full file on GitHub · 735 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 735 lines · 4,344 tokens per session scan A d1765c72c749

Subscribe to this mod's changes

PixelPilot uiux-fuzzy-search.instructions.md is an instructions file published in the GitHub repository dev-lou/PixelPilot (2 stars, last pushed 5mo ago), licensed MIT. It adds 4,344 tokens to every session, about $0.0217 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.