Master Flexbox and CSS Grid layouts for modern responsive design
Provides guidance on CSS Flexbox and Grid layouts for building responsive interfaces. Use when users need help with 1D/2D layout patterns, centering elements, or creating card grids and sidebar layouts.
/plugin marketplace add pluginagentmarketplace/custom-plugin-css/plugin install css-assistant@pluginagentmarketplace-cssThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyMaster modern CSS layout systems: Flexbox for 1D layouts and CSS Grid for 2D layouts.
This skill provides atomic, focused guidance on CSS layout techniques with comprehensive parameter validation and practical examples.
| Property | Value |
|---|---|
| Category | Layout |
| Complexity | Intermediate to Advanced |
| Dependencies | css-fundamentals |
| Bonded Agent | 02-css-layout-master |
Skill("css-flexbox-grid")
parameters:
layout_type:
type: string
required: true
enum: [flexbox, grid, comparison, responsive]
description: Layout system to explore
pattern:
type: string
required: false
enum: [centering, sidebar, card-grid, holy-grail, navbar, gallery]
description: Common layout pattern
include_responsive:
type: boolean
required: false
default: true
description: Include responsive adaptations
validation:
- rule: layout_type_required
message: "layout_type parameter is required"
- rule: valid_pattern
message: "pattern must be a recognized layout pattern"
retry_config:
max_attempts: 3
backoff_type: exponential
initial_delay_ms: 1000
max_delay_ms: 10000
retryable_errors:
- TIMEOUT
- RATE_LIMIT
logging:
entry_point: skill_invoked
exit_point: skill_completed
log_parameters: true
metrics:
- invocation_count
- pattern_usage
- layout_type_distribution
.container {
display: flex;
flex-direction: row; /* row | column | row-reverse | column-reverse */
flex-wrap: wrap; /* nowrap | wrap | wrap-reverse */
justify-content: center; /* flex-start | flex-end | center | space-between | space-around | space-evenly */
align-items: center; /* flex-start | flex-end | center | stretch | baseline */
gap: 1rem;
}
.item {
flex: 1 1 auto; /* grow shrink basis */
align-self: flex-start;
order: 0;
}
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: auto 1fr auto;
grid-template-areas:
"header header header"
"sidebar main aside"
"footer footer footer";
gap: 1rem;
}
.item {
grid-column: 1 / 3; /* start / end */
grid-row: span 2;
grid-area: header;
}
Need 2D control?
├─ YES → CSS Grid
└─ NO
├─ Content determines size? → Flexbox
├─ Equal sizing needed? → Grid
└─ Simple row/column → Flexbox
/* Flexbox centering */
.flex-center {
display: flex;
justify-content: center;
align-items: center;
}
/* Grid centering */
.grid-center {
display: grid;
place-items: center;
}
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1.5rem;
}
.sidebar-layout {
display: grid;
grid-template-columns: minmax(200px, 25%) 1fr;
min-height: 100vh;
}
@media (max-width: 768px) {
.sidebar-layout {
grid-template-columns: 1fr;
}
}
describe('CSS Flexbox Grid Skill', () => {
test('validates layout_type parameter', () => {
expect(() => skill({ layout_type: 'invalid' }))
.toThrow('layout_type must be one of: flexbox, grid...');
});
test('returns flexbox properties for flexbox type', () => {
const result = skill({ layout_type: 'flexbox' });
expect(result).toContain('display: flex');
expect(result).toContain('justify-content');
});
test('includes responsive code when flag is true', () => {
const result = skill({
layout_type: 'grid',
pattern: 'card-grid',
include_responsive: true
});
expect(result).toContain('@media');
});
});
| Error Code | Cause | Recovery |
|---|---|---|
| INVALID_LAYOUT_TYPE | Unknown layout type | Show valid options |
| INCOMPATIBLE_PATTERN | Pattern doesn't fit layout type | Suggest alternative |
| MISSING_DEPENDENCY | Fundamentals not understood | Link to css-fundamentals |
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.