best-practices

Applies web security, compatibility, and code quality standards based on Lighthouse audits.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/Peterson-Benhame/agent-skills --skill best-practices-peterson-benhame
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: best-practices
Source: https://github.com/Peterson-Benhame/agent-skills/tree/main/packages/skills-catalog/skills/%28quality%29/web-best-practices
Command: npx skills add https://github.com/Peterson-Benhame/agent-skills --skill best-practices-peterson-benhame

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Web applications often ship with security vulnerabilities, deprecated APIs, invalid HTML, and poor error handling that expose users to attacks and degrade reliability. This Skill provides a concrete checklist and code patterns to audit and fix these issues. ## Core Features & Use Cases - Security Hardening: Enforce HTTPS, configure CSP and security headers, sanitize user input, and audit dependencies with npm audit. - Browser Compatibility: Apply feature detection, proper doctype/charset/viewport declarations, and replace deprecated APIs like synchronous XHR and Application Cache. - Code Quality & Error Handling: Use semantic HTML, error boundaries, global error handlers, passive event listeners, and memory cleanup patterns. - Use Case: Before launching a site, ask the agent to audit your codebase for mixed content, missing security headers, vulnerable dependencies, and console errors, then apply the recommended fixes. ## Quick Start Review my web project for security vulnerabilities, deprecated APIs, and code quality issues, then apply the recommended fixes.

Frequently Asked Questions about best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix security vulnerabilities in my web application?

Start by running npm audit to find vulnerable dependencies, then enforce HTTPS everywhere, configure Content Security Policy headers, and sanitize user input with DOMPurify instead of using innerHTML directly. Add security headers like X-Frame-Options and Strict-Transport-Security.

What is a Content Security Policy and how do I configure it?

A Content Security Policy is an HTTP header or meta tag that controls which resources the browser may load, preventing XSS attacks. Configure it with directives like default-src 'self', script-src with nonces, and frame-ancestors to restrict framing.

How do I replace deprecated web APIs in legacy code?

Replace document.write with dynamic script element creation, synchronous XHR with async fetch, and Application Cache with Service Workers. Use feature detection with 'in' checks or CSS @supports instead of user-agent sniffing.

Why do touch and wheel event listeners hurt scrolling performance?

Non-passive touchstart and wheel listeners force the browser to wait for potential preventDefault calls before scrolling. Mark them with { passive: true } so scrolling stays smooth, or use AbortController for cleanup.

When should I not use this best practices skill?

Do not use it for accessibility audits, SEO optimization, or Core Web Vitals performance work, as those are covered by dedicated skills. It also is not suited for comprehensive multi-area audits spanning all quality dimensions.