一键导入
fstring-html-safety
XSS prevention and HTML safety patterns for Your Project's f-string templates. Use when writing or reviewing any route file that renders HTML.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
XSS prevention and HTML safety patterns for Your Project's f-string templates. Use when writing or reviewing any route file that renders HTML.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Translate git history and orchestrator logs into authentic social content. Use when turning recent technical work into tweets, Dev.to posts, or changelog entries without manual summarisation.
Red team the staging environment with injection attacks, rate limit probes, and auth bypass attempts. Use before major releases or when adding new user-input surfaces.
Deploy Your Project to production safely. Use before any deployment, after code changes, or when asked to push to prod.
Facilitate a structured CONVERSATIONAL meeting between department agents via claude-peers — named phases (Diverge, Clarify, Challenge, Build, Stress Test, Converge, Decide) with state machine navigation. Agents push back on each other and build on each other's ideas. Minimum path: Diverge → Challenge → Build → Stress Test. Early exit only after Stress Test. NOT for simple task dispatch (use orchestra-management). NOT for solo research (use rd-architect).
Manage the 6-department orchestra via claude-peers. Use when dispatching tasks, coordinating departments, reviewing results, or shaping department behavior.
Write emails, social posts, and newsletter submissions for Your Project. Use when creating maker outreach, blog content, social media posts, or press pitches.
| name | fstring-html-safety |
| description | XSS prevention and HTML safety patterns for Your Project's f-string templates. Use when writing or reviewing any route file that renders HTML. |
| metadata | {"version":"2.0.0","author":"Master Agent","category":"security","updated":"2026-03-31T00:00:00.000Z"} |
You are responsible for preventing XSS vulnerabilities in Your Project's f-string HTML templates. Every route file renders HTML via Python f-strings — this is powerful but dangerous if user data isn't escaped.
Check:
f'<tag>{variable}</tag>' patterns without escape()?json.dumps(), not escape())Follow the rules below when creating any new f-string HTML.
Grep for unescaped injections: {variable} in HTML context without escape().
When a vulnerability is found, apply the minimal fix (add escape()) without restructuring.
from html import escape
name = escape(tool['name']) # BEFORE injecting
html = f'<h1>{name}</h1>'
# BAD — violates design system
style="color:#00D4F5"
# GOOD — uses CSS variable
style="color:var(--accent)"
All CSS variables are in components.py :root block.
# Every clickable element needs this for mobile
style="min-height:44px;padding:10px 16px;box-sizing:border-box;"
# BAD — invalid HTML
f'<a href="/x"><button>Click</button></a>'
# GOOD — style the link as a button
f'<a href="/x" class="btn-primary">Click</a>'
# BAD — backslash in f-string expression
f'<p>{value.replace("x", "y")}</p>'
# GOOD — pre-compute
cleaned = value.replace("x", "y")
f'<p>{cleaned}</p>'
import json
schema = {"@type": "FAQPage", "name": tool_name} # raw strings OK
json_ld = json.dumps(schema) # json.dumps handles escaping
html = f'<script type="application/ld+json">{json_ld}</script>'
{variable} in HTML for escape()| Request | Deliverable |
|---|---|
| "Review route for XSS" | List of unescaped injections with file:line |
| "Fix XSS in file X" | Minimal escape() additions, syntax verified |
| "New template for page" | Clean f-string HTML following all 6 rules |
html.escape() is sufficient for HTML text content. For attribute values, also escape quotes: escape(value, quote=True).:root) but CSS VALUES from user data could be. Never put user data in style="" attributes without sanitization.After every edit: python3 -c "import ast; ast.parse(open('file.py').read())"