一键导入
std-phlex-conventions
Phlex view component conventions — Atomic Design structure, class_variants, Stimulus, Turbo. Use when building Phlex (Ruby) view components.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Phlex view component conventions — Atomic Design structure, class_variants, Stimulus, Turbo. Use when building Phlex (Ruby) view components.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
ReactJS Vite SPA conventions — React Router, Zustand, TanStack Query, Tailwind, Framer Motion, ApexCharts. Use when building Vite web SPA pages or components.
WCAG 2.2 AA accessibility audit with 4-principle framework, automated checks, color contrast analysis, keyboard navigation testing, and ARIA pattern validation. Triggers on "accessibility audit", "WCAG audit", "a11y audit", "accessibility check", "screen reader test", "keyboard accessibility", or "accessibility compliance".
Design and review REST APIs for consistency, standards compliance, and developer experience. Use this skill whenever someone asks to design an API, create endpoints, review API contracts, generate OpenAPI specs, or says things like "design the API for X", "review this endpoint", "what should the API look like", "create a REST interface", "write the OpenAPI spec", or "check my API design". Also trigger when someone mentions pagination strategy, error response format, API versioning, or rate limiting design.
Atomic Design methodology for component hierarchy across Phlex (Rails), ReactJS Vite SPA, Next.js App Router, and React Native. Covers atoms, molecules, organisms, templates, and pages with composition rules. Triggers on "atomic design", "component hierarchy", "atom component", "molecule component", "organism component", "design system structure", or "component organization".
React composition patterns for scalable component architecture. Use when refactoring components with boolean prop proliferation, building component libraries, designing compound components, or reviewing component APIs. Triggers on "composition pattern", "compound component", "boolean props", "component architecture", "render props", or "React 19 patterns".
Execute deployment workflows with pre-flight checks, environment validation, health verification, and rollback procedures. Use this skill whenever someone asks to deploy, push to staging, release to production, or says things like "deploy to staging", "release this to production", "run the deployment checklist", "is this ready to deploy", "execute the release", or "roll back the deployment". Also trigger when someone mentions deployment readiness, smoke tests after deploy, rollback procedures, or canary/blue-green deployment strategy.
| name | std-phlex-conventions |
| description | Phlex view component conventions — Atomic Design structure, class_variants, Stimulus, Turbo. Use when building Phlex (Ruby) view components. |
| paths | ["**/app/views/**/*.rb","**/app/components/**/*.rb"] |
Standards for building Phlex view components following Atomic Design methodology.
Components::Base < Phlex::HTML — base for all reusable components (atoms through templates)Views::Base < Phlex::HTML — base for page-level viewsturbo_frame_tag) in base classes| Level | Namespace | Directory | Description |
|---|---|---|---|
| Atom | Components::Atoms:: | components/atoms/ | Indivisible primitives (button, input, icon) |
| Molecule | Components::Molecules:: | components/molecules/ | Atom compositions (search form, nav link) |
| Organism | Components::Organisms:: | components/organisms/ | UI sections (header, product card) |
| Template | Components::Templates:: | components/templates/ | Layout skeletons (dashboard layout) |
| Page | Views::{Resource}:: | views/{resource}/ | Data-bound pages (articles/index) |
Props are keyword arguments; pass unknown attributes through with **attrs:
class Components::Atoms::Button < Components::Base
def initialize(label:, variant: :primary, size: :md, type: :button, **attrs)
@label = label
@variant = variant
@size = size
@type = type
@attrs = attrs
end
def view_template
button(type: @type, class: VARIANTS.render(variant: @variant, size: @size), **@attrs) { @label }
end
end
Content blocks yield straight into the element:
class Components::Atoms::Card < Components::Base
def view_template(&block)
div(class: "rounded-lg border bg-card text-card-foreground shadow-sm p-6", &block)
end
end
Composition uses render:
class Components::Molecules::SearchForm < Components::Base
def view_template
form(class: "flex gap-2") do
render Components::Atoms::Input.new(placeholder: "Search...", name: "q")
render Components::Atoms::Button.new(label: "Search", variant: :primary)
end
end
end
bg-primary, text-foreground, rounded-lgclass_variants for components with multiple visual variantsView components never query or mutate. Controllers and services fetch; components receive props.
data-controller on the outermost element the controller ownsdata-action on interactive elements: "event->controller#method"data-{controller}-target on elements the controller referencesapp/javascript/controllers/onclick/onchange attributesPhlex::Testing::ViewHelper; assert rendered output, never private methodsdata-* attributesproduct_card.rb for ProductCard)**attrs pass-through, primitives violation checklist → references/component-levels-primitives.mdreferences/component-levels-composites.mdclass_variants multi-axis variants, caller class merging, tokens vs class_variants, token reference table → references/variants-and-styling.mddata-action into nested components → references/stimulus-wiring.mdreferences/turbo-frames-and-streams.mddata-* assertions, what not to test → references/testing.md