// library
Severity
Bucket
If a PR changes an API endpoint/controller/route, assess current production health before adding heavier logic. - If a monitoring MCP is available (Datadog/Grafana): query current p95 latency and error rate for that endpoint. - If the endpoint is already degraded, warn against adding heavy queries, blocking I/O, or complex synchronous logic; require performance evidence or a safe rollout plan. To enable this check, the PR should reference the endpoint path (e.g., `POST /api/payments`) or the controller/action name.
Ensure that resources such as files, sockets, or database connections are managed using the `with` statement. Code that explicitly calls `.close()` without `with` should be refactored to use context managers for automatic resource cleanup.
Do not put complex logic or long-running tasks in package `init()` functions. Keep `init()` minimal (if you use it at all), such as simple registration of types or default variable initialization. Perform real setup in explicit functions (like in `main` or a setup function called by main).
Be c sem areful when slicing out a small portion of a large slice or array. The resulting slice still references the entire original array. If you only need the small portion long-term, copy that data into a new slice to avoid keeping the large array in memory.
Don't place a defer inside a loop that iterates many times (especially if the loop is performance-critical). Defer calls won't run until the function returns and each call has a small overhead; instead, perform the operation directly in the loop when possible.