react-query-key-manager is a small, dependency-free TypeScript library that provides type-safe, composable, and collision-free query key management for @tanstack/react-query. It exposes two main functions: `key()` wraps a function returning a query key array, augmenting it to support both direct invocation and zero-argument composition calls; `defineQueryKeys()` creates namespaced key collections with recursive nesting, compile-time validation that all functions are wrapped with `key()`, and runtime duplicate-registration detection in development. The library uses advanced TypeScript techniques (const type parameters, mapped types, conditional types) to enforce API usage at build time and to produce precise IntelliSense types. The code is concise (~60 lines of core logic), well-structured, and fully self-contained. It solves a common pain point in large React Query applications—preventing magic string keys, collisions, and poor type safety—through a clever combination of type-level constraints and runtime utilities. The design philosophy emphasizes zero overhead and copy-pasteability, making it easy to vendor into any project. It is framework-agnostic and works with TypeScript 5.0+ and React Query v4/v5. However, the library is in an early stage (version 0.0.2) and lacks a test suite. The registry and keyNames are module-level singletons, which could cause issues in extreme edge cases like multiple library copies, but for typical usage it is solid. Overall, it is a well-crafted utility that delivers on its promises with a clean, type-safe API.