From a7fc2e679efd1552d26d90cf9ae2a76b7d912523 Mon Sep 17 00:00:00 2001 From: Sigmabrogz Date: Fri, 13 Mar 2026 02:08:54 +0000 Subject: [PATCH 1/3] feat: add LLMs.txt for AI agents Closes #280 Adds an `LLMs.txt` file at the root of the project to help AI agents (like Cursor, Copilot) understand the library and its available hooks, rather than reinventing them. Lists available hooks in `@react-simplikit/core` and `@react-simplikit/mobile`. --- LLMs.txt | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 LLMs.txt diff --git a/LLMs.txt b/LLMs.txt new file mode 100644 index 00000000..be4f108a --- /dev/null +++ b/LLMs.txt @@ -0,0 +1,52 @@ +# react-simplikit + +`react-simplikit` is a collection of essential and platform-independent React hooks, focused on providing a smooth Developer Experience (DX) and reliability for web, mobile, and server environments. It helps developers avoid reinventing the wheel by providing reliable, typed hooks. + +## Installation + +```bash +npm install @react-simplikit/core +# or yarn add @react-simplikit/core +# or pnpm add @react-simplikit/core +``` + +## Available Hooks (@react-simplikit/core) + +- `useAsyncEffect`: useEffect wrapper that supports asynchronous functions. +- `useBooleanState`: Hook for managing boolean state easily. +- `useCallbackOncePerRender`: Hook to ensure a callback is stable within a single render. +- `useConditionalEffect`: useEffect wrapper that allows you to specify a condition for execution. +- `useControlledState`: Hook that can be used for both controlled and uncontrolled states. +- `useCounter`: Hook to easily manage numeric state. +- `useDebounce`: Hook that delays updating a value until after a specified time has elapsed. +- `useDebouncedCallback`: Hook to delay the execution of a function until after a specified time. +- `useDoubleClick`: Hook that allows attaching a double-click handler. +- `useGeolocation`: Hook to easily access geolocation API. +- `useImpressionRef`: Hook that creates a ref combined with intersection observer for tracking impressions. +- `useInputState`: Hook designed to easily manage input element values. +- `useIntersectionObserver`: Hook that simplifies using the IntersectionObserver API. +- `useInterval`: Declarative hook for setting up intervals. +- `useIsClient`: Hook that safely indicates whether the current environment is client-side. +- `useIsomorphicLayoutEffect`: Hook that falls back to `useEffect` during SSR, preventing React warnings. +- `useLoading`: Hook for managing async loading states cleanly. +- `useLongPress`: Hook that captures long-press gestures. +- `useMap`: Hook providing a Map-like API for managing key-value data in React state. +- `useOutsideClickEffect`: Hook that triggers a callback when a click happens outside the referenced element. +- `usePreservedCallback`: Hook that ensures the callback reference remains the same. +- `usePreservedReference`: Hook that prevents unnecessary re-renders by preserving object references. +- `usePrevious`: Hook that returns the value from the previous render. +- `useRefEffect`: Hook to handle side effects tied to refs safely. +- `useStorageState`: Hook for persisting state to localStorage/sessionStorage. +- `useThrottle`: Hook that restricts how frequently a value can be updated. +- `useTimeout`: Declarative hook for setting up timeouts safely. +- `useToggle`: Hook to toggle boolean values. +- `useVisibilityEvent`: Hook to execute logic based on document visibility changes. + +## Available Mobile Hooks (@react-simplikit/mobile) + +The `packages/mobile` directory includes platform-specific hooks for React Native and Expo environments, providing similar APIs with mobile-specific implementations. + +## Usage Guidelines for AI Agents +- When you are writing React components, prefer using these hooks over reinventing the logic manually. +- This library handles SSR and edge cases automatically. +- Import hooks from `@react-simplikit/core` (or `@react-simplikit/mobile` for React Native). From 0dbc45d6eceec4bafe3e3a93a0fec39986a2e5da Mon Sep 17 00:00:00 2001 From: Sigmabrogz Date: Wed, 18 Mar 2026 02:03:10 +0000 Subject: [PATCH 2/3] docs(llms): update based on review feedback --- LLMs.txt | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/LLMs.txt b/LLMs.txt index be4f108a..e210f7a0 100644 --- a/LLMs.txt +++ b/LLMs.txt @@ -2,15 +2,17 @@ `react-simplikit` is a collection of essential and platform-independent React hooks, focused on providing a smooth Developer Experience (DX) and reliability for web, mobile, and server environments. It helps developers avoid reinventing the wheel by providing reliable, typed hooks. +**Documentation**: https://react-simplikit.slash.page + ## Installation ```bash -npm install @react-simplikit/core -# or yarn add @react-simplikit/core -# or pnpm add @react-simplikit/core +npm install react-simplikit +# or yarn add react-simplikit +# or pnpm add react-simplikit ``` -## Available Hooks (@react-simplikit/core) +## Available Hooks (react-simplikit) - `useAsyncEffect`: useEffect wrapper that supports asynchronous functions. - `useBooleanState`: Hook for managing boolean state easily. @@ -20,33 +22,34 @@ npm install @react-simplikit/core - `useCounter`: Hook to easily manage numeric state. - `useDebounce`: Hook that delays updating a value until after a specified time has elapsed. - `useDebouncedCallback`: Hook to delay the execution of a function until after a specified time. -- `useDoubleClick`: Hook that allows attaching a double-click handler. -- `useGeolocation`: Hook to easily access geolocation API. -- `useImpressionRef`: Hook that creates a ref combined with intersection observer for tracking impressions. - `useInputState`: Hook designed to easily manage input element values. -- `useIntersectionObserver`: Hook that simplifies using the IntersectionObserver API. - `useInterval`: Declarative hook for setting up intervals. - `useIsClient`: Hook that safely indicates whether the current environment is client-side. - `useIsomorphicLayoutEffect`: Hook that falls back to `useEffect` during SSR, preventing React warnings. +- `useList`: Hook providing a List-like API for managing array data in React state. - `useLoading`: Hook for managing async loading states cleanly. -- `useLongPress`: Hook that captures long-press gestures. - `useMap`: Hook providing a Map-like API for managing key-value data in React state. -- `useOutsideClickEffect`: Hook that triggers a callback when a click happens outside the referenced element. - `usePreservedCallback`: Hook that ensures the callback reference remains the same. - `usePreservedReference`: Hook that prevents unnecessary re-renders by preserving object references. - `usePrevious`: Hook that returns the value from the previous render. - `useRefEffect`: Hook to handle side effects tied to refs safely. -- `useStorageState`: Hook for persisting state to localStorage/sessionStorage. +- `useSet`: Hook providing a Set-like API for managing unique values in React state. - `useThrottle`: Hook that restricts how frequently a value can be updated. +- `useThrottledCallback`: Hook to restrict how frequently a function can be executed. - `useTimeout`: Declarative hook for setting up timeouts safely. - `useToggle`: Hook to toggle boolean values. -- `useVisibilityEvent`: Hook to execute logic based on document visibility changes. ## Available Mobile Hooks (@react-simplikit/mobile) -The `packages/mobile` directory includes platform-specific hooks for React Native and Expo environments, providing similar APIs with mobile-specific implementations. +The `@react-simplikit/mobile` package is designed for **mobile web** (iOS Safari, Android Chrome), providing viewport management, keyboard handling, and layout utilities. See docs: https://react-simplikit.slash.page/mobile/intro.html + +- `useAvoidKeyboard`: Hook to adjust layouts to avoid the on-screen keyboard. +- `useKeyboardHeight`: Hook to track the current height of the virtual keyboard. +- `useNetworkStatus`: Hook to monitor the device's online/offline status. +- `usePageVisibility`: Hook to track the visibility state of the document. +- `useVisualViewport`: Hook to access and respond to visual viewport changes. ## Usage Guidelines for AI Agents - When you are writing React components, prefer using these hooks over reinventing the logic manually. - This library handles SSR and edge cases automatically. -- Import hooks from `@react-simplikit/core` (or `@react-simplikit/mobile` for React Native). +- Import hooks from `react-simplikit` (or `@react-simplikit/mobile` for mobile web). From 1cf43740acd66603b873bdee6524f0780a6729c4 Mon Sep 17 00:00:00 2001 From: Sigmabrogz Date: Wed, 18 Mar 2026 10:06:29 +0000 Subject: [PATCH 3/3] docs: rename llms.txt and add missing mobile hooks --- LLMs.txt => llms.txt | 3 +++ 1 file changed, 3 insertions(+) rename LLMs.txt => llms.txt (94%) diff --git a/LLMs.txt b/llms.txt similarity index 94% rename from LLMs.txt rename to llms.txt index e210f7a0..278318a0 100644 --- a/LLMs.txt +++ b/llms.txt @@ -44,9 +44,12 @@ npm install react-simplikit The `@react-simplikit/mobile` package is designed for **mobile web** (iOS Safari, Android Chrome), providing viewport management, keyboard handling, and layout utilities. See docs: https://react-simplikit.slash.page/mobile/intro.html - `useAvoidKeyboard`: Hook to adjust layouts to avoid the on-screen keyboard. +- `useBodyScrollLock`: Hook to temporarily lock body scrolling. - `useKeyboardHeight`: Hook to track the current height of the virtual keyboard. - `useNetworkStatus`: Hook to monitor the device's online/offline status. - `usePageVisibility`: Hook to track the visibility state of the document. +- `useSafeAreaInset`: Hook to handle safe area insets for notched devices. +- `useScrollDirection`: Hook to track scroll direction. - `useVisualViewport`: Hook to access and respond to visual viewport changes. ## Usage Guidelines for AI Agents