AWS SDK for JavaScript v3 uses per-service clients
AWS SDK for JavaScript v3 is modular. Install and import only the service client you need, for example import {…
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.
AWS SDK for JavaScript v3 uses per-service clients
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
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
AWS SDK for JavaScript v3 clients expose send(command) and return promises. There is no callback-style…
boto3.client and Session create service clients
In boto3, boto3.client("s3", region_name="us-east-1") returns a low-level service client…
boto3 loads credentials from the standard AWS chain
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
boto3.session.Session accepts profile_name, region_name, and optional explicit keys or a session token. If profile_name…
A Model maps a Python class to a database table
class Book(models.Model) with fields such as models.CharField(max_length=200), ForeignKey, and ManyToManyField defines…
QuerySets are lazy until you evaluate them
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
In urls.py, urlpatterns = [path('articles/<int:pk>/', views.article_detail, name='article-detail')] captures typed path…
FROM, RUN, COPY, and CMD are the core Dockerfile instructions
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
A multi-stage Dockerfile uses several FROM lines, optionally named with AS builder. Later stages can COPY…
Compose YAML defines services, networks, and volumes
A compose.yaml file lists services under services:, each with an image or build context, ports, environment, volumes…
Basic routing with app.METHOD
Routing determines how an Express app responds to a client request for a particular path and HTTP method…
Using middleware
Middleware functions have access to the request, the response, and the next function in the cycle. They can execute…
Error handling
Define error-handling middleware last, after other app.use and route calls, with four arguments: (err, req, res, next)…
Path and query parameters are declared in the function signature
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
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
Define a class Item(BaseModel) with typed fields and use it as a parameter (item: Item) to parse and validate the JSON…
app.route binds a URL to a view function
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
bp = Blueprint('auth', __name__, url_prefix='/auth') then @bp.route('/login') defines routes that stay unregistered…
create_agent is the LangChain agent harness
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
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
The OpenAI chat integration is langchain_openai.ChatOpenAI, installed with pip install -U langchain-openai. Construct…
create_agent accepts a provider:model string
The model argument to create_agent can be a string identifier such as openai:gpt-4.1 or a BaseChatModel instance…
App Router uses the app directory
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
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
Export generateMetadata from a page or layout to set a route's <title>, description, and Open Graph fields. The…
fs/promises is the async file API
import { readFile, writeFile, mkdir } from 'node:fs/promises' returns Promises instead of using callbacks…
fetch is a global HTTP client in Node.js
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
import path from 'node:path'. path.join('src', 'index.ts') joins segments with the platform separator and normalizes…
ndarray is a typed, fixed-shape N-dimensional array
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
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
arr[0, :3] uses basic slicing and returns a view when possible. Integer array indexing and boolean masks (arr[arr > 0])…
Responses API is recommended for new OpenAI projects
OpenAI recommends the Responses API (POST /v1/responses) for new projects. Chat Completions remains supported…
Structured Outputs bind the model to a JSON Schema
Structured Outputs constrains completed, non-refusal model output to a JSON Schema you supply. Prefer json_schema over…
Chain Responses with previous_response_id
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
On the Responses API, a model tool call arrives as a function_call output Item, not as a Chat Completions message with…
A DataFrame is a labeled two-dimensional table
pd.DataFrame(data, columns=..., index=...) builds a table of Series aligned on an index. df['col'] selects a column…
groupby splits, applies, and combines
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
pd.merge(left, right, on='id', how='inner') performs SQL-style joins. how can be 'inner', 'left', 'right', or 'outer'…
jsonb stores JSON in a decomposed binary form
PostgreSQL jsonb is a binary JSON type that supports indexing and operators: doc -> 'key' returns JSON, doc ->> 'key'…
WITH clauses define common table expressions
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
CREATE INDEX ON table (col) builds a B-tree, which is the right default for equality and range comparisons. Use UNIQUE…
models in schema.prisma define tables and relations
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
const users = await prisma.user.findMany({ where: { email: { contains: '@' } }, include: { posts: true }, orderBy: {…
interactive transactions run several writes atomically
await prisma.$transaction(async (tx) => { ... }) starts an interactive transaction. Use the tx client for every query…
BaseModel validates and serializes typed data
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
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
@field_validator('email') classmethod def check_email(cls, v: str) -> str: runs after type coercion for that field…
pathlib.Path is the object-oriented path API
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
from dataclasses import dataclass, field. @dataclass on a class synthesizes __init__, __repr__, and comparison methods…
asyncio.run and TaskGroup drive async programs
asyncio.run(main()) starts an event loop, runs the coroutine, and shuts the loop down. Inside async functions, await…
useState declares a state variable
useState is a React Hook that lets you add a state variable to a component. Call const [state, setState] =…
Rules of Hooks
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
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
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
useRef is a React Hook that lets you reference a value that is not needed for rendering. Call const ref =…
requests.get sends an HTTP GET and decodes the response
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
with requests.Session() as s: s.headers.update({'User-Agent': '...'}); s.get(url) reuses TCP connections via urllib3…
PaymentIntents create and confirm a payment
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
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
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
Fulfill goods or services from the payment_intent.succeeded webhook, not from client-side success callbacks. A customer…
strict turns on the recommended type-checking suite
Setting "strict": true in tsconfig.json enables strictNullChecks, noImplicitAny, strictFunctionTypes…
Partial, Pick, Omit, and Record are built-in utility types
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
The satisfies operator validates that an expression matches a type while keeping the expression's more specific…
defineConfig types the Vite config object
vite.config.ts typically export default defineConfig({ plugins: [react()], root, build: { outDir, target }, server: {…
only VITE_ prefixed env vars are exposed to client code
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
A Vite plugin is a Rollup-compatible plugin plus Vite-specific hooks such as config, configureServer…
safeParse vs parse
schema.parse(data) validates and returns the typed value, or throws a ZodError if validation fails…
z.object defines a typed object schema
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
Use z.infer<typeof schema> to extract the output TypeScript type of a Zod schema. Use z.input<typeof schema> when the…