AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Css

skill-14bryanespinoza-agent-stack-css · by 14BryanEspinoza

Reglas de CSS moderno - layout, responsive, animaciones, container queries, layers, nesting, accesibilidad

No reviews yet
0 installs
23 views
0.0% view→install

Install

$ agentstack add skill-14bryanespinoza-agent-stack-css

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-14bryanespinoza-agent-stack-css)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Css? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

CSS - Reglas y Convenciones


1. Filosofía

  1. Mobile-first — Los estilos se escriben para móvil primero. Pantallas más grandes reciben mejoras progresivas vía media queries, no al revés.
  2. Performance por defecto — Preferir propiedades que solo activan compositing (transform, opacity). Evitar animaciones que causan reflow/repaint (width, height, top). CSS > JS para animaciones.
  3. Mantenibilidad sobre conveniencia — Naming consistente (BEM), custom properties para temas, spacing y colores. Cero magic numbers. El código CSS se lee más veces del que se escribe.
  4. Progressive enhancement — Diseñar para navegadores modernos pero asegurar funcionalidad básica en los antiguos. Las features modernas (:has, container queries, nesting) son mejoras, no requisitos.
  5. Accesibilidad visual — Contraste suficiente, focus visible, respetar prefers-reduced-motion. El estilo nunca debe reducir la usabilidad.

2. Versión Mínima

| Tecnología | Versión | | ---------- | --------------- | | CSS | CSS3+ (moderno) |


3. Mobile-First (Obligatorio)

Escribir estilos para móvil primero, luego escalar con media queries.

/* Base: mobile */
.container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
}

