Use when styled-components CSS-in-JS — tagged templates, theming, props,
Scanned 9/8/2026
Install to Claude Code
npx -y skills add oyi77/1ai-skills --skill styled-components --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Styled Components?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/oyi77-styled-components)More formats (shields.io, HTML) on the badges page.
---
name: styled-components
description: Use when styled-components CSS-in-JS — tagged templates, theming, props,
animations, SSR, performance. Use when working with styled components.
domain: content
author: oyi77
license: Apache-2.0
subdomain: content-creation
tags:
- components
- content-creation
- digital-content
- media
- styled
version: 1.0.0
category: content
---
## Overview
styled-components enables CSS-in-JS with tagged template literals. Components are styled directly in JavaScript with access to props, themes, and dynamic values. Supports SSR and tree-shaking.
## Capabilities
- Tagged template literal syntax for styling
- Dynamic styles via props
- ThemeProvider for global theming
- Server-side rendering with ServerStyleSheet
- Keyframe animations
- Extending and composing components
- Transient props ($prefix) to avoid DOM forwarding
## When to Use
**Trigger phrases:**
- "styled components"
- "styled-components CSS-in-JS — tagged templates, theming, props, animations, SSR,"
- React projects needing scoped, dynamic CSS
- Component libraries with prop-driven styles
- Server-side rendered React apps (Next.js)
- Theming with runtime color/mode switching
## When NOT to Use
- Task is about content strategy, not creation (use strategy skills)
- Task is about content distribution (use distribution skills)
- You need to analyze content performance (use analytics skills)
- Task is about content moderation (use moderation tools)
- You don't have content guidelines
- Task requires domain expertise (consult experts)
## Pseudo Code
The styled-components workflow follows a standard pipeline pattern.
Core flow:
```
# styled-components primary flow
input = prepare(raw_data)
result = process(input, config={animations, components, performance, props, styled})
validate(result)
deliver(result)
```
Error handling:
```
on error:
log(error_details)
retry_with_backoff(max=3)
if still_failing: alert_and_escalate()
```
### Core Workflow
```
# styled-components primary flow
input = prepare(raw_data)
result = process(input, config={animations, components, performance, props, styled})
validate(result)
deliver(result)
```
### Error Handling
```
on error:
log(error_details)
retry_with_backoff(max=3)
if still_failing: alert_and_escalate()
```
### Basic Usage
```tsx
import styled from "styled-components"
const Button = styled.button`
background: ${(props) => props.$primary ? "#3b82f6" : "#e5e7eb"};
color: ${(props) => props.$primary ? "white" : "#374151"};
padding: 8px 16px;
border-radius: 6px;
border: none;
cursor: pointer;
&:hover { opacity: 0.9; }
`
// Usage: <Button $primary>Click</Button>
```
### Theme Provider
```tsx
import { ThemeProvider } from "styled-components"
const theme = {
colors: {
primary: "#3b82f6",
background: "#ffffff",
text: "#1f2937",
},
spacing: { sm: "8px", md: "16px", lg: "24px" },
}
function App() {
return (
<ThemeProvider theme={theme}>
<MyApp />
</ThemeProvider>
)
}
```
### Theme Access
```tsx
const Card = styled.div`
background: ${({ theme }) => theme.colors.background};
padding: ${({ theme }) => theme.spacing.md};
color: ${({ theme }) => theme.colors.text};
`
```
### Extending Components
```tsx
const PrimaryButton = styled(Button)`
background: #3b82f6;
color: white;
font-weight: 600;
`
```
### Keyframes
```tsx
import { keyframes } from "styled-components"
const fadeIn = keyframes`
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
`
const AnimatedDiv = styled.div`
animation: ${fadeIn} 0.3s ease-out;
`
```
## Common Patterns
- **Transient props**: Use `$` prefix (`$primary`, `$size`) to prevent DOM forwarding
- **attrs**: `styled.input.attrs({ type: "text" })` for default attributes
- **Global styles**: `createGlobalStyle` for CSS reset and global rules
- **Composition**: `const StyledLink = styled(Link)` for React Router links
- **Performance**: Use `.attrs()` for static values, memoize expensive computations
## How to Use
1. Define content goal (traffic, engagement, conversion, brand awareness)
2. Research target audience pain points and search intent
3. Generate content using appropriate AI tools
4. Edit and humanize output for authenticity
5. Optimize for target platform (SEO, hashtags, format)
6. Schedule and distribute across channels
7. Measure performance and iterate
## Red Flags
- **AI-generated content sounds robotic**: Always run through humanizer before publishing
- **Engagement dropping week-over-week**: Content fatigue or algorithm change — vary formats
- **Duplicate content across platforms**: Adapt content per platform, don't just cross-post
- **No content calendar**: Sporadic posting kills audience retention
- **Ignoring analytics**: Content without measurement is just publishing, not marketing
## Verification
- [ ] Skill output matches expected behavior
## Process
1. Analyze the task requirements
2. Apply domain expertise
3. Verify output quality
## Anti-Rationalization Table
| Rationalization | Reality |
|---|---|
| "Good enough content works" | Quality content drives engagement. Mediocre content gets ignored. |
| "I will optimize later" | SEO and distribution need optimization from the start. |
| "Templates are good enough" | Templates are a starting point. Custom content outperforms generic. |Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!