[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77PJS8MCPZTDDTMBPTMX4MR":3,"skill-same:01M77PJS8MCPZTDDTMBPTMX4MR":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":33,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M77PJS8MCPZTDDTMBPTMX4MR","best-practices",null,"Apply modern web development best practices for security, compatibility, and code quality. Use when asked to \"apply best practices\", \"security audit\", \"modernize code\", \"code quality review\", or \"check for vulnerabilities\".","Reihantt6\u002Fsns-myagent","Reihantt6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219822095?v=4","01M77KK94PV8B7C2D9XWXNS8DJ","Mohamad Reihan tegar prasetya","01M77KK958QFMTHYXGXFV7KZ79",2,"MIT","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbest-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: \"Apply modern web development best practices for security, compatibility, and code quality. Use when asked to \\\"apply best practices\\\", \\\"security audit\\\", \\\"modernize code\\\", \\\"code quality review\\\", or \\\"check for vulnerabilities\\\".\"\nlicense: \"MIT\"\nmetadata: {\"author\":\"web-quality-skills\",\"version\":\"1.0\"}\n---\n# Best practices\n\nModern web development standards based on Lighthouse best practices audits. Covers security, browser compatibility, and code quality patterns.\n\n## Security\n\n### HTTPS everywhere\n\n**Enforce HTTPS:**\n```html\n\u003C!-- ❌ Mixed content -->\n\u003Cimg src=\"http:\u002F\u002Fexample.com\u002Fimage.jpg\">\n\u003Cscript src=\"http:\u002F\u002Fcdn.example.com\u002Fscript.js\">\u003C\u002Fscript>\n\n\u003C!-- ✅ HTTPS only -->\n\u003Cimg src=\"https:\u002F\u002Fexample.com\u002Fimage.jpg\">\n\u003Cscript src=\"https:\u002F\u002Fcdn.example.com\u002Fscript.js\">\u003C\u002Fscript>\n```\n\nAvoid protocol-relative URLs (`\u002F\u002Fexample.com\u002F...`) — they're an HTTP-era pattern with no benefit on HTTPS-only sites and hide the actual scheme from reviewers.\n\n**HSTS Header:**\n```\nStrict-Transport-Security: max-age=31536000; includeSubDomains; preload\n```\n\n### Content Security Policy (CSP)\n\n```html\n\u003C!-- Basic CSP via meta tag -->\n\u003Cmeta http-equiv=\"Content-Security-Policy\" \n      content=\"default-src 'self'; \n               script-src 'self' https:\u002F\u002Ftrusted-cdn.com; \n               style-src 'self' 'unsafe-inline';\n               img-src 'self' data: https:;\n               connect-src 'self' https:\u002F\u002Fapi.example.com;\">\n\n\u003C!-- Better: HTTP header -->\n```\n\n**CSP Header (recommended):**\n```\nContent-Security-Policy: \n  default-src 'self';\n  script-src 'self' 'nonce-abc123' https:\u002F\u002Ftrusted.com;\n  style-src 'self' 'nonce-abc123';\n  img-src 'self' data: https:;\n  connect-src 'self' https:\u002F\u002Fapi.example.com;\n  frame-ancestors 'self';\n  base-uri 'self';\n  form-action 'self';\n```\n\n**Using nonces for inline scripts:**\n```html\n\u003Cscript nonce=\"abc123\">\n  \u002F\u002F This inline script is allowed\n\u003C\u002Fscript>\n```\n\n### Trusted Types (modern DOM-XSS defense)\n\nA strict CSP blocks loading untrusted *script files*, but it doesn't stop a string from reaching `innerHTML`, `eval`, or other DOM-XSS sinks. Trusted Types — Baseline across all major browsers since early 2026 — closes that hole by making sinks reject raw strings and accept only typed objects produced by a named policy.\n\n```\nContent-Security-Policy: require-trusted-types-for 'script'; trusted-types default;\n```\n\n```javascript\n\u002F\u002F One central policy that does the sanitization\nconst escape = trustedTypes.createPolicy('default', {\n  createHTML: (s) => DOMPurify.sanitize(s, { RETURN_TRUSTED_TYPE: true })\n});\n\n\u002F\u002F ❌ This now throws TypeError under enforcement\nelement.innerHTML = userInput;\n\n\u002F\u002F ✅ Goes through the policy\nelement.innerHTML = escape.createHTML(userInput);\n```\n\nRoll out with `Content-Security-Policy-Report-Only` first to find every sink usage in your app, then flip to enforcement. Angular has built-in Trusted Types support; React 19+ produces TrustedHTML when Trusted Types are enforced; for everything else, [DOMPurify](https:\u002F\u002Fgithub.com\u002Fcure53\u002FDOMPurify) is the de-facto sanitizer.\n\n### Subresource Integrity (SRI) for third-party scripts\n\nPin every `\u003Cscript>` and `\u003Clink rel=\"stylesheet\">` you load from a CDN you don't control. If the CDN is compromised — as happened to polyfill.io in 2024 — the browser refuses to execute a file whose hash doesn't match.\n\n```html\n\u003Cscript src=\"https:\u002F\u002Fcdn.example.com\u002Flib@1.2.3\u002Fdist\u002Flib.js\"\n        integrity=\"sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K\u002Fuxy9rx7HNQlGYl1kPzQho1wx4JwY8wC\"\n        crossorigin=\"anonymous\">\u003C\u002Fscript>\n```\n\n`integrity` accepts space-separated hashes; include the next version's hash before rotating to avoid downtime. Generate with `openssl dgst -sha384 -binary file.js | openssl base64 -A`. SRI requires `crossorigin` and an `Access-Control-Allow-Origin` response header from the CDN.\n\n### Security headers\n\n```\n# Prevent clickjacking — prefer CSP `frame-ancestors` (above); X-Frame-Options\n# is the legacy fallback for older browsers.\nX-Frame-Options: DENY\n\n# Prevent MIME type sniffing\nX-Content-Type-Options: nosniff\n\n# Do NOT send X-XSS-Protection. The legacy browser XSS auditor was deprecated\n# and removed (Chrome 78, Edge 17), and in some cases it introduced its own\n# vulnerabilities. Use a strict CSP + Trusted Types (below) instead.\n\n# Control referrer information\nReferrer-Policy: strict-origin-when-cross-origin\n\n# Permissions policy (formerly Feature-Policy)\nPermissions-Policy: geolocation=(), microphone=(), camera=()\n```\n\n### No vulnerable libraries\n\n```bash\n# Check for vulnerabilities\nnpm audit\nyarn audit\n\n# Auto-fix when possible\nnpm audit fix\n\n# Check specific package\nnpm ls lodash\n```\n\n**Keep dependencies updated:**\n```json\n\u002F\u002F package.json\n{\n  \"scripts\": {\n    \"audit\": \"npm audit --audit-level=moderate\",\n    \"update\": \"npm update && npm audit fix\"\n  }\n}\n```\n\n**Known vulnerable patterns to avoid:**\n```javascript\n\u002F\u002F ❌ Recursive merges of untrusted input can pollute Object.prototype\n\u002F\u002F    via __proto__, constructor, or prototype keys.\n_.merge(target, userInput);          \u002F\u002F lodash \u003C4.17.20\n$.extend(true, {}, target, userInput); \u002F\u002F jQuery deep extend\nObject.assign(target, ...userInputs); \u002F\u002F safe by itself (shallow), but unsafe\n                                      \u002F\u002F when target IS Object.prototype-derived\n                                      \u002F\u002F and userInput contains __proto__\n\n\u002F\u002F ✅ For untrusted bags, use a null-prototype object so __proto__ is just a key\nconst safe = Object.create(null);\nObject.assign(safe, userInput); \u002F\u002F shallow, no recursion → safe by construction\n\n\u002F\u002F ✅ For deep copies, structuredClone drops __proto__ and functions\nconst deepSafe = structuredClone(userInput);\n\n\u002F\u002F ✅ For deep merges, use a library that explicitly blocks dangerous keys\n\u002F\u002F    (e.g. lodash ≥4.17.21 _.mergeWith with a customizer, or deepmerge-ts).\n```\n\n### Input sanitization\n\n```javascript\n\u002F\u002F ❌ XSS vulnerable\nelement.innerHTML = userInput;\ndocument.write(userInput);\n\n\u002F\u002F ✅ Safe text content\nelement.textContent = userInput;\n\n\u002F\u002F ✅ If HTML needed, sanitize\nimport DOMPurify from 'dompurify';\nelement.innerHTML = DOMPurify.sanitize(userInput);\n```\n\n### Secure cookies\n\n```javascript\n\u002F\u002F ❌ Insecure cookie\ndocument.cookie = \"session=abc123\";\n\n\u002F\u002F ✅ Secure cookie (server-side)\nSet-Cookie: session=abc123; Secure; HttpOnly; SameSite=Strict; Path=\u002F\n```\n\n---\n\n## Browser compatibility\n\n### Doctype declaration\n\n```html\n\u003C!-- ❌ Missing or invalid doctype -->\n\u003CHTML>\n\u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD HTML 4.01\u002F\u002FEN\">\n\n\u003C!-- ✅ HTML5 doctype -->\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n```\n\n### Character encoding\n\n```html\n\u003C!-- ❌ Missing or late charset -->\n\u003Chtml>\n\u003Chead>\n  \u003Ctitle>Page\u003C\u002Ftitle>\n  \u003Cmeta charset=\"UTF-8\">\n\u003C\u002Fhead>\n\n\u003C!-- ✅ Charset as first element in head -->\n\u003Chtml>\n\u003Chead>\n  \u003Cmeta charset=\"UTF-8\">\n  \u003Ctitle>Page\u003C\u002Ftitle>\n\u003C\u002Fhead>\n```\n\n### Viewport meta tag\n\n```html\n\u003C!-- ❌ Missing viewport -->\n\u003Chead>\n  \u003Ctitle>Page\u003C\u002Ftitle>\n\u003C\u002Fhead>\n\n\u003C!-- ✅ Responsive viewport -->\n\u003Chead>\n  \u003Cmeta charset=\"UTF-8\">\n  \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  \u003Ctitle>Page\u003C\u002Ftitle>\n\u003C\u002Fhead>\n```\n\n### Feature detection\n\n```javascript\n\u002F\u002F ❌ Browser detection (brittle)\nif (navigator.userAgent.includes('Chrome')) {\n  \u002F\u002F Chrome-specific code\n}\n\n\u002F\u002F ✅ Feature detection\nif ('IntersectionObserver' in window) {\n  \u002F\u002F Use IntersectionObserver\n} else {\n  \u002F\u002F Fallback\n}\n\n\u002F\u002F ✅ Using @supports in CSS\n@supports (display: grid) {\n  .container {\n    display: grid;\n  }\n}\n\n@supports not (display: grid) {\n  .container {\n    display: flex;\n  }\n}\n```\n\n### Polyfills (when needed)\n\nPrefer **bundling polyfills at build time** (Babel\u002FSWC + `core-js`, or `@vitejs\u002Fplugin-legacy`) targeted by your supported-browsers list. This eliminates the runtime check entirely and avoids shipping polyfill bytes to modern browsers.\n\nIf you must load a polyfill at runtime, append a script element — never use `document.write` (it blocks the parser and is broken in async\u002Fdeferred contexts):\n\n```html\n\u003Cscript>\n  if (!('fetch' in window)) {\n    const s = document.createElement('script');\n    s.src = '\u002Fpolyfills\u002Ffetch.js';\n    s.defer = true;\n    document.head.appendChild(s);\n  }\n\u003C\u002Fscript>\n```\n\n**Never load polyfills from a third-party CDN you don't control.** The `polyfill.io` service was [compromised in mid-2024](https:\u002F\u002Fsansec.io\u002Fresearch\u002Fpolyfill-supply-chain-attack) in a supply-chain attack and used to serve malware to ~100k sites. Self-host, or use a vetted mirror (e.g. [Cloudflare's `cdnjs` polyfill build](https:\u002F\u002Fblog.cloudflare.com\u002Fpolyfill-io-now-available-on-cdnjs-reduce-your-supply-chain-risk\u002F)) — and pin the version with [Subresource Integrity](#subresource-integrity-sri-for-third-party-scripts).\n\n---\n\n## Deprecated APIs\n\n### Avoid these\n\n```javascript\n\u002F\u002F ❌ document.write (blocks parsing)\ndocument.write('\u003Cscript src=\"...\">\u003C\u002Fscript>');\n\n\u002F\u002F ✅ Dynamic script loading\nconst script = document.createElement('script');\nscript.src = '...';\ndocument.head.appendChild(script);\n\n\u002F\u002F ❌ Synchronous XHR (blocks main thread)\nconst xhr = new XMLHttpRequest();\nxhr.open('GET', url, false); \u002F\u002F false = synchronous\n\n\u002F\u002F ✅ Async fetch\nconst response = await fetch(url);\n\n\u002F\u002F ❌ Application Cache (deprecated)\n\u003Chtml manifest=\"cache.manifest\">\n\n\u002F\u002F ✅ Service Workers\nif ('serviceWorker' in navigator) {\n  navigator.serviceWorker.register('\u002Fsw.js');\n}\n```\n\n### Event listener passive\n\n```javascript\n\u002F\u002F ❌ Non-passive touch\u002Fwheel (may block scrolling)\nelement.addEventListener('touchstart', handler);\nelement.addEventListener('wheel', handler);\n\n\u002F\u002F ✅ Passive listeners (allows smooth scrolling)\nelement.addEventListener('touchstart', handler, { passive: true });\nelement.addEventListener('wheel', handler, { passive: true });\n\n\u002F\u002F ✅ If you need preventDefault, be explicit\nelement.addEventListener('touchstart', handler, { passive: false });\n```\n\n---\n\n## Console & errors\n\n### No console errors\n\n```javascript\n\u002F\u002F ❌ Errors in production\nconsole.log('Debug info'); \u002F\u002F Remove in production\nthrow new Error('Unhandled'); \u002F\u002F Catch all errors\n\n\u002F\u002F ✅ Proper error handling\ntry {\n  riskyOperation();\n} catch (error) {\n  \u002F\u002F Log to error tracking service\n  errorTracker.captureException(error);\n  \u002F\u002F Show user-friendly message\n  showErrorMessage('Something went wrong. Please try again.');\n}\n```\n\n### Error boundaries (React)\n\n```jsx\nclass ErrorBoundary extends React.Component {\n  state = { hasError: false };\n  \n  static getDerivedStateFromError(error) {\n    return { hasError: true };\n  }\n  \n  componentDidCatch(error, info) {\n    errorTracker.captureException(error, { extra: info });\n  }\n  \n  render() {\n    if (this.state.hasError) {\n      return \u003CFallbackUI \u002F>;\n    }\n    return this.props.children;\n  }\n}\n\n\u002F\u002F Usage\n\u003CErrorBoundary>\n  \u003CApp \u002F>\n\u003C\u002FErrorBoundary>\n```\n\n### Global error handler\n\n```javascript\n\u002F\u002F Catch unhandled errors\nwindow.addEventListener('error', (event) => {\n  errorTracker.captureException(event.error);\n});\n\n\u002F\u002F Catch unhandled promise rejections\nwindow.addEventListener('unhandledrejection', (event) => {\n  errorTracker.captureException(event.reason);\n});\n```\n\n---\n\n## Source maps\n\n### Production configuration\n\n```javascript\n\u002F\u002F ❌ Source maps exposed in production\n\u002F\u002F webpack.config.js\nmodule.exports = {\n  devtool: 'source-map', \u002F\u002F Exposes source code\n};\n\n\u002F\u002F ✅ Hidden source maps (uploaded to error tracker)\nmodule.exports = {\n  devtool: 'hidden-source-map',\n};\n\n\u002F\u002F ✅ Or no source maps in production\nmodule.exports = {\n  devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',\n};\n```\n\n**Strip `sourcesContent` from production maps** when uploading to your error tracker. By default, bundlers embed the full original source inside the `.map` file — anyone who obtains the map (including via a misconfigured upload step) gets your unminified code. Configure your bundler to omit `sourcesContent`, or use a Sentry\u002FBugsnag CLI flag that does so when uploading.\n\nFor Vite, prefer `sourcemap: 'hidden'` over `'true'` so the `\u002F\u002F# sourceMappingURL=` comment isn't emitted into the bundle.\n\n---\n\n## Performance best practices\n\n### Avoid blocking patterns\n\n```javascript\n\u002F\u002F ❌ Blocking script\n\u003Cscript src=\"heavy-library.js\">\u003C\u002Fscript>\n\n\u002F\u002F ✅ Deferred script\n\u003Cscript defer src=\"heavy-library.js\">\u003C\u002Fscript>\n\n\u002F\u002F ❌ Blocking CSS import\n@import url('other-styles.css');\n\n\u002F\u002F ✅ Link tags (parallel loading)\n\u003Clink rel=\"stylesheet\" href=\"styles.css\">\n\u003Clink rel=\"stylesheet\" href=\"other-styles.css\">\n```\n\n### Efficient event handlers\n\n```javascript\n\u002F\u002F ❌ Handler on every element\nitems.forEach(item => {\n  item.addEventListener('click', handleClick);\n});\n\n\u002F\u002F ✅ Event delegation\ncontainer.addEventListener('click', (e) => {\n  if (e.target.matches('.item')) {\n    handleClick(e);\n  }\n});\n```\n\n### Memory management\n\n```javascript\n\u002F\u002F ❌ Memory leak (never removed)\nconst handler = () => { \u002F* ... *\u002F };\nwindow.addEventListener('resize', handler);\n\n\u002F\u002F ✅ Cleanup when done\nconst handler = () => { \u002F* ... *\u002F };\nwindow.addEventListener('resize', handler);\n\n\u002F\u002F Later, when component unmounts:\nwindow.removeEventListener('resize', handler);\n\n\u002F\u002F ✅ Using AbortController\nconst controller = new AbortController();\nwindow.addEventListener('resize', handler, { signal: controller.signal });\n\n\u002F\u002F Cleanup:\ncontroller.abort();\n```\n\n---\n\n## Code quality\n\n### Valid HTML\n\n```html\n\u003C!-- ❌ Invalid HTML -->\n\u003Cdiv id=\"header\">\n\u003Cdiv id=\"header\"> \u003C!-- Duplicate ID -->\n\n\u003Cul>\n  \u003Cdiv>Item\u003C\u002Fdiv> \u003C!-- Invalid child -->\n\u003C\u002Ful>\n\n\u003Ca href=\"\u002F\">\u003Cbutton>Click\u003C\u002Fbutton>\u003C\u002Fa> \u003C!-- Invalid nesting -->\n\n\u003C!-- ✅ Valid HTML -->\n\u003Cheader id=\"site-header\">\n\u003C\u002Fheader>\n\n\u003Cul>\n  \u003Cli>Item\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ca href=\"\u002F\" class=\"button\">Click\u003C\u002Fa>\n```\n\n### Semantic HTML\n\n```html\n\u003C!-- ❌ Non-semantic -->\n\u003Cdiv class=\"header\">\n  \u003Cdiv class=\"nav\">\n    \u003Cdiv class=\"nav-item\">Home\u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"main\">\n  \u003Cdiv class=\"article\">\n    \u003Cdiv class=\"title\">Headline\u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\n\u003C!-- ✅ Semantic HTML5 -->\n\u003Cheader>\n  \u003Cnav>\n    \u003Ca href=\"\u002F\">Home\u003C\u002Fa>\n  \u003C\u002Fnav>\n\u003C\u002Fheader>\n\u003Cmain>\n  \u003Carticle>\n    \u003Ch1>Headline\u003C\u002Fh1>\n  \u003C\u002Farticle>\n\u003C\u002Fmain>\n```\n\n### Image aspect ratios\n\n```html\n\u003C!-- ❌ Distorted images -->\n\u003Cimg src=\"photo.jpg\" width=\"300\" height=\"100\">\n\u003C!-- If actual ratio is 4:3, this squishes the image -->\n\n\u003C!-- ✅ Preserve aspect ratio -->\n\u003Cimg src=\"photo.jpg\" width=\"300\" height=\"225\">\n\u003C!-- Actual 4:3 dimensions -->\n\n\u003C!-- ✅ CSS object-fit for flexibility -->\n\u003Cimg src=\"photo.jpg\" style=\"width: 300px; height: 200px; object-fit: cover;\">\n```\n\n---\n\n## Permissions & privacy\n\n### Request permissions properly\n\n```javascript\n\u002F\u002F ❌ Request on page load (bad UX, often denied)\nnavigator.geolocation.getCurrentPosition(success, error);\n\n\u002F\u002F ✅ Request in context, after user action\nfindNearbyButton.addEventListener('click', async () => {\n  \u002F\u002F Explain why you need it\n  if (await showPermissionExplanation()) {\n    navigator.geolocation.getCurrentPosition(success, error);\n  }\n});\n```\n\n### Permissions policy\n\n```html\n\u003C!-- Restrict powerful features -->\n\u003Cmeta http-equiv=\"Permissions-Policy\" \n      content=\"geolocation=(), camera=(), microphone=()\">\n\n\u003C!-- Or allow for specific origins -->\n\u003Cmeta http-equiv=\"Permissions-Policy\" \n      content=\"geolocation=(self 'https:\u002F\u002Fmaps.example.com')\">\n```\n\n---\n\n## Audit checklist\n\n### Security (critical)\n- [ ] HTTPS enabled, no mixed content\n- [ ] No vulnerable dependencies (`npm audit`)\n- [ ] CSP headers configured (with `frame-ancestors`, `base-uri`, `form-action`)\n- [ ] `require-trusted-types-for 'script'` enforced (or report-only during rollout)\n- [ ] Third-party `\u003Cscript>`\u002F`\u003Clink rel=\"stylesheet\">` pinned with SRI hashes\n- [ ] Security headers present (HSTS, X-Content-Type-Options, Referrer-Policy)\n- [ ] No exposed source maps (and `sourcesContent` stripped from uploaded ones)\n\n### Compatibility\n- [ ] Valid HTML5 doctype\n- [ ] Charset declared first in head\n- [ ] Viewport meta tag present\n- [ ] No deprecated APIs used\n- [ ] Passive event listeners for scroll\u002Ftouch\n\n### Code quality\n- [ ] No console errors\n- [ ] Valid HTML (no duplicate IDs)\n- [ ] Semantic HTML elements used\n- [ ] Proper error handling\n- [ ] Memory cleanup in components\n\n### UX\n- [ ] No intrusive interstitials\n- [ ] Permission requests in context\n- [ ] Clear error messages\n- [ ] Appropriate image aspect ratios\n\n## Tools\n\n| Tool | Purpose |\n|------|---------|\n| `npm audit` | Dependency vulnerabilities |\n| [SecurityHeaders.com](https:\u002F\u002Fsecurityheaders.com) | Header analysis |\n| [W3C Validator](https:\u002F\u002Fvalidator.w3.org) | HTML validation |\n| Lighthouse | Best practices audit |\n| [Observatory](https:\u002F\u002Fobservatory.mozilla.org) | Security scan |\n\n## References\n\n- [MDN Web Security](https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FSecurity)\n- [OWASP Top 10](https:\u002F\u002Fowasp.org\u002Fwww-project-top-ten\u002F)\n- [Web Quality Audit](..\u002Fweb-quality-audit\u002FSKILL.md)\n","# Best practices\n\nModern web development standards based on Lighthouse best practices audits. Covers security, browser compatibility, and code quality patterns.\n\n## Security\n\n### HTTPS everywhere\n\n**Enforce HTTPS:**\n```html\n\u003C!-- ❌ Mixed content -->\n\u003Cimg src=\"http:\u002F\u002Fexample.com\u002Fimage.jpg\">\n\u003Cscript src=\"http:\u002F\u002Fcdn.example.com\u002Fscript.js\">\u003C\u002Fscript>\n\n\u003C!-- ✅ HTTPS only -->\n\u003Cimg src=\"https:\u002F\u002Fexample.com\u002Fimage.jpg\">\n\u003Cscript src=\"https:\u002F\u002Fcdn.example.com\u002Fscript.js\">\u003C\u002Fscript>\n```\n\nAvoid protocol-relative URLs (`\u002F\u002Fexample.com\u002F...`) — they're an HTTP-era pattern with no benefit on HTTPS-only sites and hide the actual scheme from reviewers.\n\n**HSTS Header:**\n```\nStrict-Transport-Security: max-age=31536000; includeSubDomains; preload\n```\n\n### Content Security Policy (CSP)\n\n```html\n\u003C!-- Basic CSP via meta tag -->\n\u003Cmeta http-equiv=\"Content-Security-Policy\" \n      content=\"default-src 'self'; \n               script-src 'self' https:\u002F\u002Ftrusted-cdn.com; \n               style-src 'self' 'unsafe-inline';\n               img-src 'self' data: https:;\n               connect-src 'self' https:\u002F\u002Fapi.example.com;\">\n\n\u003C!-- Better: HTTP header -->\n```\n\n**CSP Header (recommended):**\n```\nContent-Security-Policy: \n  default-src 'self';\n  script-src 'self' 'nonce-abc123' https:\u002F\u002Ftrusted.com;\n  style-src 'self' 'nonce-abc123';\n  img-src 'self' data: https:;\n  connect-src 'self' https:\u002F\u002Fapi.example.com;\n  frame-ancestors 'self';\n  base-uri 'self';\n  form-action 'self';\n```\n\n**Using nonces for inline scripts:**\n```html\n\u003Cscript nonce=\"abc123\">\n  \u002F\u002F This inline script is allowed\n\u003C\u002Fscript>\n```\n\n### Trusted Types (modern DOM-XSS defense)\n\nA strict CSP blocks loading untrusted *script files*, but it doesn't stop a string from reaching `innerHTML`, `eval`, or other DOM-XSS sinks. Trusted Types — Baseline across all major browsers since early 2026 — closes that hole by making sinks reject raw strings and accept only typed objects produced by a named policy.\n\n```\nContent-Security-Policy: require-trusted-types-for 'script'; trusted-types default;\n```\n\n```javascript\n\u002F\u002F One central policy that does the sanitization\nconst escape = trustedTypes.createPolicy('default', {\n  createHTML: (s) => DOMPurify.sanitize(s, { RETURN_TRUSTED_TYPE: true })\n});\n\n\u002F\u002F ❌ This now throws TypeError under enforcement\nelement.innerHTML = userInput;\n\n\u002F\u002F ✅ Goes through the policy\nelement.innerHTML = escape.createHTML(userInput);\n```\n\nRoll out with `Content-Security-Policy-Report-Only` first to find every sink usage in your app, then flip to enforcement. Angular has built-in Trusted Types support; React 19+ produces TrustedHTML when Trusted Types are enforced; for everything else, [DOMPurify](https:\u002F\u002Fgithub.com\u002Fcure53\u002FDOMPurify) is the de-facto sanitizer.\n\n### Subresource Integrity (SRI) for third-party scripts\n\nPin every `\u003Cscript>` and `\u003Clink rel=\"stylesheet\">` you load from a CDN you don't control. If the CDN is compromised — as happened to polyfill.io in 2024 — the browser refuses to execute a file whose hash doesn't match.\n\n```html\n\u003Cscript src=\"https:\u002F\u002Fcdn.example.com\u002Flib@1.2.3\u002Fdist\u002Flib.js\"\n        integrity=\"sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K\u002Fuxy9rx7HNQlGYl1kPzQho1wx4JwY8wC\"\n        crossorigin=\"anonymous\">\u003C\u002Fscript>\n```\n\n`integrity` accepts space-separated hashes; include the next version's hash before rotating to avoid downtime. Generate with `openssl dgst -sha384 -binary file.js | openssl base64 -A`. SRI requires `crossorigin` and an `Access-Control-Allow-Origin` response header from the CDN.\n\n### Security headers\n\n```\n# Prevent clickjacking — prefer CSP `frame-ancestors` (above); X-Frame-Options\n# is the legacy fallback for older browsers.\nX-Frame-Options: DENY\n\n# Prevent MIME type sniffing\nX-Content-Type-Options: nosniff\n\n# Do NOT send X-XSS-Protection. The legacy browser XSS auditor was deprecated\n# and removed (Chrome 78, Edge 17), and in some cases it introduced its own\n# vulnerabilities. Use a strict CSP + Trusted Types (below) instead.\n\n# Control referrer information\nReferrer-Policy: strict-origin-when-cross-origin\n\n# Permissions policy (formerly Feature-Policy)\nPermissions-Policy: geolocation=(), microphone=(), camera=()\n```\n\n### No vulnerable libraries\n\n```bash\n# Check for vulnerabilities\nnpm audit\nyarn audit\n\n# Auto-fix when possible\nnpm audit fix\n\n# Check specific package\nnpm ls lodash\n```\n\n**Keep dependencies updated:**\n```json\n\u002F\u002F package.json\n{\n  \"scripts\": {\n    \"audit\": \"npm audit --audit-level=moderate\",\n    \"update\": \"npm update && npm audit fix\"\n  }\n}\n```\n\n**Known vulnerable patterns to avoid:**\n```javascript\n\u002F\u002F ❌ Recursive merges of untrusted input can pollute Object.prototype\n\u002F\u002F    via __proto__, constructor, or prototype keys.\n_.merge(target, userInput);          \u002F\u002F lodash \u003C4.17.20\n$.extend(true, {}, target, userInput); \u002F\u002F jQuery deep extend\nObject.assign(target, ...userInputs); \u002F\u002F safe by itself (shallow), but unsafe\n                                      \u002F\u002F when target IS Object.prototype-derived\n                                      \u002F\u002F and userInput contains __proto__\n\n\u002F\u002F ✅ For untrusted bags, use a null-prototype object so __proto__ is just a key\nconst safe = Object.create(null);\nObject.assign(safe, userInput); \u002F\u002F shallow, no recursion → safe by construction\n\n\u002F\u002F ✅ For deep copies, structuredClone drops __proto__ and functions\nconst deepSafe = structuredClone(userInput);\n\n\u002F\u002F ✅ For deep merges, use a library that explicitly blocks dangerous keys\n\u002F\u002F    (e.g. lodash ≥4.17.21 _.mergeWith with a customizer, or deepmerge-ts).\n```\n\n### Input sanitization\n\n```javascript\n\u002F\u002F ❌ XSS vulnerable\nelement.innerHTML = userInput;\ndocument.write(userInput);\n\n\u002F\u002F ✅ Safe text content\nelement.textContent = userInput;\n\n\u002F\u002F ✅ If HTML needed, sanitize\nimport DOMPurify from 'dompurify';\nelement.innerHTML = DOMPurify.sanitize(userInput);\n```\n\n### Secure cookies\n\n```javascript\n\u002F\u002F ❌ Insecure cookie\ndocument.cookie = \"session=abc123\";\n\n\u002F\u002F ✅ Secure cookie (server-side)\nSet-Cookie: session=abc123; Secure; HttpOnly; SameSite=Strict; Path=\u002F\n```\n\n---\n\n## Browser compatibility\n\n### Doctype declaration\n\n```html\n\u003C!-- ❌ Missing or invalid doctype -->\n\u003CHTML>\n\u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD HTML 4.01\u002F\u002FEN\">\n\n\u003C!-- ✅ HTML5 doctype -->\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n```\n\n### Character encoding\n\n```html\n\u003C!-- ❌ Missing or late charset -->\n\u003Chtml>\n\u003Chead>\n  \u003Ctitle>Page\u003C\u002Ftitle>\n  \u003Cmeta charset=\"UTF-8\">\n\u003C\u002Fhead>\n\n\u003C!-- ✅ Charset as first element in head -->\n\u003Chtml>\n\u003Chead>\n  \u003Cmeta charset=\"UTF-8\">\n  \u003Ctitle>Page\u003C\u002Ftitle>\n\u003C\u002Fhead>\n```\n\n### Viewport meta tag\n\n```html\n\u003C!-- ❌ Missing viewport -->\n\u003Chead>\n  \u003Ctitle>Page\u003C\u002Ftitle>\n\u003C\u002Fhead>\n\n\u003C!-- ✅ Responsive viewport -->\n\u003Chead>\n  \u003Cmeta charset=\"UTF-8\">\n  \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  \u003Ctitle>Page\u003C\u002Ftitle>\n\u003C\u002Fhead>\n```\n\n### Feature detection\n\n```javascript\n\u002F\u002F ❌ Browser detection (brittle)\nif (navigator.userAgent.includes('Chrome')) {\n  \u002F\u002F Chrome-specific code\n}\n\n\u002F\u002F ✅ Feature detection\nif ('IntersectionObserver' in window) {\n  \u002F\u002F Use IntersectionObserver\n} else {\n  \u002F\u002F Fallback\n}\n\n\u002F\u002F ✅ Using @supports in CSS\n@supports (display: grid) {\n  .container {\n    display: grid;\n  }\n}\n\n@supports not (display: grid) {\n  .container {\n    display: flex;\n  }\n}\n```\n\n### Polyfills (when needed)\n\nPrefer **bundling polyfills at build time** (Babel\u002FSWC + `core-js`, or `@vitejs\u002Fplugin-legacy`) targeted by your supported-browsers list. This eliminates the runtime check entirely and avoids shipping polyfill bytes to modern browsers.\n\nIf you must load a polyfill at runtime, append a script element — never use `document.write` (it blocks the parser and is broken in async\u002Fdeferred contexts):\n\n```html\n\u003Cscript>\n  if (!('fetch' in window)) {\n    const s = document.createElement('script');\n    s.src = '\u002Fpolyfills\u002Ffetch.js';\n    s.defer = true;\n    document.head.appendChild(s);\n  }\n\u003C\u002Fscript>\n```\n\n**Never load polyfills from a third-party CDN you don't control.** The `polyfill.io` service was [compromised in mid-2024](https:\u002F\u002Fsansec.io\u002Fresearch\u002Fpolyfill-supply-chain-attack) in a supply-chain attack and used to serve malware to ~100k sites. Self-host, or use a vetted mirror (e.g. [Cloudflare's `cdnjs` polyfill build](https:\u002F\u002Fblog.cloudflare.com\u002Fpolyfill-io-now-available-on-cdnjs-reduce-your-supply-chain-risk\u002F)) — and pin the version with [Subresource Integrity](#subresource-integrity-sri-for-third-party-scripts).\n\n---\n\n## Deprecated APIs\n\n### Avoid these\n\n```javascript\n\u002F\u002F ❌ document.write (blocks parsing)\ndocument.write('\u003Cscript src=\"...\">\u003C\u002Fscript>');\n\n\u002F\u002F ✅ Dynamic script loading\nconst script = document.createElement('script');\nscript.src = '...';\ndocument.head.appendChild(script);\n\n\u002F\u002F ❌ Synchronous XHR (blocks main thread)\nconst xhr = new XMLHttpRequest();\nxhr.open('GET', url, false); \u002F\u002F false = synchronous\n\n\u002F\u002F ✅ Async fetch\nconst response = await fetch(url);\n\n\u002F\u002F ❌ Application Cache (deprecated)\n\u003Chtml manifest=\"cache.manifest\">\n\n\u002F\u002F ✅ Service Workers\nif ('serviceWorker' in navigator) {\n  navigator.serviceWorker.register('\u002Fsw.js');\n}\n```\n\n### Event listener passive\n\n```javascript\n\u002F\u002F ❌ Non-passive touch\u002Fwheel (may block scrolling)\nelement.addEventListener('touchstart', handler);\nelement.addEventListener('wheel', handler);\n\n\u002F\u002F ✅ Passive listeners (allows smooth scrolling)\nelement.addEventListener('touchstart', handler, { passive: true });\nelement.addEventListener('wheel', handler, { passive: true });\n\n\u002F\u002F ✅ If you need preventDefault, be explicit\nelement.addEventListener('touchstart', handler, { passive: false });\n```\n\n---\n\n## Console & errors\n\n### No console errors\n\n```javascript\n\u002F\u002F ❌ Errors in production\nconsole.log('Debug info'); \u002F\u002F Remove in production\nthrow new Error('Unhandled'); \u002F\u002F Catch all errors\n\n\u002F\u002F ✅ Proper error handling\ntry {\n  riskyOperation();\n} catch (error) {\n  \u002F\u002F Log to error tracking service\n  errorTracker.captureException(error);\n  \u002F\u002F Show user-friendly message\n  showErrorMessage('Something went wrong. Please try again.');\n}\n```\n\n### Error boundaries (React)\n\n```jsx\nclass ErrorBoundary extends React.Component {\n  state = { hasError: false };\n  \n  static getDerivedStateFromError(error) {\n    return { hasError: true };\n  }\n  \n  componentDidCatch(error, info) {\n    errorTracker.captureException(error, { extra: info });\n  }\n  \n  render() {\n    if (this.state.hasError) {\n      return \u003CFallbackUI \u002F>;\n    }\n    return this.props.children;\n  }\n}\n\n\u002F\u002F Usage\n\u003CErrorBoundary>\n  \u003CApp \u002F>\n\u003C\u002FErrorBoundary>\n```\n\n### Global error handler\n\n```javascript\n\u002F\u002F Catch unhandled errors\nwindow.addEventListener('error', (event) => {\n  errorTracker.captureException(event.error);\n});\n\n\u002F\u002F Catch unhandled promise rejections\nwindow.addEventListener('unhandledrejection', (event) => {\n  errorTracker.captureException(event.reason);\n});\n```\n\n---\n\n## Source maps\n\n### Production configuration\n\n```javascript\n\u002F\u002F ❌ Source maps exposed in production\n\u002F\u002F webpack.config.js\nmodule.exports = {\n  devtool: 'source-map', \u002F\u002F Exposes source code\n};\n\n\u002F\u002F ✅ Hidden source maps (uploaded to error tracker)\nmodule.exports = {\n  devtool: 'hidden-source-map',\n};\n\n\u002F\u002F ✅ Or no source maps in production\nmodule.exports = {\n  devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',\n};\n```\n\n**Strip `sourcesContent` from production maps** when uploading to your error tracker. By default, bundlers embed the full original source inside the `.map` file — anyone who obtains the map (including via a misconfigured upload step) gets your unminified code. Configure your bundler to omit `sourcesContent`, or use a Sentry\u002FBugsnag CLI flag that does so when uploading.\n\nFor Vite, prefer `sourcemap: 'hidden'` over `'true'` so the `\u002F\u002F# sourceMappingURL=` comment isn't emitted into the bundle.\n\n---\n\n## Performance best practices\n\n### Avoid blocking patterns\n\n```javascript\n\u002F\u002F ❌ Blocking script\n\u003Cscript src=\"heavy-library.js\">\u003C\u002Fscript>\n\n\u002F\u002F ✅ Deferred script\n\u003Cscript defer src=\"heavy-library.js\">\u003C\u002Fscript>\n\n\u002F\u002F ❌ Blocking CSS import\n@import url('other-styles.css');\n\n\u002F\u002F ✅ Link tags (parallel loading)\n\u003Clink rel=\"stylesheet\" href=\"styles.css\">\n\u003Clink rel=\"stylesheet\" href=\"other-styles.css\">\n```\n\n### Efficient event handlers\n\n```javascript\n\u002F\u002F ❌ Handler on every element\nitems.forEach(item => {\n  item.addEventListener('click', handleClick);\n});\n\n\u002F\u002F ✅ Event delegation\ncontainer.addEventListener('click', (e) => {\n  if (e.target.matches('.item')) {\n    handleClick(e);\n  }\n});\n```\n\n### Memory management\n\n```javascript\n\u002F\u002F ❌ Memory leak (never removed)\nconst handler = () => { \u002F* ... *\u002F };\nwindow.addEventListener('resize', handler);\n\n\u002F\u002F ✅ Cleanup when done\nconst handler = () => { \u002F* ... *\u002F };\nwindow.addEventListener('resize', handler);\n\n\u002F\u002F Later, when component unmounts:\nwindow.removeEventListener('resize', handler);\n\n\u002F\u002F ✅ Using AbortController\nconst controller = new AbortController();\nwindow.addEventListener('resize', handler, { signal: controller.signal });\n\n\u002F\u002F Cleanup:\ncontroller.abort();\n```\n\n---\n\n## Code quality\n\n### Valid HTML\n\n```html\n\u003C!-- ❌ Invalid HTML -->\n\u003Cdiv id=\"header\">\n\u003Cdiv id=\"header\"> \u003C!-- Duplicate ID -->\n\n\u003Cul>\n  \u003Cdiv>Item\u003C\u002Fdiv> \u003C!-- Invalid child -->\n\u003C\u002Ful>\n\n\u003Ca href=\"\u002F\">\u003Cbutton>Click\u003C\u002Fbutton>\u003C\u002Fa> \u003C!-- Invalid nesting -->\n\n\u003C!-- ✅ Valid HTML -->\n\u003Cheader id=\"site-header\">\n\u003C\u002Fheader>\n\n\u003Cul>\n  \u003Cli>Item\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ca href=\"\u002F\" class=\"button\">Click\u003C\u002Fa>\n```\n\n### Semantic HTML\n\n```html\n\u003C!-- ❌ Non-semantic -->\n\u003Cdiv class=\"header\">\n  \u003Cdiv class=\"nav\">\n    \u003Cdiv class=\"nav-item\">Home\u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"main\">\n  \u003Cdiv class=\"article\">\n    \u003Cdiv class=\"title\">Headline\u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\n\u003C!-- ✅ Semantic HTML5 -->\n\u003Cheader>\n  \u003Cnav>\n    \u003Ca href=\"\u002F\">Home\u003C\u002Fa>\n  \u003C\u002Fnav>\n\u003C\u002Fheader>\n\u003Cmain>\n  \u003Carticle>\n    \u003Ch1>Headline\u003C\u002Fh1>\n  \u003C\u002Farticle>\n\u003C\u002Fmain>\n```\n\n### Image aspect ratios\n\n```html\n\u003C!-- ❌ Distorted images -->\n\u003Cimg src=\"photo.jpg\" width=\"300\" height=\"100\">\n\u003C!-- If actual ratio is 4:3, this squishes the image -->\n\n\u003C!-- ✅ Preserve aspect ratio -->\n\u003Cimg src=\"photo.jpg\" width=\"300\" height=\"225\">\n\u003C!-- Actual 4:3 dimensions -->\n\n\u003C!-- ✅ CSS object-fit for flexibility -->\n\u003Cimg src=\"photo.jpg\" style=\"width: 300px; height: 200px; object-fit: cover;\">\n```\n\n---\n\n## Permissions & privacy\n\n### Request permissions properly\n\n```javascript\n\u002F\u002F ❌ Request on page load (bad UX, often denied)\nnavigator.geolocation.getCurrentPosition(success, error);\n\n\u002F\u002F ✅ Request in context, after user action\nfindNearbyButton.addEventListener('click', async () => {\n  \u002F\u002F Explain why you need it\n  if (await showPermissionExplanation()) {\n    navigator.geolocation.getCurrentPosition(success, error);\n  }\n});\n```\n\n### Permissions policy\n\n```html\n\u003C!-- Restrict powerful features -->\n\u003Cmeta http-equiv=\"Permissions-Policy\" \n      content=\"geolocation=(), camera=(), microphone=()\">\n\n\u003C!-- Or allow for specific origins -->\n\u003Cmeta http-equiv=\"Permissions-Policy\" \n      content=\"geolocation=(self 'https:\u002F\u002Fmaps.example.com')\">\n```\n\n---\n\n## Audit checklist\n\n### Security (critical)\n- [ ] HTTPS enabled, no mixed content\n- [ ] No vulnerable dependencies (`npm audit`)\n- [ ] CSP headers configured (with `frame-ancestors`, `base-uri`, `form-action`)\n- [ ] `require-trusted-types-for 'script'` enforced (or report-only during rollout)\n- [ ] Third-party `\u003Cscript>`\u002F`\u003Clink rel=\"stylesheet\">` pinned with SRI hashes\n- [ ] Security headers present (HSTS, X-Content-Type-Options, Referrer-Policy)\n- [ ] No exposed source maps (and `sourcesContent` stripped from uploaded ones)\n\n### Compatibility\n- [ ] Valid HTML5 doctype\n- [ ] Charset declared first in head\n- [ ] Viewport meta tag present\n- [ ] No deprecated APIs used\n- [ ] Passive event listeners for scroll\u002Ftouch\n\n### Code quality\n- [ ] No console errors\n- [ ] Valid HTML (no duplicate IDs)\n- [ ] Semantic HTML elements used\n- [ ] Proper error handling\n- [ ] Memory cleanup in components\n\n### UX\n- [ ] No intrusive interstitials\n- [ ] Permission requests in context\n- [ ] Clear error messages\n- [ ] Appropriate image aspect ratios\n\n## Tools\n\n| Tool | Purpose |\n|------|---------|\n| `npm audit` | Dependency vulnerabilities |\n| [SecurityHeaders.com](https:\u002F\u002Fsecurityheaders.com) | Header analysis |\n| [W3C Validator](https:\u002F\u002Fvalidator.w3.org) | HTML validation |\n| Lighthouse | Best practices audit |\n| [Observatory](https:\u002F\u002Fobservatory.mozilla.org) | Security scan |\n\n## References\n\n- [MDN Web Security](https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FSecurity)\n- [OWASP Top 10](https:\u002F\u002Fowasp.org\u002Fwww-project-top-ten\u002F)\n- [Web Quality Audit](..\u002Fweb-quality-audit\u002FSKILL.md)\n",{"license":15,"metadata":24,"description":7},{"author":25,"version":26},"web-quality-skills","1.0","main","58843b159d7a4050d6b785a98b908cce505c0b92","agent\u002Fskills\u002Fbest-practices",0,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent","https:\u002F\u002Fgithub.com\u002FReihantt6","reihsns.web.id","2026-08-19 20:08:18",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add Reihantt6\u002Fsns-myagent --skill best-practices",{"tool":41,"command":42},"bunx","bunx skills add Reihantt6\u002Fsns-myagent --skill best-practices",{"tool":44,"command":45},"pnpm","pnpm dlx skills add Reihantt6\u002Fsns-myagent --skill best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbest-practices\u002FSKILL.md",true,[],[50,57,64,71,78,85],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M77XDCYZ407XYMF2T4P6F7VT","youtube-transcript","Extract transcripts from YouTube videos. Use when the user asks for a transcript, subtitles, or captions of a YouTube video and provides a YouTube URL (youtube.com\u002Fwatch?v=, youtu.be\u002F, or similar). Supports output with or without timestamps.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-transcript\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M77XD7PBC98J6MXGJJ2TJ8DX","youtube-thumbnail-design","YouTube thumbnail design with specific dimensions, contrast rules, and mobile preview optimization. Covers safe zones, text placement, face expression psychology, and A\u002FB testing. Use for: YouTube thumbnails, video cover images, click-through optimization. Triggers: youtube thumbnail, thumbnail design, video thumbnail, click through rate, ctr optimization, youtube cover, video cover image, thumbnail maker, thumbnail tips, youtube design, video preview image","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-thumbnail-design\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M77XD2541C8HXJ6RHYZP4NGJ","youtube-short-maker","Make YouTube Shorts that hold attention with Pexo — vertical 9:16, fast-paced, hook in the first 3 seconds. Describe your topic and Pexo writes the script, generates the shots, picks the models, and assembles a finished Short with music and captions. Use for YouTube Shorts: \"youtube short\", \"make a youtube short\", \"shorts video\", \"short-form video\". NOT for long-form or landscape video.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-short-maker\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M77XCXKVSYK7KTZ3PQBVVGFD","xcode-project-setup","Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fxcode-project-setup\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M77XCR1DV8ZQK2NHWKVY4EWX","x402","Set up Browser Use Cloud payments with x402 — pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key. Two setups it works out up front — \"just use it\" (set up a wallet so you or Claude Code can run cloud browser tasks paid from the wallet — Claude writes and runs throwaway scripts, nothing touches your codebase) or \"build it in\" (install the SDK and write the key + code into your project). Walks through wallet setup, funding, .env, and a ~$1 test run. Use when the user asks about x402, pay-per-use, USDC payments, or wants Browser Use Cloud without an API key. For the free-tier signup (reverse-CAPTCHA → API key), use `browser-use cloud signup` or the `cloud` skill instead.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx402\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M77XCMD3R3ZBZQQSW6E0793B","x-twitter-scraper","Build GitHub Copilot workflows with Xquik X API SDKs, REST endpoints, hosted Apify Actor runs, MCP tools, TweetClaw OpenClaw plugin installs, signed webhooks, tweet search, user lookup, follower exports, media actions, and agent automation.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx-twitter-scraper\u002FSKILL.md",[],[]]