skills/optics-context/SKILL.md
Use the Optics design framework for styling applications. Apply Optics classes for layout, spacing, typography, colors, and components. Use when working on CSS, styling views, or implementing design system guidelines.
npx skillsauth add rolemodel/rolemodel-skills optics-contextInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Apply the Optics design system for consistent, token-based styling in Rails applications.
assets/tokens.jsonSearch for components in this order:
skills/optics-context/assets/components.json
app/assets/stylesheets for existing classesAlways use CSS custom properties from assets/tokens.json:
var(--op-color-primary), var(--op-color-background)var(--op-space-small), var(--op-space-medium), var(--op-space-large)var(--op-font-size-base), var(--op-line-height-normal)var(--op-radius-small), var(--op-border-width)var(--op-shadow-small), var(--op-shadow-medium)Never use hard-coded values:
❌ Colors: #fff, #000, rgb(...), rgba(...), hsl(...), color names like white, black ❌ Spacing: Bare px, rem, em values in padding, margin, gap ❌ Shadows: box-shadow: 0 1px 3px rgba(...) ❌ Borders: border: 1px solid #ddd ❌ Gradients: linear-gradient(...) with literal colors
Common token mistakes:
❌ var(--op_color_primary_base) - Wrong separator (underscore instead of hyphen) ❌ var(--color-primary-base) - Missing --op- prefix ❌ var(--op-primary-color-base) - Wrong segment order
✅ var(--op-color-primary-base) - Correct format
Fix violations by replacing with tokens from assets/tokens.json
Block, Element, Modifier naming:
.block {
} /* Component base */
.block__element {
} /* Part of component */
.block--modifier {
} /* Variant of component */
.block__element--modifier {
} /* Variant of element */
Nest modifiers and elements:
.card {
/* Base styles */
&.card--padded {
/* Modifier */
}
.card__header {
/* Element */
}
}
File organization:
app/assets/stylesheets/components/{component-name}.cssapp/assets/stylesheets/components/overrides/{component-name}.cssapplication.scssComponent structure:
Example - Card component:
.card {
position: relative;
border-radius: var(--op-radius-medium);
background-color: var(--op-color-background);
box-shadow: var(--op-shadow-small);
/* Modifiers */
&.card--padded {
padding: var(--op-space-medium);
}
&.card--elevated {
box-shadow: var(--op-shadow-large);
}
/* Elements */
.card__header {
padding: var(--op-space-medium);
border-bottom: var(--op-border-width) solid var(--op-color-border);
border-start-start-radius: var(--op-radius-medium);
border-start-end-radius: var(--op-radius-medium);
}
.card__body {
padding: var(--op-space-medium);
}
.card__footer {
padding: var(--op-space-medium);
border-top: var(--op-border-width) solid var(--op-color-border);
border-end-start-radius: var(--op-radius-medium);
border-end-end-radius: var(--op-radius-medium);
}
}
Example - Button component:
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: var(--op-space-small) var(--op-space-medium);
font-size: var(--op-font-size-base);
font-weight: var(--op-font-weight-medium);
border-radius: var(--op-radius-small);
border: var(--op-border-width) solid transparent;
cursor: pointer;
transition: all 0.2s ease;
&:hover {
opacity: 0.9;
}
&.btn--large {
padding: var(--op-space-medium) var(--op-space-large);
font-size: var(--op-font-size-large);
}
&.btn--small {
padding: var(--op-space-xsmall) var(--op-space-small);
font-size: var(--op-font-size-small);
}
&.btn--disabled,
&:disabled {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
}
.btn.btn--primary {
background-color: var(--op-color-primary);
color: var(--op-color-on-primary);
&:hover {
background-color: var(--op-color-primary-hover);
}
}
.btn.btn--secondary {
background-color: var(--op-color-secondary);
color: var(--op-color-on-secondary);
&:hover {
background-color: var(--op-color-secondary-hover);
}
}
.btn.btn--outline {
background-color: transparent;
border-color: var(--op-color-border);
color: var(--op-color-text);
&:hover {
background-color: var(--op-color-background-hover);
}
}
First ensure there isn't an existing token that fits your need When tokens are missing, create component-specific ones:
Project-specific tokens (preferred for custom needs):
--{project-prefix}-{category}-{name}--ya-color-brand-accent for "Your App" projectToken categories:
--op-color-{name} or --{prefix}-color-{name}--op-space-{size} or --{prefix}-space-{size}--op-font-{property}-{value}--op-radius-{size}, --op-border-{property}--op-shadow-{size}Discovery workflow:
assets/components.json for existing componentapp/assets/stylesheets for project stylesToken workflow:
assets/tokens.json for appropriate tokenvar(--op-category-name)Component workflow:
components/ or components/overrides/application.scssSee assets/components.json for available Optics components and assets/tokens.json for all design tokens.
testing
Verify what Ruby versions actually exist and install a specific Ruby via rbenv. Use BEFORE asserting that any Ruby version does or doesn't exist (e.g., "Ruby 4.0 isn't out yet", "the latest Ruby is 3.x", "Ruby X.Y.Z doesn't exist"). Also use when the user asks "what's the latest Ruby", "is Ruby X out", "does Ruby X.Y exist", "install Ruby", "switch to Ruby X", "what Ruby is installed", or mentions a specific Ruby version you're unsure about. Claude's training data may be out of date — run `check.sh` first.
development
Trace code through the stack — upward to entry points, downward to data, or laterally across boundaries. Use when the user asks "where does this get called from", "what calls this method", "trace this through the stack", "how does this request flow", "where does this data come from", "follow this through the code", or pastes/selects a piece of code and wants to understand where it fits in the larger system.
tools
Pick the single highest-priority unresolved Sentry issue and hand it off to a fixer skill. Use when triaging Sentry errors, running automated issue triage, or when asked to fix the top Sentry issue in a project.
tools
Find and fix issues from Sentry using MCP. Use when asked to fix Sentry errors, debug production issues, investigate exceptions, or resolve bugs reported in Sentry. Methodically analyzes stack traces, breadcrumbs, traces, and context to identify root causes.