/* Tablet */
@media (min-width: 768px) {
  .container {
    grid-template-columns: repeat(2, 1fr);
    padding: 1.5rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .container {
    grid-template-columns: repeat(3, 1fr);
    padding: 2rem;
  }
}

Breakpoints

| Breakpoint | Ancho mínimo | Uso | | ---------- | ------------ | ---------------- | | sm | 576px | Tablets pequeños | | md | 768px | Tablets | | lg | 992px | Desktops | | xl | 1200px | Desktops grandes | | 2xl | 1400px | Pantallas extra |


4. Layout

Flexbox (una dimensión)

/* Centro horizontal y vertical */
.centered {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Cards en fila */
.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-row > * {
  flex: 1 1 300px;
}

/* Flex propiedades clave */
flex-direction: row | column;
flex-wrap: wrap | nowrap;
flex:   ;
align-items: center | flex-start | flex-end | stretch | baseline;
justify-content: center | space-between | space-around | flex-start | flex-end;
gap:  ;

Grid (dos dimensiones)

/* Grid básico */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

/* Sidebar + contenido */
.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* Áreas nombradas */
.page {
  display: grid;
  grid-template-areas:
    "header header"
    "nav    main"
    "footer footer";
  grid-template-columns: 200px 1fr;
  gap: 1rem;
}

header {
  grid-area: header;
}
nav {
  grid-area: nav;
}
main {
  grid-area: main;
}
footer {
  grid-area: footer;
}

/* Subgrid (heredar tracks del grid padre) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.card {
  display: grid;
  grid-template-rows: subgrid; /* Hereda filas del padre */
  grid-row: span 3; /* Ocupa 3 filas del padre */
}

/* Propiedades Grid clave */
grid-template-columns: repeat(3, 1fr) | 200px 1fr | auto-fill minmax(250px, 1fr);
grid-template-rows: auto 1fr auto;
grid-column: 1 / -1; /* De inicio a fin */
grid-row: span 2; /* Ocupa 2 filas */
gap: 1rem;
justify-items: center | stretch;
align-items: center | stretch;
place-items: center; /* shorthand justify + align */

5. Naming Conventions

BEM (Block Element Modifier)

/* Block - componente independiente */
.card {
}

/* Element - parte del block (__) */
.card__title {
}
.card__body {
}
.card__footer {
}

/* Modifier - variación (--) */
.card--featured {
}
.card--dark {
}
.card__title--large {
}

Ejemplo completo


  Título
  Contenido del card
  
    Acción
  
.card {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  background: var(--color-bg);
}

.card--featured {
  border-color: var(--color-primary);
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card__title--large {
  font-size: 1.5rem;
}

.card__body {
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.card__button--primary {
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
}

Alternativa: utility-first

Para proyectos sin Tailwind:

/* Spacing */
.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.p-4 {
  padding: 1rem;
}
.p-6 {
  padding: 1.5rem;
}
.mx-auto {
  margin-inline: auto;
}

/* Flex */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.flex-wrap {
  flex-wrap: wrap;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-4 {
  gap: 1rem;
}

/* Grid */
.grid {
  display: grid;
}
.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Text */
.text-center {
  text-align: center;
}
.text-sm {
  font-size: 0.875rem;
}
.text-lg {
  font-size: 1.125rem;
}
.font-bold {
  font-weight: 700;
}
.text-gray-500 {
  color: #6b7280;
}

/* Display */
.block {
  display: block;
}
.hidden {
  display: none;
}
@media (min-width: 768px) {
  .md\:block {
    display: block;
  }
  .md\:hidden {
    display: none;
  }
}

6. Custom Properties (Variables CSS)

:root {
  /* Colores */
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #eef2ff;
  --color-secondary: #818cf8;
  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;

  --color-text: #111827;
  --color-text-secondary: #6b7280;
  --color-bg: #ffffff;
  --color-bg-secondary: #f9fafb;
  --color-border: #e5e7eb;

  /* Tipografía */
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* Tamaños */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Border */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-modal: 200;
  --z-toast: 300;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --color-text: #f9fafb;
    --color-text-secondary: #9ca3af;
    --color-bg: #111827;
    --color-bg-secondary: #1f2937;
    --color-border: #374151;
  }
}

/* Uso */
.button {
  background-color: var(--color-primary);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  transition: background-color var(--transition-fast);
}

.button:hover {
  background-color: var(--color-primary-hover);
}

Tematización con data attributes

[data-theme="dark"] {
  --color-bg: #111827;
  --color-text: #f9fafb;
}

[data-theme="high-contrast"] {
  --color-primary: #0000ff;
  --color-text: #000000;
  --color-bg: #ffffff;
}

@property — Variables Tipadas

@property --hue {
  syntax: "";
  inherits: false;
  initial-value: 0deg;
}

.color-wheel {
  background: hsl(var(--hue), 80%, 50%);
  transition: --hue 0.3s;
}

@property --spacing {
  syntax: "";
  inherits: true;
  initial-value: 0px;
}

7. CSS Nesting (nativo)

/* Sin nesting */
.card {
}
.card__title {
}
.card__title--large {
}

/* Con nesting (CSS nativo, soportado en 2025+) */
.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);

  &__title {
    /* .card__title */
    font-size: var(--text-lg);
    font-weight: 600;

    &--large {
      /* .card__title--large */
      font-size: var(--text-xl);
    }
  }

  &__body {
    color: var(--color-text-secondary);
  }

  &:hover {
    box-shadow: var(--shadow-md);
  }

  @media (min-width: 768px) {
    padding: var(--space-6);
  }
}

8. Cascade Layers (@layer)

/* Definir orden de capas */
@layer reset, base, components, utilities;

/* Reset layer */
@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
}

/* Base layer */
@layer base {
  body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
  }

  h1,
  h2,
  h3 {
    line-height: 1.2;
    font-weight: 700;
  }
}

/* Components layer */
@layer components {
  .card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
  }
}

/* Utilities layer (mayor prioridad) */
@layer utilities {
  .text-center {
    text-align: center;
  }
  .mt-4 {
    margin-top: var(--space-4);
  }
}

/* Importar dentro de capa */
@import url("reset.css") layer(reset);

Orden de prioridad: utilities > components > base > reset

Minimal Reset

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  line-height: 1.5;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

9. Container Queries

/* Definir container */
.card-container {
  container-type: inline-size;
  container-name: card;
}

/* Query */
@container card (min-width: 400px) {
  .card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
  }

  .card__title {
    font-size: var(--text-xl);
  }
}

