
# Dynamic Memory — The Cortex Protocol You are not a stateless function. You are an evolving intelligence with persistent memory, and **the quality of that memory is the single most important thing you maintain.** Every task you complete is temporary. The code ships. The bug gets fixed. The feature launches. But your memory compounds. A well-maintained memory system means you never ask the same question twice, never make the same mistake twice, and understand context before being told. **You
# MCP Server Patterns > This skill is under development. Patterns for building Model Context Protocol (MCP) servers that expose tools, resources, and prompts to AI assistants. ## Topics to Cover - Tool design: focused actions with clear descriptions - Tool input validation and error responses - Resource URIs: consistent scheme (`skill://`, `profile://`) - Resource templates for dynamic content - Prompt patterns for guided interactions - Transport options (stdio, SSE) - Server lifecycle and i
# FastAPI Patterns Patterns for building clean, performant, and well-structured FastAPI applications. Routes are thin — they validate input, call services, and return typed responses. --- ## Async Routes All route handlers that perform I/O (database, HTTP calls, file operations) MUST be `async def`. Use `def` only for purely CPU-bound synchronous operations. ```python # YES — async for I/O @router.get("/invoices/{invoice_id}") async def get_invoice(invoice_id: UUID, service: InvoiceService
# LangGraph Patterns Patterns for building reliable, maintainable AI agent workflows with LangGraph. Graphs should have typed state, focused nodes, explicit routing, and proper error handling. --- ## Typed State Every graph MUST define its state as a `TypedDict`. The state is the single source of truth flowing through the graph. ```python from typing import TypedDict, Annotated from langgraph.graph import add_messages class AgentState(TypedDict): messages: Annotated[list, add_messages]
# Supabase Database Design Patterns for designing clean, performant, and maintainable Postgres schemas in Supabase. Every table should be queryable through PostgREST and protectable with RLS. --- ## Table Naming Conventions - Use `snake_case` for all identifiers (tables, columns, indexes, constraints) - Table names are **plural**: `invoices`, `line_items`, `users` - Junction tables: `user_roles`, `project_members` (entity_relationship) - Prefix audit/system tables: `audit_logs`, `system_sett
# Vite + React Architecture > This skill is under development. Patterns for building Vite+React SPAs: project structure, routing, data fetching, state management, build optimization. ## Topics to Cover - Project structure conventions (`src/`, `pages/`, `components/`, `hooks/`, `lib/`) - React Router v6+ with lazy-loaded routes - Data fetching patterns (TanStack Query integration) - State management tiers (local, shared, server) - Vite configuration: path aliases, env variables, proxy, build
# Forge Orchestrate — Intelligent Build Orchestration You are a build planner, not a build executor. Your job is to look at a project, figure out what's left to build, decompose the work into parallel streams, assign the right intelligence level to each stream, estimate cost, and hand the user a set of terminal commands they can run. You plan. They execute. --- ## Stream Decomposition The unit of parallelism is a **stream** — a self-contained bundle of tasks that one Claude session handles e
# Parallel Execution > This skill is under development. Workflow patterns for running independent tasks in parallel to improve performance and throughput. ## Topics to Cover - Identifying independent tasks suitable for parallel execution - `asyncio.gather()` with `return_exceptions=True` - `asyncio.TaskGroup` for structured concurrency (Python 3.11+) - Semaphores for bounded concurrency - `Promise.all()` and `Promise.allSettled()` in TypeScript - Handling partial failures (some tasks succeed
# API Design > This skill is under development. Cross-cutting patterns for designing clean, consistent REST APIs. ## Topics to Cover - REST resource naming conventions (plural nouns, no verbs) - HTTP method semantics (GET, POST, PUT, PATCH, DELETE) - Status code usage guide - Consistent error response shape (`{ error, message, details }`) - Pagination patterns (offset, cursor, keyset) - Filtering and sorting conventions - API versioning strategies (URL path, header) - Rate limiting headers -
# Error Handling > This skill is under development. Cross-cutting patterns for handling errors in Python and TypeScript applications. Errors should be explicit, typed, contextual, and never silently swallowed. ## Topics to Cover - Domain error hierarchies (base class per domain) - Never swallowing errors — catch specifically or let propagate - Typed error responses for APIs (consistent error shape) - Error context: always include relevant IDs and state - Retry patterns with exponential backo
# Forge Frontend Integration When a project uses an RTG Forge backend module, the frontend must integrate with its API cleanly. This skill defines how to build the TypeScript layer that bridges a forge module's API to React components. The frontend integration has three layers. Build them in order — each one depends on the previous. ``` Layer 1: types.ts ← mirrors models.py (portable, rarely changes) Layer 2: hooks.ts ← typed React Query hooks per endpoint (mostly portable) Layer 3:
# Forge-Ready Modules Build every backend feature as a self-contained module from the start. The goal: when it's time to extract a module into RTG Forge, it's a clean copy — not a refactor. This skill applies to **every** Python/FastAPI feature you build, whether or not it's destined for the forge. The patterns here produce better code regardless. --- ## The Six-File Rule Every feature gets six files minimum. No exceptions, even for "small" features. ``` feature_name/ ├── __init__.py #
# LLM Cost Audit Audit checklist and patterns for optimizing LLM costs in LangChain and LangGraph pipelines. Every LLM call is a billing event — this skill ensures no money is wasted on avoidable tokens, wrong models, or missed caching opportunities. --- ## Audit Checklist Run through each section against the target pipeline. Flag any finding as a cost issue with estimated savings. --- ## 1. Prompt Caching Anthropic prompt caching gives a **90% discount** on cached token reads. Missing it
# Testing Strategy > This skill is under development. Patterns for building reliable test suites across Python and TypeScript codebases. ## Topics to Cover - Test pyramid: unit > integration > e2e ratio - Pytest patterns: fixtures, parametrize, conftest organization - Vitest patterns: component testing, MSW for API mocking - Contract tests at service boundaries - Fixture factories (factory_boy, faker) - Mocking strategy: mock at boundaries, not internals - Database testing: transactions, see
# Langfuse Observability > This skill is under development. Patterns for instrumenting LLM applications with Langfuse for tracing, cost tracking, and evaluation. ## Topics to Cover - Trace decoration with `@observe()` decorator - Span nesting for multi-step pipelines - Cost tracking per trace and per user - Prompt management and versioning via Langfuse - Evaluation pipelines (scoring, human feedback) - Integration with LangChain/LangGraph callbacks - Dashboard organization and filtering - Fl
# Next.js App Router Architecture Patterns for building production Next.js applications with the App Router. Covers Server/Client Components, data fetching, caching, streaming, PPR, and integration with Supabase and FastAPI. --- ## Server vs Client Components **Default to Server Components.** Every component is a Server Component unless marked with `'use client'`. Server Components produce zero client-side JavaScript. ### When to Use Each | Server Component | Client Component (`'use client
# Python Clean Architecture Patterns for writing clean, maintainable, and type-safe Python code. These are foundational rules that apply to every Python file in the codebase. --- ## Type Hints Everywhere Every public function, method, and class attribute MUST have type hints. No exceptions. ```python # YES def calculate_total(items: list[LineItem], tax_rate: Decimal) -> Decimal: ... # NO def calculate_total(items, tax_rate): ... ``` Use `from __future__ import annotations` at the
# React TypeScript Patterns Patterns for building type-safe, maintainable React applications with TypeScript. Components should be small, well-typed, and composable. --- ## Component Typing Every component MUST have an explicit Props interface. Never use `any` or inline object types. ```tsx // YES — Explicit interface, well-documented interface InvoiceCardProps { invoice: Invoice; onEdit: (id: string) => void; onDelete: (id: string) => void; isSelected?: boolean; } function Invoice
# Supabase PostgREST Patterns Patterns for querying Supabase effectively through the PostgREST API. Use resource embedding to avoid N+1 queries, type all responses, handle errors explicitly, and paginate everything. --- ## Select With Specific Columns Never use `select('*')` in production. Select only the columns you need. ```typescript // YES — specific columns const { data, error } = await supabase .from("invoices") .select("id, status, created_at, customer:customers(id, name)") .eq
# Supabase RLS Patterns Row Level Security (RLS) is the primary authorization mechanism in Supabase. Every table exposed to PostgREST MUST have RLS enabled with explicit policies. There is no "default deny" without enabling RLS — without it, all rows are visible. --- ## Enabling RLS Every table MUST have RLS enabled in the same migration that creates it: ```sql ALTER TABLE invoices ENABLE ROW LEVEL SECURITY; ``` **No exceptions.** A table without RLS is fully readable and writable by any a
# Tailwind Design System Patterns for building consistent, maintainable UIs with Tailwind CSS. Use design tokens, component variants, and the `cn()` utility to keep styling predictable and composable. --- ## The cn() Utility Use `cn()` (powered by `clsx` + `tailwind-merge`) for all conditional and merged class names. Never do string concatenation for Tailwind classes. ```tsx import { type ClassValue, clsx } from "clsx"; import { twMerge } from "tailwind-merge"; export function cn(...inputs
# Module Extraction > This skill is under development. Workflow for identifying and extracting reusable modules from existing codebases. Extract when a pattern is used in 3+ places and has stabilized. ## Topics to Cover - Identifying extraction candidates (rule of three) - Defining module boundaries and public interface - Dependency analysis: what does the module need? - Interface design: protocols, abstract base classes - Step-by-step extraction process - Testing strategy: tests before, dur
# LLM Architect Systems architecture skill for LLM pipelines. Turns dumb pipes into intelligent systems where every call is surgically optimized for what it needs to know, when it needs to know it, and which model should think about it. **The thesis:** Better architecture makes speed, cost, and quality improve simultaneously. The waste in most LLM systems is so enormous that eliminating it improves all three at once. **Workflow:** MAP the current architecture. MEASURE where cost, latency, and
# Code Review > This skill is under development. Workflow for conducting effective code reviews that catch real issues and improve code quality. ## Topics to Cover - Review priorities: correctness > design > performance > style - What to check in every review (checklist) - How to give constructive feedback - Automated checks that should run before human review - Review scope: how big is too big? - Patterns for reviewing database migrations - Patterns for reviewing API changes - When to reque