typescript-skills
π―Skillfrom llama-farm/llamafarm
Enforces strict TypeScript best practices for React and Electron frontend applications, ensuring type safety, immutability, and clean code patterns.
Installation
npx skills add https://github.com/llama-farm/llamafarm --skill typescript-skillsSkill Details
Shared TypeScript best practices for Designer and Electron subsystems.
Overview
# TypeScript Skills for LlamaFarm
Shared TypeScript best practices for Designer (React) and Electron App subsystems.
Overview
This skill covers idiomatic TypeScript patterns for LlamaFarm's frontend applications:
- designer/: React 18 + TanStack Query + TailwindCSS + Radix UI
- electron-app/: Electron 28 + Electron Vite
Tech Stack
| Subsystem | Framework | Build | Key Libraries |
|-----------|-----------|-------|---------------|
| designer | React 18 | Vite | TanStack Query, Radix UI, axios, react-router-dom |
| electron-app | Electron 28 | electron-vite | electron-updater, axios |
Configuration
Both projects use strict TypeScript:
```json
{
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
}
```
Core Principles
- Strict mode always - Never use
anywithout explicit justification - Prefer interfaces - Use
interfacefor object shapes,typefor unions/intersections - Explicit return types - Always type public function returns
- Immutability - Use
readonlyandas constwhere applicable - Null safety - Handle null/undefined explicitly, avoid non-null assertions
Related Documents
- [patterns.md](./patterns.md) - Idiomatic TypeScript patterns
- [typing.md](./typing.md) - Strict typing, generics, utility types
- [testing.md](./testing.md) - Vitest and testing patterns
- [security.md](./security.md) - XSS prevention, input validation
Quick Reference
React Component Pattern
```tsx
interface Props {
readonly title: string
readonly onAction?: () => void
}
function MyComponent({ title, onAction }: Props): JSX.Element {
return
}
```
TanStack Query Hook Pattern
```typescript
export const projectKeys = {
all: ['projects'] as const,
lists: () => [...projectKeys.all, 'list'] as const,
detail: (id: string) => [...projectKeys.all, 'detail', id] as const,
}
export function useProject(id: string) {
return useQuery({
queryKey: projectKeys.detail(id),
queryFn: () => fetchProject(id),
enabled: !!id,
})
}
```
Error Class Pattern
```typescript
export class ApiError extends Error {
constructor(
message: string,
public readonly status: number,
public readonly response?: unknown
) {
super(message)
this.name = 'ApiError'
}
}
```
Checklist Summary
| Category | Critical | High | Medium | Low |
|----------|----------|------|--------|-----|
| Typing | 3 | 4 | 2 | 1 |
| Patterns | 2 | 3 | 3 | 2 |
| Testing | 2 | 3 | 2 | 1 |
| Security | 4 | 2 | 1 | 0 |
More from this repository10
Implements robust RAG document processing and retrieval using LlamaIndex, ChromaDB, and Celery for efficient, scalable AI document workflows.
Generates specialized Claude Code skills for each subsystem, creating shared language and subsystem-specific checklists to optimize AI code generation across the monorepo.
Manages shared Python utilities for LlamaFarm, focusing on HuggingFace model handling, GGUF file management, and cross-service consistency.
Configures secure Electron desktop application architecture with isolated processes, type-safe IPC, and cross-platform packaging for LlamaFarm.
Enforces Go best practices and idiomatic patterns for secure, maintainable LlamaFarm CLI development.
Provides comprehensive Go CLI development guidelines using Cobra, Bubbletea, and Lipgloss for creating robust, interactive command-line interfaces in LlamaFarm projects.
Automates git workflow by committing changes, pushing to GitHub, and opening a PR with intelligent checks and handling of edge cases.
Provides comprehensive Python best practices and code review guidelines for ensuring high-quality, secure, and maintainable code across LlamaFarm's Python components.
Generates temporary files in a structured system directory, ensuring clean organization and easy tracking of generated reports and logs.
Provides server-side best practices and code review guidelines for FastAPI, Celery, and Pydantic frameworks in Python.