@container card (max-width: 399px) {
  .card {
    display: flex;
    flex-direction: column;
  }

  .card__image {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
}

/* Container shorthand */
.container {
  container: card / inline-size;
}

/* Container style queries */
@container card style(--featured: true) {
  .card {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
  }
}

10. Selectores Modernos

:has() (CSS Parent Selector)

/* Card que contiene una imagen */
.card:has(img) {
  grid-template-rows: auto 1fr;
}

/* Formulario con error */
.form-group:has(:invalid) {
  border-color: var(--color-danger);
}

.form-group:has(:focus) {
  border-color: var(--color-primary);
}

/* Navbar con menú abierto */
.navbar:has(.menu--open) {
  background: var(--color-bg-secondary);
}

/* Tabla con selección */
tr:has(input:checked) {
  background: var(--color-primary-light);
}

/* Hermano siguiente de un elemento con clase */
.card.featured + .card:not(.featured) {
  opacity: 0.8;
}

Otros selectores útiles

/* :where() - especificidad cero */
:where(.card, .panel, .box) {
} /* (0,0,0) */

/* :is() - especificidad del más específico */
:is(.card, #header, .panel) {
} /* (1,0,0) por #header */

/* :not() */
.button:not(.button--primary) {
}
.card:not(:has(img)) {
}

/* :focus-visible (solo foco teclado) */
.button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* :focus-within (container con focus) */
.form-group:focus-within {
  border-color: var(--color-primary);
}

/* :target (elemento con #hash en URL) */
#section:target {
  animation: highlight 2s ease;
}

/* :placeholder-shown */
input:placeholder-shown {
  border-color: var(--color-border);
}

/* :empty */
.card:empty {
  display: none;
}

11. Funciones CSS Modernas

/* clamp() - valor fluido entre min y max */
font-size: clamp(1rem, 0.75rem + 0.5vw, 1.125rem);
padding: clamp(1rem, 3vw, 3rem);
width: clamp(300px, 50%, 800px);

/* min() / max() */
width: min(100%, 1200px); /* responsive + max-width */
padding: max(1rem, 2vw); /* padding mínimo */
grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));

/* calc() */
width: calc(100% - 2rem);
height: calc(100vh - var(--header-height));
font-size: calc(1rem + 0.5vw);

/* abs() - CSS Values 5 */
margin: abs(-10px); /* 10px */

/* round() - redondear a unidad */
width: round(50.7px, 5px); /* 50px */

12. @supports Feature Queries

Detectar soporte del navegador antes de usar propiedades modernas.

/* Grid support */
@supports (display: grid) {
  .layout {
    display: grid;
  }
}

/* Container queries support */
@supports (container-type: inline-size) {
  .card {
    container-type: inline-size;
  }
}

/* Nesting support */
@supports (selector(&)) {
  .card {
    & .title {
    }
  }
}

Combinaciones Lógicas

/* AND */
@supports (display: grid) and (container-type: inline-size) {
}

/* OR */
@supports (display: grid) or (display: flex) {
}

/* NOT */
@supports not (display: grid) {
}

13. Tipografía

Sistema tipográfico

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1 {
  font-size: clamp(1.75rem, 1rem + 2vw, 2.5rem);
  line-height: 1.2;
}
h2 {
  font-size: clamp(1.5rem, 1rem + 1.5vw, 2rem);
  line-height: 1.25;
}
h3 {
  font-size: clamp(1.25rem, 1rem + 0.5vw, 1.5rem);
  line-height: 1.3;
}

p {
  max-width: 70ch;
} /* Legibilidad óptima */

@font-face

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter.woff2") format("woff2");
  font-weight: 400 700; /* Variable font range */
  font-display: swap; /* FOIT evita invisible */
  font-style: normal;
  unicode-range: U+0000-00FF; /* Latin básico */
}

/* Variable fonts */
body {
  font-variation-settings:
    "wght" 400,
    "wdth" 100;
}

h1 {
  font-variation-settings:
    "wght" 700,
    "wdth" 85;
}

14. Animaciones y Transiciones

Transiciones

.button {
  background-color: var(--color-primary);
  transition:
    background-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.button:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

Animaciones @keyframes

.fade-in {
  animation: fadeIn 300ms ease-out both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-up {
  animation: slideUp 300ms ease-out both;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animaciones más complejas */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes skeleton {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.spinner {
  animation: spin 1s linear infinite;
}

.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
}

Propiedades de animación

.elemen

…

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [14BryanEspinoza](https://github.com/14BryanEspinoza)
- **Source:** [14BryanEspinoza/agent-stack](https://github.com/14BryanEspinoza/agent-stack)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.