Chakra ui

From oyi77/1ai-skills · View interactive version

Chakra ui is an AI agent skill from the GitHub repository oyi77/1ai-skills. Use when chakra UI React component library — theming, responsive styles, color mode, component composition.

How to use this skill

Skill file

Overview

Chakra UI is a modular, accessible React component library with built-in dark mode, responsive styles, and a flexible theming system. Uses style props for inline styling with theme tokens.

Capabilities

When to Use

Trigger phrases:

When NOT to Use

Pseudo Code

The chakra-ui workflow follows a standard pipeline pattern.

Core flow:

# chakra-ui primary flow
input = prepare(raw_data)
result = process(input, config={chakra, color, component, composition, library})
validate(result)
deliver(result)

Error handling:

on error:
  log(error_details)
  retry_with_backoff(max=3)
  if still_failing: alert_and_escalate()

Core Workflow

# chakra-ui primary flow
input = prepare(raw_data)
result = process(input, config={chakra, color, component, composition, library})
validate(result)
deliver(result)

Error Handling

on error:
  log(error_details)
  retry_with_backoff(max=3)
  if still_failing: alert_and_escalate()

Installation

npm install @chakra-ui/react @emotion/react @emotion/styled framer-motion

Theme Provider

import { ChakraProvider, extendTheme } from "@chakra-ui/react"

const theme = extendTheme({
  colors: {
    brand: { 500: "#3182ce", 600: "#2b6cb0" },
  },
  fonts: { heading: "Inter, sans-serif", body: "Inter, sans-serif" },
})

function App() {
  return <ChakraProvider theme={theme}><YourApp /></ChakraProvider>
}

Responsive Props

import { Box, Stack, Text } from "@chakra-ui/react"

export function Hero() {
  return (
    <Stack direction={["column", "row"]} spacing={8} p={[4, 8, 16]}>
      <Box flex={1}>
        <Text fontSize={["2xl", "3xl", "4xl"]} fontWeight="bold">
          Welcome
        </Text>
      </Box>
    </Stack>
  )
}

Component Composition

import { Button, Icon, Flex } from "@chakra-ui/react"
import { FaRocket } from "react-icons/fa"

export function ActionButton() {
  return (
    <Button colorScheme="blue" size="lg" leftIcon={<Icon as={FaRocket} />}>
      Launch
    </Button>
  )
}

Dark Mode

import { useColorMode, Button, Box } from "@chakra-ui/react"

export function ThemedCard() {
  const { colorMode, toggleColorMode } = useColorMode()
  return (
    <Box bg={colorMode === "light" ? "white" : "gray.800"} p={6} rounded="lg">
      <Button onClick={toggleColorMode}>Toggle {colorMode}</Button>
    </Box>
  )
}

Common Patterns

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

Verification

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. |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.