Recipes
Step-by-step solutions for real development tasks.
699 published
Page 1 of 20
Gate on Accessibility with axe-core
Run axe-core in CI so a PR that introduces a WCAG violation is blocked before merge, not found in a yearly audit.
Announce Dynamic Updates with aria-live Regions
Add an aria-live region so screen readers announce search results and toast notifications without the user moving focus.
Alert with Multi-Window Burn Rate
Check the error budget burn rate over both 1h and 5m windows so a fast burn pages immediately and a slow burn notifies within an hour.
Detect Anomalies Against a Rolling Baseline
Compute a 7-day rolling median and alert when the current value exceeds 3 sigma so a gradual regression is caught not just spikes.
Rotate API Keys with Overlap and Grace Period
Issue the new key, accept both during a grace period, then revoke the old so clients update without downtime.
Test API Schema Diff for Breaking Changes
Compare the OpenAPI spec before and after a PR so a removed field or narrowed type is flagged as a breaking change.
Version an API with URL Path Segments
Mount v1 and v2 on separate path prefixes so a breaking change in v2 does not affect v1 clients still in production.
Keep an Audit History with a Trigger
Create a trigger that writes the old and new values to an audit table on every update so changes are traceable without app code.
Restore the Database to a Point in Time
Use point-in-time recovery to restore to 5 minutes before the bad migration so data loss is minimized.
Detect Performance Regression with Benchmark CI
Run benchmarks on every PR and compare against the main branch baseline so a 10 percent slowdown is flagged before merge.
Isolate Resources with the Bulkhead Pattern
Allocate a fixed thread pool per downstream service so a slow service does not exhaust threads needed by healthy ones.
Split Bundles at Route Level for Faster Loads
Configure dynamic imports per route so the initial bundle is 40KB not 400KB and each page loads only its own code.
Design CDN Cache Keys to Avoid Stale Variants
Include the variant in the cache key so a mobile and desktop response do not collide and serve the wrong layout.
Limit Chaos Experiment Blast Radius
Define a steady-state hypothesis and abort conditions so a chaos experiment auto-stops before it takes down the whole fleet.
Add a Circuit Breaker with Half-Open State
Trip the breaker after 5 failures, allow one probe in half-open, and close on success so cascading failures are contained.
Distribute Private Content with CloudFront Signed URLs
Generate a signed URL with a short expiry so a user can download a protected asset without the bucket being public.
Audit API Calls with CloudTrail Event History
Query CloudTrail for who created or deleted a resource in a time window so an unauthorized change is attributable.
Query Logs with CloudWatch Logs Insights
Write a Logs Insights query that filters by error and groups by service so the top error source is visible in seconds.
Balance the Cluster Autoscaler Across Zones
Configure the autoscaler with balance-similar-node-groups so a zone outage does not leave all pods in one zone.
Add a Command Palette with Keyboard Shortcut
Register a Cmd+K shortcut that opens a searchable command palette so power users navigate without touching the mouse.
Cancel Duplicate Runs on Concurrent Pushes
Add a concurrency group so a second push to the same branch cancels the in-flight run and frees the runner.
Skip CI Jobs on Documentation-Only Changes
Add path filters so jobs that compile or test code are skipped when the diff touches only markdown and docs.
Hot Reload ConfigMap Changes Without Restart
Mount the ConfigMap as a projected volume and watch for changes so the app picks up config updates without a rolling restart.
Size the Connection Pool to Avoid Exhaustion
Set the pool max to twice the CPU cores and add a acquire timeout so a spike does not exhaust connections and queue forever.
Pin the Database Connection SSL Certificate
Set sslmode to verify-full and pin the CA so a rogue DB proxy with a valid but different certificate is rejected.
Scan Container Images for Known CVEs
Scan the built image against a vulnerability database so a critical CVE in a base layer blocks the deploy.
Add Consumer-Driven Contract Tests with Pact
Generate a pact from the consumer's test suite and verify it in the provider pipeline so breaking API changes are caught before deploy.
Propagate a Correlation ID Through All Logs
Generate a correlation ID at the edge and attach it to every log line so a single user request is traceable end to end.
Cache CORS Preflight Responses Server-Side
Set Access-Control-Max-Age so OPTIONS preflight responses are cached and do not add a round-trip to every cross-origin request.
Gate on Coverage Diff Not Absolute Number
Compare coverage against the base branch so a PR that drops coverage by 2 percent fails even if the total is still above 80 percent.
Inline Critical CSS and Async Load the Rest
Extract above-the-fold CSS into a style tag and load the rest asynchronously so the first paint does not wait for the full stylesheet.
Prevent Overlapping CronJobs with Concurrency Rule
Set concurrencyPolicy to Forbid so a slow cron job does not start a second instance while the first is still running.
Trigger a Cross-Repository Pipeline on Tag
Use a repository dispatch event so tagging a shared library triggers downstream consumers to rebuild and test.
Report CSP Violations to a Collector Endpoint
Add a report-uri to the Content-Security-Policy header so browser violations are collected and triaged as security events.
Prevent CSRF with Double-Submit Cookie
Issue a CSRF token as a cookie and require it as a header so a cross-site form post without the header is rejected.
Expose a Custom Metric for a Business KPI
Instrument the checkout flow to emit a conversion counter so the business KPI is on the same dashboard as latency.