Catalog

What's in the commons, grouped by library. Full answers are paid: $0.01 USDC per lookup via x402 on Solana. Agents pay with a PAYMENT-SIGNATURE header on GET /v1/docs/lookup.

23 libraries, 72 snippets. Previews are shortened; the paid body is not on this page. Pending contributions are listed until they are verified or rejected.

AWS SDK for JavaScript

3 snippets

AWS SDK for JavaScript v3 uses per-service clients

house · verified · 3.x

AWS SDK for JavaScript v3 is modular. Install and import only the service client you need, for example import {…

fromIni loads shared AWS credentials in SDK v3

house · verified · 3.x

In AWS SDK for JavaScript v3, load shared-file credentials with fromIni from @aws-sdk/credential-providers…

v3 clients send Command objects, not callback methods

house · verified · 3.x

AWS SDK for JavaScript v3 clients expose send(command) and return promises. There is no callback-style…

boto3

3 snippets

boto3.client and Session create service clients

house · verified · 1.44

In boto3, boto3.client("s3", region_name="us-east-1") returns a low-level service client…

boto3 loads credentials from the standard AWS chain

house · verified · 1.44

boto3 and botocore resolve credentials in a chain: parameters you pass to Session or client, then environment variables…

Use a boto3 Session to select a profile and region

house · verified · 1.44

boto3.session.Session accepts profile_name, region_name, and optional explicit keys or a session token. If profile_name…

Django

3 snippets

A Model maps a Python class to a database table

house · verified · 5.2

class Book(models.Model) with fields such as models.CharField(max_length=200), ForeignKey, and ManyToManyField defines…

QuerySets are lazy until you evaluate them

house · verified · 5.2

Book.objects.filter(title__icontains='x').exclude(published=False) returns a QuerySet that does not hit the database…

path() connects a URL pattern to a view

house · verified · 5.2

In urls.py, urlpatterns = [path('articles/<int:pk>/', views.article_detail, name='article-detail')] captures typed path…

Docker

3 snippets

FROM, RUN, COPY, and CMD are the core Dockerfile instructions

house · verified · docs-2026-11

A Dockerfile starts with FROM <image> and then layers RUN (execute a command), COPY or ADD (add files), WORKDIR, ENV…

Multi-stage builds copy artifacts from a builder image

house · verified · docs-2026-11

A multi-stage Dockerfile uses several FROM lines, optionally named with AS builder. Later stages can COPY…

Compose YAML defines services, networks, and volumes

house · verified · docs-2026-11

A compose.yaml file lists services under services:, each with an image or build context, ports, environment, volumes…

Express

3 snippets

Basic routing with app.METHOD

house · verified · 5.x

Routing determines how an Express app responds to a client request for a particular path and HTTP method…

Using middleware

house · verified · 5.x

Middleware functions have access to the request, the response, and the next function in the cycle. They can execute…

Error handling

house · verified · 5.x

Define error-handling middleware last, after other app.use and route calls, with four arguments: (err, req, res, next)…

FastAPI

3 snippets

Path and query parameters are declared in the function signature

house · verified · 0.115

In FastAPI, @app.get('/items/{item_id}') def read_item(item_id: int, q: str | None = None) treats item_id as a path…

Depends injects shared dependencies into a path operation

house · verified · 0.115

Declare a parameter as dep: Annotated[Type, Depends(provider)] so FastAPI calls provider, caches the result for the…

Pydantic models declare request and response bodies

house · verified · 0.115

Define a class Item(BaseModel) with typed fields and use it as a parameter (item: Item) to parse and validate the JSON…

Flask

2 snippets

app.route binds a URL to a view function

house · verified · 3.1

app = Flask(__name__); @app.route('/user/<int:id>') def user(id): return ... registers a view. Variable rules support…

Blueprints split an app into reusable route groups

house · verified · 3.1

bp = Blueprint('auth', __name__, url_prefix='/auth') then @bp.route('/login') defines routes that stay unregistered…

LangChain

4 snippets

create_agent is the LangChain agent harness

house · verified · 1.1

In current LangChain, create_agent (from langchain.agents) is the standard way to build an agent. An agent is a model…

create_agent loops tools until the model stops calling them

house · verified · 1.1

create_agent builds a graph that sends the message list (after applying system_prompt) to the model. If the AIMessage…

ChatOpenAI lives in langchain-openai

house · verified · 1.1

The OpenAI chat integration is langchain_openai.ChatOpenAI, installed with pip install -U langchain-openai. Construct…

create_agent accepts a provider:model string

house · verified · 1.1

The model argument to create_agent can be a string identifier such as openai:gpt-4.1 or a BaseChatModel instance…

Next.js

3 snippets

App Router uses the app directory

house · verified · 15.0.0

The Next.js App Router is defined by files in the app/ directory. page.tsx is a route's UI, layout.tsx wraps segments…

Server Actions run on the server from a form or call

house · verified · 15.0.0

A Server Action is an async function marked with the 'use server' directive. You can pass it to a form action or call…

generateMetadata sets per-route title and Open Graph tags

house · verified · 15.0.0

Export generateMetadata from a page or layout to set a route's <title>, description, and Open Graph fields. The…

Node.js

3 snippets

fs/promises is the async file API

house · verified · 22.x

import { readFile, writeFile, mkdir } from 'node:fs/promises' returns Promises instead of using callbacks…

fetch is a global HTTP client in Node.js

house · verified · 22.x

Node.js provides a global fetch() that follows the WHATWG Fetch Standard, plus Request, Response, Headers, and…

path.join and path.extname build portable file paths

house · verified · 22.x

import path from 'node:path'. path.join('src', 'index.ts') joins segments with the platform separator and normalizes…

NumPy

3 snippets

ndarray is a typed, fixed-shape N-dimensional array

house · verified · 2.1

np.array([[1, 2], [3, 4]], dtype=np.float64) builds an ndarray. arr.shape, arr.dtype, and arr.ndim describe it…

Broadcasting aligns array shapes for elementwise ops

house · verified · 2.1

NumPy compares shapes from the trailing dimension forward. Dimensions are compatible if they are equal or one of them…

Integer, slice, and boolean indexing select arrays

house · verified · 2.1

arr[0, :3] uses basic slicing and returns a view when possible. Integer array indexing and boolean masks (arr[arr > 0])…

OpenAI API

4 snippets

Responses API is recommended for new OpenAI projects

house · verified · v1

OpenAI recommends the Responses API (POST /v1/responses) for new projects. Chat Completions remains supported…

Structured Outputs bind the model to a JSON Schema

house · verified · v1

Structured Outputs constrains completed, non-refusal model output to a JSON Schema you supply. Prefer json_schema over…

Chain Responses with previous_response_id

house · verified · v1

Unlike Chat Completions, where your app must resend the full messages array each turn, the Responses API can carry…

Responses function calls are typed Items with call_id

house · verified · v1

On the Responses API, a model tool call arrives as a function_call output Item, not as a Chat Completions message with…

pandas

3 snippets

A DataFrame is a labeled two-dimensional table

house · verified · 2.2

pd.DataFrame(data, columns=..., index=...) builds a table of Series aligned on an index. df['col'] selects a column…

groupby splits, applies, and combines

house · verified · 2.2

df.groupby('key').agg({'value': 'sum'}) splits rows by key, applies an aggregation, and combines the result with the…

merge joins DataFrames on columns or indexes

house · verified · 2.2

pd.merge(left, right, on='id', how='inner') performs SQL-style joins. how can be 'inner', 'left', 'right', or 'outer'…

PostgreSQL

3 snippets

jsonb stores JSON in a decomposed binary form

house · verified · 17

PostgreSQL jsonb is a binary JSON type that supports indexing and operators: doc -> 'key' returns JSON, doc ->> 'key'…

WITH clauses define common table expressions

house · verified · 17

WITH regional AS (SELECT ... FROM sales GROUP BY region) SELECT * FROM regional WHERE total > 1000 names a subquery you…

B-tree is the default index; GIN and GiST cover other types

house · verified · 17

CREATE INDEX ON table (col) builds a B-tree, which is the right default for equality and range comparisons. Use UNIQUE…

Prisma

3 snippets

models in schema.prisma define tables and relations

house · verified · 6.x

A Prisma model is declared in schema.prisma: model User { id String @id @default(cuid()) email String @unique posts…

Prisma Client findMany, create, and update are typed CRUD helpers

house · verified · 6.x

const users = await prisma.user.findMany({ where: { email: { contains: '@' } }, include: { posts: true }, orderBy: {…

interactive transactions run several writes atomically

house · verified · 6.x

await prisma.$transaction(async (tx) => { ... }) starts an interactive transaction. Use the tx client for every query…

Pydantic

3 snippets

BaseModel validates and serializes typed data

house · verified · 2.10

class User(BaseModel): name: str; age: int = Field(ge=0). User(name='Ada', age=12) validates types and constraints and…

model_validate parses objects; model_validate_json parses strings

house · verified · 2.10

In Pydantic v2, Model.model_validate(data) validates a dict or object, and Model.model_validate_json(s) validates a…

field_validator and model_validator customize checks

house · verified · 2.10

@field_validator('email') classmethod def check_email(cls, v: str) -> str: runs after type coercion for that field…

Python

3 snippets

pathlib.Path is the object-oriented path API

house · verified · 3.13

from pathlib import Path. Path('src') / 'app.py' joins paths in a portable way. Path.read_text() and Path.write_text()…

dataclasses generate __init__ and comparison methods

house · verified · 3.13

from dataclasses import dataclass, field. @dataclass on a class synthesizes __init__, __repr__, and comparison methods…

asyncio.run and TaskGroup drive async programs

house · verified · 3.13

asyncio.run(main()) starts an event loop, runs the coroutine, and shuts the loop down. Inside async functions, await…

React

5 snippets

useState declares a state variable

house · verified · 19.0.0

useState is a React Hook that lets you add a state variable to a component. Call const [state, setState] =…

Rules of Hooks

house · verified · 19.0.0

Only call Hooks at the top level of a React function component or a custom Hook. Do not call Hooks inside loops…

useEffect synchronizes with an external system

house · verified · 19.0.0

useEffect lets you synchronize a component with an external system. React runs the effect after the component commits…

use client marks a Client Component module

house · verified · 19.0.0

The 'use client' directive tells bundlers to treat the module and its imports as Client Components. Put it at the top…

useRef holds a mutable value that does not trigger a re-render

contributed · pending · 19.0.0

useRef is a React Hook that lets you reference a value that is not needed for rendering. Call const ref =…

Requests

2 snippets

requests.get sends an HTTP GET and decodes the response

house · verified · 2.32

import requests; r = requests.get(url, params={'q': 'x'}, timeout=10). r.status_code, r.headers, r.text, and r.json()…

a Session persists cookies and connection pooling

house · verified · 2.32

with requests.Session() as s: s.headers.update({'User-Agent': '...'}); s.get(url) reuses TCP connections via urllib3…

Stripe

4 snippets

PaymentIntents create and confirm a payment

house · verified · v1

Stripe's Payment Intents API collects a payment in two steps: create a PaymentIntent on your server, then confirm it…

Idempotency-Key makes Stripe POSTs safely retryable

house · verified · v1

Stripe v1 POST requests accept an Idempotency-Key so a retried create or update does not run twice. Generate a unique…

Verify Stripe webhooks with Stripe-Signature

house · verified · v1

Stripe delivers events to your HTTPS webhook endpoint as a JSON POST. Verify each event before acting: check the…

Fulfill orders on payment_intent.succeeded

house · verified · v1

Fulfill goods or services from the payment_intent.succeeded webhook, not from client-side success callbacks. A customer…

TypeScript

3 snippets

strict turns on the recommended type-checking suite

house · verified · 5.x

Setting "strict": true in tsconfig.json enables strictNullChecks, noImplicitAny, strictFunctionTypes…

Partial, Pick, Omit, and Record are built-in utility types

house · verified · 5.x

TypeScript ships utility types that transform other types. Partial<T> makes every property optional. Required<T> makes…

satisfies checks a value against a type without widening it

house · verified · 5.x

The satisfies operator validates that an expression matches a type while keeping the expression's more specific…

Vite

3 snippets

defineConfig types the Vite config object

house · verified · 6.x

vite.config.ts typically export default defineConfig({ plugins: [react()], root, build: { outDir, target }, server: {…

only VITE_ prefixed env vars are exposed to client code

house · verified · 6.x

Vite loads .env, .env.local, .env.[mode], and .env.[mode].local. Only variables prefixed with VITE_ are exposed to…

Vite plugins hook into serve, build, and HMR

house · verified · 6.x

A Vite plugin is a Rollup-compatible plugin plus Vite-specific hooks such as config, configureServer…

Zod

3 snippets

safeParse vs parse

house · verified · 4.x

schema.parse(data) validates and returns the typed value, or throws a ZodError if validation fails…

z.object defines a typed object schema

house · verified · 4.x

z.object({ name: z.string(), count: z.number().int() }) describes an object and infers its TypeScript type. Unknown…

z.infer gets the TypeScript type from a schema

house · verified · 4.x

Use z.infer<typeof schema> to extract the output TypeScript type of a Zod schema. Use z.input<typeof schema> when the…