A tool matcher in ~40 lines of vanilla JavaScript A developer built a roughly 40-line vanilla JavaScript tool matcher for a small AI tools directory, mapping user tasks to recommended tools via data attributes and a plain object lookup. The matcher uses native button elements for keyboard support, aria-pressed for selection state, and an aria-live region for results, with tool data kept in a single object so adding a tool requires only one line. The developer packaged it into a static site with search, guides, and 12 tools, offering a live demo and paid source. When I built a small AI tools directory, the feature people actually used was not the tool list - it was one question: "what are you trying to do?" Here is the whole matcher. No framework, no state library, ~40 lines. js const tools = { writing: { name: "Claude", why: "long-form drafting and editing" }, design: { name: "Canva", why: "social graphics without a designer" }, research: { name: "Perplexity", why: "answers with sources you can check" }, admin: { name: "Zapier", why: "gluing apps together" }, }; const choices = document.querySelectorAll " data-match " ; const result = document.querySelector " match-result" ; choices.forEach button = { button.addEventListener "click", = { const task = button.dataset.match; const tool = tools task ; if tool return; choices.forEach b = b.setAttribute "aria-pressed", String b === button ; result.hidden = false; result.innerHTML = "