# SQLite Search Builder

SQLite Search Builder is a tested 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.

- Page: https://aiskills402.com/skills/sqlite-search-builder
- Category: Code & Engineering (https://aiskills402.com/categories/code)
- Price: $0.01 once, USD-priced, paid in USDC on Base over x402. Price as loaded on this page. The 402 response your agent receives is authoritative.
- Version: 1.0.0
- Card (JSON): https://api.aiskills402.com/v1/skills/sqlite-search-builder

## Use it when

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.

## 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.

- Strong model (claude-sonnet-5-5 (Claude Code alias "sonnet")): 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.
- Weak model (claude-haiku-4-5-20251001 (Claude Code alias "haiku")): 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.

Note: Twelve fictional search codes: eleven with one planted problem each (an in-memory search, LIKE '%q%' on every keystroke on D1, plurals in FTS5, word order, accents, irregular plurals, an over-eager stemmer, product codes with dashes, a Bulgarian catalogue, cleaning on one side only, a route that loads the whole table) and one clean. One run per model and case, six cases run again after a fix. The steps in the skill were run on real FTS5 (node:sqlite): 70 checks that take the rules, the SQL and the examples from the skill text, two pages of 18 with no repeats, and a query plan with no full scan. The test found one gap in the skill itself, a code typed without its dash; it was fixed and checked again.

### With and without the skill

Tested 2026-10-04.

- Cases passed: Sonnet 12/12 with, 12/12 without; Haiku 12/12 with, 7/12 without.

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.

Full summary: https://aiskills402.com/skills/sqlite-search-builder/tests

## Example

### 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

## How to buy

Agent (HTTP):

1. GET https://api.aiskills402.com/v1/skills/sqlite-search-builder/file without a payment header. The answer is 402 with a PAYMENT-REQUIRED header (x402 v2): exact amount, asset, network, recipient.
2. Sign `accepts[0]` with an x402 client (for example @x402/core + @x402/evm).
3. Repeat the GET with the signature in the PAYMENT-SIGNATURE header. The answer is 200 with the file, its sha256 and a re-download token.

Agent (MCP): https://mcp.aiskills402.com/mcp — free tools search_skills, get_skill, redownload_skill. Buying itself is over HTTP.

Full flow: https://aiskills402.com/docs

## The file

- Version: 1.0.0
- Size: 14.5 KB (14844 bytes)
- SHA-256: e29d1f6135238dccbf0c3a580d046c2cec6df0ce59631c2317a234a8f3bab545
- Updated: 2026-10-04
- New versions are free through your re-download token.

## Versions

### 1.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.

## License

Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing. Holder: Georgi Kalchev, aiskills402.com. Terms: https://aiskills402.com/docs#license

## 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.

## Related skills

- [SQL Query Optimizer for D1, SQLite and Turso](https://aiskills402.com/skills/sql-query-optimizer.md): $0.01 once
- [Code Review](https://aiskills402.com/skills/code-review.md): $0.01 once

## Measurement limits

- Models other than the two named above were not run.
- Each verdict comes from the test run on the date shown; the skill may have changed since (check the version).
- Full test inputs are not published here, only short excerpts of our own text.
- Results on your own texts, languages and domains can differ.

Offer note: Paid in USDC (USD-pegged) over x402 by an AI agent; one-time.
