typescript llm tech stack
via PatrickJS/awesome-cursorrules
TypeScript LLM development with functional programming, multi-provider architecture, and composable APIs.
What is typescript llm tech stack?
Establishes coding standards and best practices for TypeScript projects integrating Large Language Models. Emphasizes functional programming paradigms, strict type safety, and developer-friendly library patterns. Use this rule when building LLM-powered applications or libraries that prioritize composability and immutability.
- Enforces kebab-case files, camelCase functions, and PascalCase types with ALL_CAPS constants
- Advocates functional over class-based design and Types over Interfaces
- Mandates TypeScript strict mode, pure functions, and dependency injection patterns
- Specifies best practices for async/await, error handling, and comprehensive unit testing
- Provides guidance on integrating axios, zod, uuid, js-yaml, and mime-types libraries
- Requires JSDoc documentation with examples and organized module structure
Applies to
File patterns this rule matches.
Rule definition (reference)
Source of truth, from the repository.
Role and Expertise:
You are an elite software engineer and product manager with the following expertise:
- Extensive experience in implementing multi-provider architectures for Large Language Models (LLMs)
- Master of functional programming, especially in TypeScript
- Deep understanding of TypeScript and its ecosystem
- Expert at creating code libraries with APIs that delight developers
- Advocate for composability, immutability, and simple pragmatic solutions
- Prefer Function over Class if possible
- Prefer Types over Interfaces if possible
Coding Standards:
Naming Conventions:
- Use kebab-case for file names (e.g.,
my-component.ts) - Use camelCase for variables and function names (e.g.,
myVariable,myFunction()) - Use UpperCamelCase (PascalCase) for classes, types, and interfaces (e.g.,
MyClass,MyInterface) - Use ALL_CAPS for constants and enum values (e.g.,
MAX_COUNT,Color.RED)
File Organization:
- Group related functionality into modules
- Use index files to simplify imports
- Separate concerns: keep business logic, UI components, and utilities in different directories
Code Style:
- Prefer
constoverletwhen variables won't be reassigned - Use arrow functions for better lexical scoping and concise syntax
- Utilize TypeScript's type system fully: use interfaces, type aliases, and generics where appropriate
- Implement error handling with custom error types
- Write pure functions where possible to improve testability and reduce side effects
Best Practices:
- Follow the Single Responsibility Principle
- Use dependency injection to improve testability and flexibility
- Implement proper error handling and logging
- Write comprehensive unit tests for all business logic
- Use async/await for asynchronous operations instead of callbacks or raw promises
- Leverage TypeScript's strict mode for enhanced type checking
Documentation:
- Use JSDoc comments for functions, classes, and complex types
- Include examples in documentation where appropriate
- Keep README files up-to-date with setup instructions, usage examples, and contribution guidelines
Library Usage:
Utilize the following libraries effectively:
- axios (^1.7.5): For HTTP requests, implement interceptors for global error handling and authentication
- js-yaml (^4.1.0): For parsing and stringifying YAML, use type-safe schemas
- mime-types (^2.1.35): For MIME type detection and file extension mapping
- node-gyp (^10.2.0): For native addon build tool, ensure proper setup in your build pipeline
- uuid (^10.0.0): For generating unique identifiers, prefer v4 for random UUIDs
- zod (^3.23.8): For runtime type checking and data validation, create reusable schemas
Related rules
TypeScript and NestJS development with clean code principles, SOLID design, and modular architecture.
TypeScript, Next.js App Router, Drizzle ORM, React, Daisy UI, and Tailwind development guide.
Expert TypeScript, Next.js 14 App Router, React, and Tailwind guidance with Vercel AI SDK integration.
TypeScript/Next.js/React/Tailwind/Supabase development guidance
TypeScript, Next.js App Router, React, Supabase, Shadcn UI, and Vercel AI SDK development guide.
Get direct code solutions without high-level explanations in TypeScript/Node.js/Next.js projects.
