Code & Engineering

SQLite Search Builder

Builds or fixes a site or product search so it finds what the user meant, with SQLite full-text search (FTS5) on D1, Turso or SQLite. Word order, singular or plural, endings, case, punctuation and accents stop mattering ("cafe" finds "Café", "tomatoes" finds "tomato", "red tomato" finds "Tomato, red", "ab1042" finds "AB-1042"), and the start of a word is enough ("tom" finds "tomatoes"). Gives one normalize pipeline for accent-insensitive search, a query-side ending remover, prefix search on the index with paging and a short cache, and a small in-memory path for short lists already in the browser. Never loads a whole table to filter it per keystroke. It does not correct typos. Use when asked to implement or fix search, autocomplete or typeahead, when search does not find plurals, accents or reordered words, when a slow LIKE search reads the whole table, or to review a search box on D1, Turso or SQLite.

SQLite Search Builder is a SKILL.md that builds or fixes a site or product search so it finds what the user meant, with SQLite full-text search (FTS5) on D1, Turso or SQLite; an agent buys it once for $0.01 over x402.

Tested 2026-10-04No code, no hidden instructionsv1.0.0 · 14.5 KB · perpetual license

Not for

Typo correction or 'did you mean' suggestions: there is no edit distance, so 'tomatoe' will not find 'tomato'. Also not for ranking by relevance (results come newest first), semantic or vector search, or setting up Elasticsearch, Algolia or Meilisearch. Postgres gets a short note only.

Tested, honestly

Tested 2026-10-04 with a strong and a weak model.

With and without the skill

Results with and without the skill, for Sonnet and Haiku
SonnetHaiku
withwithoutwithwithout
Cases passed12/1212/1212/127/12

One run per model and case, the same checks for both sides; we read every failed answer and widened nine checks that rejected right answers for their wording. Without the skill Sonnet gave other working fixes (a Porter tokenizer, remove_diacritics 2, an exception list). Haiku without it kept LIKE '%q%' on the server, called the loss of 'й' in Bulgarian harmless and gave no Bulgarian rules, offered two fixes for product codes that each left one complaint unsolved, said an over-eager stemmer was fine for 'universe' and 'news', and changed the tokenizer without rebuilding the table.

Same cases and the same checks with and without the skill. The cases are ours, written around what the skill is for; with a handful of cases, a difference of one or two is within noise.

SonnetStrong model, claude-sonnet-5-5
Fixed the planted problem in all 11 cases that had one and answered 'No findings.' for the clean search. It moved LIKE '%q%' and a load-the-whole-table route onto an FTS5 index with prefix search and a LIMIT, cut endings from the query only, added a dictionary for irregular plurals, and kept the breve of 'й' in a Bulgarian catalogue. On the product-code case it also stored the code without its dash, so 'ab1042' finds 'AB-1042', and it noticed that one complaint in our case could not happen with the code we showed. In 1 of 12 answers it left out the 3-letter prefix rule, which the skill asks for.
HaikuWeak model, claude-haiku-4-5-20251001
Fixed the planted problem in all 11 cases that had one. It followed the skill's form less closely: five of its answers each left out one part the skill asks for (a debounce, the 2,000-item limit of the in-memory mode, cutting endings from the query only, the 3-letter prefix rule, or storing dictionary forms), and once it described a stem wrongly ('tomat' for 'tomatoes'), though the prefix still matched. On the clean search it answered 'No findings.' once; in a second run it reported a cursor pattern that cannot overflow in practice. With Haiku, check the generated code against the skill's test table.

Full test summary

Example

Our own test text, before and after the skill ran. Excerpts only.

English · claude-sonnet-5-5

Before

Notes: React shop, Vite, no backend search. The catalog is one JSON file of about 400 products, fetched once when the app starts and kept in a context. type Product = { id: string; name: string; sku: string }; Current search box code: const results = products.filter((p) => p.name.includes(query));…

After

**Mode A (in memory):** your 400 products are fetched once and held in a context, which is the one case where filtering an array is allowed. This only holds below about 2,000 items (never above 5,000), and only while the list isn't re-fetched per search. If the catalog outgrows that, move to a database with an FTS5 prefix index.…

What is in the file

  • Hard rules
  • Choose the mode
  • Normalize (both modes)
  • Query-side ending remover
  • Mode B: FTS5 prefix search (D1, Turso, SQLite)
  • Mode A: list already in memory (limit about 2,000)
  • Do not
  • Tests (run before you say done)

Languages

Any language. Tried in: English.

License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Full terms.

Versions

Current version 1.0.0, updated 2026-10-04. Whoever bought an earlier version gets new ones free through the same re-download token.

  1. v1.0.0 · 2026-10-04

    First release: builds or fixes a site or product search that forgives word order, plurals, accents, case, punctuation and partly typed words, on an SQLite FTS5 index (D1, Turso) with prefix search, keyset paging and a short cache, plus an in-memory mode for short lists already in the browser. Every step is written out in words and tables, with a test table to run before calling the search done.

FAQ

Will the search read the whole table?

No. The default is an FTS5 index searched by word start, ordered by rowid and stopped at a LIMIT, so one request reads about two rows per result shown, and page 50 costs the same as page 1. Loading every item and filtering it in code is allowed only for a list of up to about 2,000 that is already in the browser.

Does it work outside English?

The steps are the same for any language: one cleaning function for stored and typed text, a dictionary, at most five ending rules and two length guards. Accents come off Latin letters only, so the Cyrillic 'й' survives. In our Bulgarian catalogue case both models passed with the skill; without it Haiku called the loss of 'й' harmless and gave no Bulgarian rules.

Is it worth it with a strong model?

In our twelve cases Claude Sonnet fixed every planted problem with or without the skill, in some cases with other working fixes such as a Porter tokenizer. The gain was on Claude Haiku: twelve of twelve with the skill, seven of twelve without.

Read more

Share

Read this page as Markdown: /skills/sqlite-search-builder.md.

  • SQL Query Optimizer for D1, SQLite and Turso

    Code & Engineering

    SKILL.md · v1.0.2 · 9.8 KB

    Reviews SQL queries, schemas and migrations for SQLite, Cloudflare D1 and Turso, where the bill and the speed follow the rows a query READS, not the rows it returns. Finds full scans hidden behind LIMIT, aggregates over growing tables, index column gaps, NOT IN, OR, functions and LIKE patterns that switch an index off, OFFSET pagination, N+1 loops, the D1 limit of 100 bound parameters, tables that never shrink and new flag columns that turn the whole history into pending work; ranks them by cost and gives the index or rewrite that fixes each. Use when asked to optimize a SQL query, review a database schema or a migration, find a slow query, or cut rows read on D1, SQLite or Turso.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 3 Oct 2026

  • Code Review

    Code & Engineering

    SKILL.md · v1.0.4 · 6.0 KB

    Reviews a code change (a diff or a changed file pasted as text) and reports real problems ranked by severity — correctness bugs, security holes, data loss, missing error handling, edge cases, resource leaks — each with location, reason and a concrete fix in words. Use when asked to review code, a diff or a pull request, check a change for bugs, or find security problems in a snippet.

    $0.01once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 30 Sep 2026

More in Code & Engineering

  • Unexpected Cloud Bill Spike: Find the Cause

    Code & Engineering

    SKILL.md · v1.0.0 · 15.9 KB

    Finds the loops behind a bill spike or an unexpected bill. Reviews a web app's code and config for loops and repeats that run up the bill on their own on Vercel, Turso, Cloudflare Workers and D1 and paid AI APIs. Finds two schedulers on one job, retries without a cap, work that triggers itself, client polling and React render loops, caches cleared on every write, middleware running on every static file, queues that resend failures forever, image settings that multiply transformations, health checks that count whole tables, alerts sent on every run and bots crawling endless filter URLs. Counts the runs per month, names the billed unit, ranks by cost and gives the change that stops each one. Use when asked why a Vercel, Turso or Cloudflare bill jumped, to find an infinite loop or a runaway cost, or to review a cron job, webhook, queue consumer, middleware or polling code before it ships.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 4 Oct 2026

  • WCAG Color Contrast Check: AA and AAA Ratios

    Code & Engineering

    SKILL.md · v1.0.1 · 10.3 KB

    Computes the real contrast ratio of every text and background pair in pasted CSS, design tokens or a palette, says whether each pair passes WCAG AA and AAA, and gives every failing pair a replacement color that passes on its real background. It carries a table of 256 channel values so the ratio is added and divided instead of guessed, and it reads the cases a glance gets wrong: a rgba color or opacity is blended with its background first, a placeholder is text, 18px bold is not large text, a border or an icon is a 3:1 component, a disabled control and a logo are exempt, short hex and color names are expanded, and 4.48 is never rounded up to 4.5. One line per pair, then a Verdict line. Use when asked for a WCAG color contrast check of a stylesheet, theme or palette, whether colors pass AA or AAA, or to fix text colors that are too pale.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 12 Nov 2026

  • Recommended

    Safe Refactoring: Refactor Without Changing Behavior

    Code & Engineering

    SKILL.md · v1.0.1 · 9.7 KB

    Refactors, cleans up and modernizes Python, JavaScript, TypeScript and React code without changing what it does. It guards the change that cleanups make most often without saying so - how the code treats missing and empty values - and ends each answer with a short Behavior section that names what was checked and anything that changed. Use when asked to refactor, clean up, tidy, simplify or modernize a function, class, component or file.

    $0.05once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 13 Nov 2026

  • API Key Leaks in Code: Secret Handling Review

    Code & Engineering

    SKILL.md · v1.0.0 · 7.8 KB

    Reviews pasted application code, scripts and config for the four ways a secret leaks from the code that uses it, and lists only those, one line each with a fixed code, the place, who can then read the secret and the fix - or exactly No findings. It catches a secret value written to a log or printed (the key itself, an object or environment dump that contains it), a secret placed in a URL query string, a secret typed into source or a committed file, and a server secret sent to the browser through a public environment prefix or a prop of a client component. It leaves out the safe look-alikes: printing only that a key is present, its length or its last four characters, a publishable key that is public by design, and a secret read from the environment on the server. Use to review code that calls an API with a key, to check a Next.js or Vite project before release, or to gate a pull request that touches credentials.

    $0.01once

    • x402
    • USDC
    • Base
    Get skill

    Tested with Sonnet and Haiku, 29 Oct 2026