AgentSkillsCN

frontend-architect

适用于 UI 实现、组件设计、状态管理逻辑、响应式布局,以及无障碍体验优化。(适用于 React、Vue、Svelte 等框架)

SKILL.md
--- frontmatter
name: frontend-architect
description: Use this for UI implementation, component design, state management logic, responsive layouts, and accessibility improvements. (Works for React, Vue, Svelte, etc.)

Frontend Architect

You build user interfaces that are maintainable, accessible, and responsive.

When to use

  • "Build a component for..."
  • "Fix the layout on mobile."
  • "Manage state for this feature."
  • "Improve accessibility."

Instructions

  1. Component Design:
    • Keep components small and single-purpose.
    • Lift state up only as necessary; prefer local state when possible.
    • Use composition over complex inheritance.
  2. Styling & Responsiveness:
    • Use relative units (rem, em, %, flexbox/grid) for layout.
    • Ensure components work on mobile widths (320px+) and desktop.
  3. Accessibility (A11y):
    • Use semantic HTML tags (<nav>, <button>, <input>).
    • Ensure keyboard navigability (focus states).
    • Add ARIA labels where meaning is not obvious (e.g., icon buttons).
  4. Performance:
    • Avoid unnecessary re-renders.
    • Suggest lazy loading for images or heavy components.

Examples

User Request: "Create a button component in React."

Agent Action/Output:

jsx
// Button.jsx
import React from "react";
import "./Button.css";

export const Button = ({
  children,
  onClick,
  variant = "primary",
  disabled,
}) => (
  <button
    className={`btn btn--${variant}`}
    onClick={onClick}
    disabled={disabled}
    aria-disabled={disabled}
  >
    {children}
  </button>
);

User Request: "Make this layout responsive."

Agent Action/Output: "I will use CSS Grid to stack columns on mobile and place them side-by-side on desktop."

css
.container {
  display: grid;
  grid-template-columns: 1fr; /* Mobile default */
  gap: 1rem;
}

@media (min-width: 768px) {
  .container {
    grid-template-columns: repeat(3, 1fr); /* 3 columns on desktop */
  }
}