frontend-security-coder

Implements XSS prevention, CSP configuration, and secure DOM manipulation for frontend applications.

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill frontend-security-coder-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-security-coder
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/frontend-security-coder
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill frontend-security-coder-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend applications are vulnerable to client-side attacks like XSS, clickjacking, and open redirects when developers use unsafe DOM APIs or skip security headers. This Skill provides hands-on guidance for writing secure frontend code that defends against these browser-based threats. ## Core Features & Use Cases - XSS Prevention and Sanitization: Guides safe DOM manipulation with textContent, DOMPurify integration, and context-aware output encoding. - Content Security Policy Configuration: Helps design nonce-based or hash-based CSP directives with violation reporting and progressive rollout. - Secure Auth and Navigation: Covers token storage, OAuth PKCE flows, redirect allowlists, and clickjacking protection with frame-ancestors. - Use Case: When building a comment feature that renders user-generated HTML, use this Skill to sanitize input with DOMPurify, configure a strict CSP, and validate all redirect URLs before deployment. ## Quick Start Ask the assistant to review your frontend component for XSS vulnerabilities and implement secure DOM manipulation with a Content Security Policy.

Frequently Asked Questions about frontend-security-coder

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

FAQPage Schema
How do I prevent XSS when rendering user-generated content?

Use textContent instead of innerHTML for plain text, and sanitize HTML with DOMPurify before insertion when rich formatting is required. Combine this with a strict Content Security Policy to block injected scripts as a defense-in-depth measure.

How to configure Content Security Policy for a web app?

Start with report-only mode to collect violations, then enforce directives like script-src with nonces or hashes instead of unsafe-inline. Move inline scripts to external files and progressively tighten directives while monitoring violation reports.

Should I store JWT tokens in localStorage or cookies?

localStorage tokens are accessible to any JavaScript on the page, making them vulnerable to XSS theft. HttpOnly cookies with SameSite attributes offer better protection, though they require CSRF defenses; the choice depends on your threat model.

Does clickjacking protection work during local development?

Frame-busting and X-Frame-Options can break legitimate iframe embedding during development. Apply clickjacking protection only in production or standalone deployments, and relax it in development environments that require iframe embedding.

When should I use a security auditor instead of secure coding guidance?

Use secure coding guidance for hands-on implementation like XSS fixes and CSP setup. Use a security auditor for high-level assessments such as compliance reviews, threat modeling, penetration testing planning, and security architecture evaluation.