원클릭으로
stylex
Write StyleX styles correctly — longhand properties, nested pseudo-classes/media queries, no shorthands
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Write StyleX styles correctly — longhand properties, nested pseudo-classes/media queries, no shorthands
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | stylex |
| description | Write StyleX styles correctly — longhand properties, nested pseudo-classes/media queries, no shorthands |
Styles must be created using stylex.create(). Define styles as an object with namespaces containing CSS properties.
import * as stylex from '@stylexjs/stylex';
const styles = stylex.create({
container: {
display: 'flex',
alignItems: 'center',
padding: 16,
},
title: {
fontSize: 24,
fontWeight: 'bold',
color: 'navy',
},
});
CRITICAL RULES:
border, margin, padding (with multiple values), background, flex, overflow DO NOT WORK.null to unset properties.These shorthands DO NOT WORK in StyleX. Always expand them:
// WRONG — border shorthand
border: "1px solid var(--border-primary)",
// CORRECT — longhand properties
borderWidth: 1,
borderStyle: "solid",
borderColor: "var(--border-primary)",
// WRONG — individual side border shorthand
borderLeft: "3px solid red",
// CORRECT
borderLeftWidth: 3,
borderLeftStyle: "solid",
borderLeftColor: "red",
// WRONG — margin/padding multi-value
margin: "8px 16px",
padding: "0.75rem 1.5rem",
// CORRECT
marginTop: "8px",
marginRight: "16px",
marginBottom: "8px",
marginLeft: "16px",
paddingTop: "0.75rem",
paddingRight: "1.5rem",
paddingBottom: "0.75rem",
paddingLeft: "1.5rem",
// WRONG — non-standard shorthands (these silently produce 0px!)
paddingX: "1rem",
paddingY: "2rem",
marginX: "auto",
// CORRECT
paddingLeft: "1rem",
paddingRight: "1rem",
paddingTop: "2rem",
paddingBottom: "2rem",
marginLeft: "auto",
marginRight: "auto",
// WRONG — background shorthand
background: "linear-gradient(to right, red, blue)",
// CORRECT
backgroundImage: "linear-gradient(to right, red, blue)",
// WRONG — flex shorthand
flex: "1 0 auto",
// CORRECT
flexGrow: 1,
flexShrink: 0,
flexBasis: "auto",
// WRONG — overflow shorthand with two values
overflow: "hidden auto",
// CORRECT
overflowX: "hidden",
overflowY: "auto",
// OK — single-value shorthands that DO work:
padding: 16, // single value is fine
margin: 0, // single value is fine
borderRadius: 8, // single value is fine (applies to all corners)
overflow: "hidden", // single value is fine
These work because they set a single value:
padding: 16 (all sides same value)margin: 0 (all sides same value)borderRadius: 8 (all corners same value)overflow: "hidden" (both axes same value)gap: 8 (both row and column gap)Convert StyleX style objects to props using stylex.props():
function Component() {
return (
<div {...stylex.props(styles.container)}>
<h1 {...stylex.props(styles.title)}>Hello</h1>
</div>
);
}
Pass multiple styles to merge them. The last style wins for conflicting properties:
<div {...stylex.props(styles.base, styles.highlighted)} />
<div {...stylex.props([styles.base, styles.highlighted])} />
<div
{...stylex.props(
styles.base,
isActive && styles.active,
isDisabled && styles.disabled,
variant === 'primary' ? styles.primary : styles.secondary,
)}
/>
import type { StyleXStyles } from '@stylexjs/stylex';
type Props = {
children: React.ReactNode;
style?: StyleXStyles;
};
function Card({ children, style }: Props) {
return <div {...stylex.props(styles.card, style)}>{children}</div>;
}
Nest inside property values — NEVER at the top level:
// WRONG — pseudo-class at top level
const styles = stylex.create({
button: {
':hover': {
backgroundColor: 'blue',
},
},
});
// CORRECT — nested inside property value
const styles = stylex.create({
button: {
backgroundColor: {
default: 'lightblue',
':hover': 'blue',
':active': 'darkblue',
':focus-visible': 'royalblue',
':disabled': 'gray',
},
cursor: {
default: 'pointer',
':disabled': 'not-allowed',
},
},
});
Pseudo-elements as top-level keys within a namespace:
const styles = stylex.create({
input: {
color: 'black',
'::placeholder': {
color: 'gray',
},
},
});
Nest inside property values — NEVER at the top level:
// WRONG
const styles = stylex.create({
container: {
'@media (min-width: 768px)': {
padding: 16,
},
},
});
// CORRECT
const styles = stylex.create({
container: {
padding: {
default: 8,
'@media (min-width: 768px)': 16,
},
},
});
The default key is required when using nested conditions.
Use arrow functions for runtime values:
const styles = stylex.create({
bar: (width: number) => ({
width,
}),
positioned: (x: number, y: number) => ({
transform: `translate(${x}px, ${y}px)`,
}),
});
<div {...stylex.props(styles.bar(100))} />
const fadeIn = stylex.keyframes({
from: { opacity: 0 },
to: { opacity: 1 },
});
const styles = stylex.create({
animated: {
animationName: fadeIn,
animationDuration: '0.3s',
animationTimingFunction: 'ease-out',
},
});
Use stylex.defineVars() for themed values, stylex.defineConsts() for static values. Must be in .stylex.ts files with named exports only.
// tokens.stylex.ts
export const colors = stylex.defineVars({
primary: 'blue',
background: 'white',
});
// constants.stylex.ts
export const breakpoints = stylex.defineConsts({
small: '@media (max-width: 600px)',
large: '@media (min-width: 1025px)',
});
border, margin: "8px 16px", padding: "0 1rem", background, flex: "1 0 auto" all fail silentlypaddingX/paddingY/marginX/marginY — these are NOT valid CSS or StyleX properties and produce 0px silentlystylex.create() — use defineVars/defineConsts insteadclassName/style props with stylex.props():focus — use ':focus-visible' for keyboard focus styling (better accessibility)Drive the project's task list unattended — pick the next dependency-unblocked task, dispatch a task-worker subagent to complete it, self-verify the result, then loop. Use when the user wants to work through tasks.md sequentially without supervision (e.g. overnight runs). By default continues past isolated task failures (parks the failed work non-destructively, skips its dependents, keeps going) and trips a circuit breaker only on systemic failure; pass --strict for stop-on-first-failure.
Write end-to-end tests using Playwright. Test user behavior, not implementation details. Also useful for non-test Playwright scripting.
Migrate an npm package from long-lived NPM_TOKEN credentials to OIDC trusted publishing on GitHub Actions, with npm provenance attestations. Use this skill whenever the user mentions migrating to trusted publishing, eliminating NPM_TOKEN, setting up OIDC for npm, adding provenance attestations, publishing from CI without a token, or converting an existing release workflow to use a trusted publisher — even if they describe it in their own words like "get rid of the npm token" or "publish from GitHub Actions securely". Also use it proactively when reviewing a release workflow that still uses `NODE_AUTH_TOKEN`/`NPM_TOKEN` and the user is auditing CI secrets.
Write React components following idiomatic patterns, hooks best practices, and performance optimizations
Write React components designed to be easily tested with Playwright and Testing Library — semantic HTML, clear boundaries, no test-specific hacks
Execute test suites and report results. Runs unit tests (yarn test) and E2E tests (yarn e2e) without modifying code. Use when asked to run tests, check if tests pass, or get a test report.