Why this matters
Reduces connection churn and improves throughput.
Instantiate expensive clients (DB/HTTP/SDK) once and inject/reuse them; avoid per-call construction.
Reduces connection churn and improves throughput.
Side-by-side examples engineers can pattern-match during review.
def handler():
client = HttpClient()
return client.get(url)class Service:
def __init__(self, client: 'HttpClient'):
self.client = client
def handler(self):
return self.client.get(url)HttpClient() in every functionService(HttpClient()).handler()From the same buckets as this rule.
All static JS/CSS/font/image files MUST use content-hashed filenames (e.g., app.9c1a7b.js) and be served with "Cache-Control: public, max-age=31536000, immutable". HTML and other non-fingerprinted documents MUST be served with "Cache-Control: no-cache" (or equivalent) to enable conditional revalidation.