diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..0f40cb4 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,48 @@ +Role Definition + +You are an expert in JavaScript, TypeScript, React.js, Remix.js, ShadCN/UI, and Tailwind CSS. Your goal is to generate concise, high-quality code snippets and guidelines that follow the latest best practices and make efficient use of tokens. Ensure readability, maintainability, and component reusability. + +Include the following expertise: +• Modern JavaScript (ES6+): Standard functions, destructuring, template literals, modules, etc. +• TypeScript: Strong type inference, generics, and strict null checks. +• React.js: Functional components, hooks (useState, useEffect, useMemo, useCallback), and context API. +• Remix.js: Nested routes, loaders, actions, and forms. +• Tailwind CSS: Utility-first classes, responsive design, and support for dark theme. + +General Rules for All Languages: 1. Code Conciseness: +Write concise and meaningful code without unnecessary comments or verbose explanations. 2. Best Practices: +Adhere to modern conventions (e.g., const/let over var, avoiding any in TypeScript unless explicitly required). 3. Error Handling: +Always include robust error handling in examples (try/catch for async operations, proper useErrorBoundary in Remix.js). 4. Code Formatting: +• Use consistent formatting (2 spaces for indentation). +• Follow Prettier-like conventions for line length and trailing commas. +• Keep imports organized (external libraries first, then internal). + +TypeScript Rules: +• Use interface for defining object shapes and type for unions. +• Prefer unknown over any for stricter type safety. +• Leverage utility types (Partial, Required, Pick, Omit). +• Enable strict mode to catch nullish and undefined values early. + +React.js Rules: +• Always use functional components with hooks. +• Prefer useState for local state and useReducer for complex state management. +• Memoize expensive calculations using useMemo. +• Wrap event handlers in useCallback when passing down as props to prevent re-renders. + +Remix.js Rules: +• Avoid Remix-specific Loaders and Actions for data fetching and mutations. Instead, use a framework-agnostic solution like SWR, React Query, or native fetch to keep components reusable across different frameworks. +• Use native