### NestJS CLI Quick Setup Source: https://github.com/fellipeutaka/leon/blob/main/skills/nestjs/SKILL.md Install the NestJS CLI globally and create a new NestJS application. ```bash npm i -g @nestjs/cli nest new my-app ``` -------------------------------- ### Install TanStack Start and Router Source: https://github.com/fellipeutaka/leon/blob/main/skills/tanstack-start/SKILL.md Install the necessary packages for TanStack Start and TanStack Router, including the Vite plugin for routing. ```bash npm install @tanstack/react-start @tanstack/react-router npm install -D @tanstack/router-plugin ``` -------------------------------- ### Minimal Fastify Server Setup Source: https://github.com/fellipeutaka/leon/blob/main/skills/fastify/SKILL.md A basic Fastify server to get started quickly. It includes logger configuration and a simple health check route. ```typescript import Fastify from 'fastify' const app = Fastify({ logger: true }) app.get('/health', async (request, reply) => { return { status: 'ok' } }) const start = async () => { await app.listen({ port: 3000, host: '0.0.0.0' }) } start() ``` -------------------------------- ### Get shadcn/ui Project Info Source: https://github.com/fellipeutaka/leon/blob/main/skills/shadcn/SKILL.md Use this command to retrieve the project configuration and installed components in JSON format. This is useful for understanding the current state of your shadcn/ui setup. ```bash npx shadcn@latest info --json ``` -------------------------------- ### Install Netlify Vite Plugin Source: https://github.com/fellipeutaka/leon/blob/main/skills/tanstack-start/rules/deployment.md Install the Netlify plugin for Vite to integrate TanStack Start with Netlify deployments. ```bash npm install -D @netlify/vite-plugin-tanstack-start ``` -------------------------------- ### Fetch Component Documentation URLs Source: https://github.com/fellipeutaka/leon/blob/main/skills/shadcn/SKILL.md Run this command to get the URLs for a component's documentation, examples, and API reference. Always fetch these URLs first to ensure you are using the correct API and usage patterns. ```bash npx shadcn@latest docs button dialog select ``` -------------------------------- ### Install TanStack Start Dependencies Source: https://github.com/fellipeutaka/leon/blob/main/skills/tanstack-start/rules/config-project-setup.md Install the necessary packages for TanStack Start, including the core library, React Router, React, and Vite development dependencies. ```bash npm install @tanstack/react-start @tanstack/react-router react react-dom npm install -D @tanstack/router-plugin typescript vite @vitejs/plugin-react ``` -------------------------------- ### Installation Source: https://github.com/fellipeutaka/leon/blob/main/skills/elysia/plugins/openapi.md Install the OpenAPI plugin using Bun. ```APIDOC ## Installation ```bash bun add @elysiajs/openapi ``` ``` -------------------------------- ### Get shadcn/ui Component Documentation Source: https://github.com/fellipeutaka/leon/blob/main/skills/shadcn/SKILL.md Fetch documentation and example URLs for a specific shadcn component. Replace `` with the name of the component you need information on. ```bash npx shadcn@latest docs ``` -------------------------------- ### Server Setup with Client Tool Definitions Source: https://github.com/fellipeutaka/leon/blob/main/skills/tanstack-ai/references/server-setup.md Example of configuring a chat endpoint where tool definitions are passed to the LLM, but the execution of these tools is handled on the client-side. ```APIDOC ## POST /api/chat (with Client Tool Definitions) ### Description Handles chat messages, providing the LLM with tool definitions for awareness, while the actual tool execution is delegated to the client. ### Method POST ### Endpoint /api/chat ### Request Body - **messages** (array) - Required - An array of message objects for the chat. ### Response #### Success Response (200) - **stream** (ReadableStream) - A Server-Sent Events stream of the chat response, based on LLM's understanding of client-executable tools. ### Request Example ```json { "messages": [ {"role": "user", "content": "Update the UI with this data"} ] } ``` ``` -------------------------------- ### Basic GitHub Actions CI Setup Source: https://github.com/fellipeutaka/leon/blob/main/skills/pnpm/references/best-practices-ci.md Sets up a basic CI workflow in GitHub Actions using pnpm for installation and running tests/builds. Ensures Node.js and pnpm are configured. ```yaml name: CI on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v4 with: version: 9 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - run: pnpm install --frozen-lockfile - run: pnpm test - run: pnpm build ``` -------------------------------- ### Basic WebSocket Server Setup Source: https://github.com/fellipeutaka/leon/blob/main/skills/elysia/references/websocket.md Sets up a basic WebSocket server on the '/chat' path that echoes back any received messages. Requires Elysia to be installed. ```typescript import { Elysia } from 'elysia' new Elysia() .ws('/chat', { message(ws, message) { ws.send(message) // Echo back } }) .listen(3000) ``` -------------------------------- ### Install OpenTelemetry Plugin Source: https://github.com/fellipeutaka/leon/blob/main/skills/elysia/plugins/opentelemetry.md Install the OpenTelemetry plugin using Bun. ```bash bun add @elysiajs/opentelemetry ``` -------------------------------- ### Production-Ready Docker Compose Example Source: https://github.com/fellipeutaka/leon/blob/main/skills/docker/SKILL.md A detailed Docker Compose file demonstrating a production-ready setup with multi-service configuration, health checks, resource limits, secrets, volumes, and network isolation. ```yaml services: app: build: context: . target: runtime depends_on: db: condition: service_healthy redis: condition: service_started networks: - frontend - backend healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s deploy: resources: limits: cpus: "1.0" memory: 512M reservations: cpus: "0.5" memory: 256M restart: unless-stopped logging: driver: "json-file" options: max-size: "10m" max-file: "3" db: image: postgres:17-alpine environment: POSTGRES_DB_FILE: /run/secrets/db_name POSTGRES_USER_FILE: /run/secrets/db_user POSTGRES_PASSWORD_FILE: /run/secrets/db_password secrets: - db_name - db_user - db_password volumes: - postgres_data:/var/lib/postgresql/data networks: - backend healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 10s timeout: 5s retries: 5 redis: image: redis:7-alpine command: redis-server --maxmemory 128mb --maxmemory-policy allkeys-lru volumes: - redis_data:/data networks: - backend networks: frontend: driver: bridge backend: driver: bridge internal: true # No external access volumes: postgres_data: redis_data: secrets: db_name: file: ./secrets/db_name.txt db_user: file: ./secrets/db_user.txt db_password: file: ./secrets/db_password.txt ``` -------------------------------- ### Basic WebSocket Server Setup Source: https://github.com/fellipeutaka/leon/blob/main/skills/fastify/rules/websockets.md Integrates the @fastify/websocket plugin and sets up a basic WebSocket endpoint to handle incoming messages and send echoes. Requires Fastify and the websocket plugin to be installed. ```typescript import Fastify from 'fastify'; import websocket from '@fastify/websocket'; const app = Fastify(); app.register(websocket); app.get('/ws', { websocket: true }, (socket, request) => { socket.on('message', (message) => { const data = message.toString(); console.log('Received:', data); // Echo back socket.send(`Echo: ${data}`); }); socket.on('close', () => { console.log('Client disconnected'); }); socket.on('error', (error) => { console.error('WebSocket error:', error); }); }); await app.listen({ port: 3000 }); ``` -------------------------------- ### Setup Source: https://github.com/fellipeutaka/leon/blob/main/skills/better-auth/references/two-factor.md Configuration for both server and client-side setup of the two-factor authentication plugin. ```APIDOC ## Setup ```ts // Server import { betterAuth } from "better-auth"; import { twoFactor } from "better-auth/plugins/two-factor"; export const auth = betterAuth({ appName: "My App", plugins: [ twoFactor({ issuer: "My App", // shown in authenticator apps }), ], }); // Client import { createAuthClient } from "better-auth/react"; import { twoFactorClient } from "better-auth/client/plugins"; export const authClient = createAuthClient({ plugins: [ twoFactorClient({ onTwoFactorRedirect() { window.location.href = "/2fa"; }, }), ], }); ``` Run `npx @better-auth/cli migrate` after adding the plugin. ``` -------------------------------- ### Full Example: TanStack Form with Zod Validation Source: https://github.com/fellipeutaka/leon/blob/main/skills/kanpeki/references/form-tanstack-form.md This example shows a complete React component for a bug report form, utilizing TanStack Form for state management and Zod for schema validation. It includes setup for form fields, validation, and submission. Install dependencies with `npm install @tanstack/react-form zod`. ```tsx "use client"; import { useForm } from "@tanstack/react-form"; import { toast } from "sonner"; import { z } from "zod"; import { Button } from "~/components/ui/button"; import { Field } from "~/components/ui/field"; import { Input } from "~/components/ui/input"; import { TextField } from "~/components/ui/text-field"; import { Textarea } from "~/components/ui/textarea"; const formSchema = z.object({ title: z.string() .min(5, "Title must be at least 5 characters.") .max(32, "Title must be at most 32 characters."), description: z.string() .min(20, "Description must be at least 20 characters.") .max(200, "Description must be at most 200 characters."), }); export function BugReportForm() { const form = useForm({ defaultValues: { title: "", description: "" }, validators: { onChange: formSchema }, onSubmit: ({ value }) => { toast(JSON.stringify(value, null, 2)); }, }); return (
{ e.preventDefault(); e.stopPropagation(); form.handleSubmit(); }} > {(field) => { const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid; return ( } > Title Provide a concise title for your report. ); }} {(field) => { const isInvalid = field.state.meta.isTouched && !field.state.meta.isValid; return ( } > Description