code-yeongyu/oh-my-openagent / packages/shared-skills/skills/frontend
frontend
FlaggedBuilds, styles, and polishes anything drawn with HTML, CSS, or SVG: web UI, pages, components, HTML reports rendered to PDF or print, figures, PNG/SVG diagrams, slides, and images for Notion or Slack. Use for any styling, layout, animation, or visual-quality task, or when asked to make something look or feel a certain way.
scripts/detect/lint.ts
View on GitHubimport { isIgnored } from "./core/page"
import { extensionOf } from "./core/source"
import type { PageRule, Rule, SourceRule } from "./rule"
import { ALL_RULES } from "./rules"
import type { DetectConfig, Finding, PageSnapshot, RuleMeta, Severity, SourceFile } from "./types"
export type LintOptions = {
readonly config?: DetectConfig
/** Rules to run; defaults to every built-in rule. */
readonly rules?: readonly Rule[]
/** File the snapshot was rendered from, carried into element locations. */
readonly file?: string
}
/** Severity after the project's override, or null when the rule is switched off. @public */
export function effectiveSeverity(meta: RuleMeta, config: DetectConfig | undefined): Severity | null {
const setting = config?.rules?.[meta.id]
if (setting === "off") return null
return setting ?? meta.severity
}
const isPageRule = (r: Rule): r is PageRule => r.meta.engine === "page"
const isSourceRule = (r: Rule): r is SourceRule => r.meta.engine === "source"
export function lintSnapshot(snapshot: PageSnapshot, options: LintOptions = {}): readonly Finding[] {
const config = options.config ?? {}
const findings: Finding[] = []
for (const rule of (options.rules ?? ALL_RULES).filter(isPageRule)) {
const severity = effectiveSeverity(rule.meta, config)
if (severity === null) continue
const overridden = config.rules?.[rule.meta.id] !== undefined
for (const hit of rule.check({ snapshot, config })) {
if (hit.element && isIgnored(snapshot, hit.element, rule.meta.id)) continue
findings.push({
ruleId: rule.meta.id,
name: rule.meta.name,
category: rule.meta.category,
severity: hit.severityFixed && hit.severity ? hit.severity : overridden ? severity : (hit.severity ?? severity),
message: hit.message,
fixHint: rule.meta.fixHint,
snippet: hit.snippet,
location: hit.element
? {
kind: "element",
selector: hit.element.selector,
rect: hit.element.rect,
viewport: snapshot.viewport,
...(options.file ? { file: options.file } : {}),
}
: { kind: "page", viewport: snapshot.viewport, ...(options.file ? { file: options.file } : {}) },
})
}
}
return findings
}
export function lintSources(files: readonly SourceFile[], options: LintOptions = {}): readonly Finding[] {
const config = options.config ?? {}
const findings: Finding[] = []
const rules = (options.rules ?? ALL_RULES).filter(isSourceRule)
for (const file of files) {
const ext = extensionOf(file.path)
for (const rule of rules) {
if (!rule.extensions.includes(ext)) continue
const severity = effectiveSeverity(rule.meta, config)
if (severity === null) continue
for (const hit of rule.check({ file, config })) {
findings.push({
ruleId: rule.meta.id,
name: rule.meta.name,
category: rule.meta.category,
severity,
message: hit.message,
fixHint: rule.meta.fixHint,
snippet: hit.snippet,
location: { kind: "source", file: file.path, line: hit.line, column: hit.column },
})
}
}
}
return findings
}
const SEVERITY_ORDER: Readonly<Record<Severity, number>> = { error: 0, warning: 1, advisory: 2 }
export function sortFindings(findings: readonly Finding[]): readonly Finding[] {
const key = (f: Finding): string => {
const l = f.location
switch (l.kind) {
case "source":
return `${l.file}:${String(l.line).padStart(8, "0")}:${String(l.column).padStart(6, "0")}`
case "element":
return `${l.file ?? ""}@${l.viewport.width}:${String(Math.round(l.rect.y)).padStart(8, "0")}:${l.selector}`
case "page":
return `${l.file ?? ""}@${l.viewport.width}`
}
}
return [...findings].sort(
(a, b) =>
key(a).localeCompare(key(b)) ||
SEVERITY_ORDER[a.severity] - SEVERITY_ORDER[b.severity] ||
a.ruleId.localeCompare(b.ruleId),
)
}
/** True when any finding is an error or a warning; advisories never fail a gate. */
export const hasFailures = (findings: readonly Finding[]): boolean => findings.some((f) => f.severity !== "advisory")
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |