agentleFS
PackmindHubPackmindHub/packmind/.claude/skills/working-with-pm-design-kit/SKILL.md

working-with-pm-design-kit

Skill321 starsChanged 54 days agoApache-2.0View on GitHub

This skill provides guidance for using the Packmind UI component library (@packmind/ui). It should be used when building or modifying frontend UI with PM-prefixed components, working with Chakra UI in the Packmind codebase, or when questions arise about available components, theming, or layout patterns. Triggers on mentions of PM components, @packmind/ui, Chakra UI usage, design kit, or frontend component implementation.

The file

Show its rules and text

We split this skill into the rules it gives an agent

25 rules. About 0 are common, 4 are distinctive, and 21 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 21

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Import pattern: Always import from @packmind/ui, never from Chakra UI directly.

    line 12
  2. Very specific:

    Before reaching for a raw <div> or Chakra primitive, check if a PM component exists.

    line 20
  3. Very specific:

    Need a layout container?: Use PMBox, PMVStack, PMHStack, PMFlex, or PMGrid.

    line 24
  4. Very specific:

    Need text?: Use PMHeading (with level prop for semantic h1–h6) or PMText (with variant and color).

    line 25
  5. Very specific:

    Need a button?: Use PMButton with the appropriate variant: primary for main actions, secondary/ghost for secondary, danger for destructive.

    line 26
  6. Very specific:

    Need user input?: Use PMInput, PMTextArea, PMSelect, PMCheckbox, PMSwitch, or PMRadioGroup.

    line 27
  7. Very specific:

    Need feedback?: Use pmToaster for transient messages, PMAlert for inline messages, PMConfirmationModal for destructive confirmations.

    line 28
  8. Very specific:

    Need an overlay?: Use PMDialog for modals, PMPopover for contextual info, PMDrawer for side panels.

    line 29
  9. Very specific:

    Need to show nothing?: Use PMEmptyState with title, description, icon, and an action button.

    line 30
  10. Very specific:

    Need loading placeholders?: Use PMSkeleton for content areas, PMSpinner for inline indicators.

    line 31
  11. Very specific:

    Need a color indicator?: Use PMColorSwatch to display a color sample.

    line 32
  12. Distinctive:

    No PM wrapper exists?: Check Chakra UI v3 docs, then ask the user before using a raw Chakra component.

    line 33
  13. Very specific:

    Always wrap overlays (dialogs, popovers, drawers) inside PMPortal to escape stacking context issues.

    line 89
  14. Very specific:

    Use gap on stacks/grids for consistent spacing between children — never use margin on individual children to create gaps.

    line 95
  15. Very specific:

    Use PMGrid with gridTemplateColumns for multi-panel layouts:

    line 110
  16. Very specific:

    Use PMPage for full-page layouts with title, breadcrumbs, actions, and optional sidebar.

    line 122
  17. Very specific:

    Use PMHeading with the level prop for semantic HTML (h1–h6) and color for emphasis:

    line 128
  18. Very specific:

    Use PMText with variant for size and color for emphasis:

    line 139
  19. Distinctive:

    Use semantic tokens — never hardcode hex colors or raw Chakra palette values.

    line 151
  20. Distinctive:

    Use the semantic color names for status indicators:

    line 163
  21. Very specific:

    Use Chakra's responsive object syntax with breakpoints base, sm, md, lg, xl:

    line 275
  22. Very specific:

    Do not: import from @chakra-ui/react directly — always use @packmind/ui wrappers.

    line 331
  23. Distinctive:

    Do not: use inline styles or hardcoded colors — use semantic tokens and component props.

    line 332
  24. Very specific:

    Do not: create custom modal/overlay implementations — use PMDialog, PMDrawer, or PMPopover with PMPortal.

    line 333
  25. Very specific:

    Do not: use as="h1" on headings — use the level prop on PMHeading for semantic HTML.

    line 335

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Working With the PM Design Kit

Overview

The Packmind design kit (@packmind/ui) is a component library built on top of Chakra UI v3. All components are prefixed with PM and provide a consistent, themed API across the application. The source lives in packages/ui/.

Import pattern: Always import from @packmind/ui, never from Chakra UI directly.

import { PMButton, PMBox, PMHeading, PMText } from '@packmind/ui';

Component Selection Guide

Before reaching for a raw <div> or Chakra primitive, check if a PM component exists. Consult references/component-catalog.md for the full inventory organized by category.

Decision Flow

  1. Need a layout container? Use PMBox, PMVStack, PMHStack, PMFlex, or PMGrid.
  2. Need text? Use PMHeading (with level prop for semantic h1–h6) or PMText (with variant and color).
  3. Need a button? Use PMButton with the appropriate variant: primary for main actions, secondary/ghost for secondary, danger for destructive.
  4. Need user input? Use PMInput, PMTextArea, PMSelect, PMCheckbox, PMSwitch, or PMRadioGroup.
  5. Need feedback? Use pmToaster for transient messages, PMAlert for inline messages, PMConfirmationModal for destructive confirmations.
  6. Need an overlay? Use PMDialog for modals, PMPopover for contextual info, PMDrawer for side panels.
  7. Need to show nothing? Use PMEmptyState with title, description, icon, and an action button.
  8. Need loading placeholders? Use PMSkeleton for content areas, PMSpinner for inline indicators.
  9. Need a color indicator? Use PMColorSwatch to display a color sample.
  10. No PM wrapper exists? Check Chakra UI v3 docs, then ask the user before using a raw Chakra component.

Compound Component Patterns

Several PM components use Chakra's compound pattern with dot notation. Always use the compound API — do not try to reconstruct these with standalone elements.

// Dialog
<PMDialog.Root open={isOpen} onOpenChange={setIsOpen}>
  <PMDialog.Backdrop />
  <PMDialog.Positioner>
    <PMDialog.Content>
      <PMDialog.Header>
        <PMDialog.Title>Title</PMDialog.Title>
        <PMDialog.CloseTrigger />
      </PMDialog.Header>
      {/* body */}
    </PMDialog.Content>
  </PMDialog.Positioner>
</PMDialog.Root>

// Accordion
<PMAccordion.Root>
  <PMAccordion.Item value="section-1">
    <PMAccordion.ItemTrigger>Section 1</PMAccordion.ItemTrigger>
    <PMAccordion.ItemContent>Content here</PMAccordion.ItemContent>
  </PMAccordion.Item>
</PMAccordion.Root>

// Timeline
<PMTimeline.Root>
  <PMTimeline.Item>
    <PMTimeline.Separator>
      <PMTimeline.Indicator />
      <PMTimeline.Connector />
    </PMTimeline.Separator>
    <PMTimeline.Content>
      <PMTimeline.Title>Event</PMTimeline.Title>
      <PMTimeline.Description>Details</PMTimeline.Description>
    </PMTimeline.Content>
  </PMTimeline.Item>
</PMTimeline.Root>

// Tabs (compound pattern — preferred for flexible tab layouts)
<PMTabsCompound.Root defaultValue="tab1">
  <PMTabsCompound.List>
    <PMTabsCompound.Trigger value="tab1">First Tab</PMTabsCompound.Trigger>
    <PMTabsCompound.Trigger value="tab2">Second Tab</PMTabsCompound.Trigger>
  </PMTabsCompound.List>
  <PMTabsCompound.Content value="tab1">First content</PMTabsCompound.Content>
  <PMTabsCompound.Content value="tab2">Second content</PMTabsCompound.Content>
</PMTabsCompound.Root>

Key compound components: PMDialog, PMAccordion, PMTimeline, PMCarousel, PMCopiable, PMSelect, PMMenu, PMTreeView, PMTabs, PMTabsCompound.

Always wrap overlays (dialogs, popovers, drawers) inside PMPortal to escape stacking context issues.

Layout Patterns

Spacing

Use gap on stacks/grids for consistent spacing between children — never use margin on individual children to create gaps.

<PMVStack gap="4">
  <PMHeading level="h2">Title</PMHeading>
  <PMText>Description</PMText>
</PMVStack>

Full-Height Layouts

For layouts that fill the viewport, use height="100vh" on the root, flex="1" on the expanding section, and minHeight={0} on flex children that need to scroll.

Grid Layouts

Use PMGrid with gridTemplateColumns for multi-panel layouts:

<PMGrid gridTemplateColumns="minmax(240px, 270px) 1fr minmax(280px, 320px)">
  <PMBox>Sidebar</PMBox>
  <PMBox>Main</PMBox>
  <PMBox>Detail</PMBox>
</PMGrid>

Page Structure

Use PMPage for full-page layouts with title, breadcrumbs, actions, and optional sidebar. Use PMPageSection for collapsible content sections within a page.

Typography

Headings

Use PMHeading with the level prop for semantic HTML (h1–h6) and color for emphasis:

<PMHeading level="h1" color="primary">Page Title</PMHeading>
<PMHeading level="h3" color="secondary">Section Title</PMHeading>

Available colors: primary, secondary, tertiary, faded, primaryLight, secondaryLight, tertiaryLight.

Body Text

Use PMText with variant for size and color for emphasis:

<PMText variant="body" color="primary">Main content</PMText>
<PMText variant="small" color="secondary">Supporting text</PMText>

Variants: body, body-important, small, small-important. Colors: primary, secondary, tertiary, error, faded, warning, success, primaryLight, secondaryLight, tertiaryLight.

Theming

Use semantic tokens — never hardcode hex colors or raw Chakra palette values.

Semantic Token Categories

CategoryTokensUsage
Backgroundbackground.primary, .secondary, .tertiary, .fadedSurface colors (dark to light)
Texttext.primary, .secondary, .tertiary, .faded, .error, .warning, .successText contrast levels
Borderborder.primary, .secondary, .tertiaryBorder contrast levels

Status Colors

Use the semantic color names for status indicators:

  • Success: green palette or text.success
  • Error/Danger: red palette or text.error
  • Warning: orange palette or text.warning
  • Info/Primary: blue palette
<PMButton variant="danger">Delete</PMButton>
<PMText color="error">Validation failed</PMText>
<PMBadge colorPalette="green">Active</PMBadge>

Form Patterns

Input Fields

PMInput provides label, error state, and helper text out of the box:

<PMInput
  label="Project name"
  value={name}
  onChange={(e) => setName(e.target.value)}
  error={errors.name}
  helperText="Must be unique within the organization"
  maxLength={255}
/>

Form Layout

Group related fields with PMFormContainer:

<PMFormContainer maxWidth="400px" centered>
  <PMInput label="Name" />
  <PMInput label="Email" />
  <PMButton variant="primary" type="submit">Save</PMButton>
</PMFormContainer>

Validation

Show errors directly on inputs via the error prop — this adds a red border and displays the message below the field. Disable submit buttons during async operations with isLoading.

Feedback Patterns

Toasts (Transient Notifications)

import { pmToaster } from '@packmind/ui';

pmToaster.create({
  type: 'success',        // 'success' | 'error' | 'warning' | 'info' | 'loading'
  title: 'Saved',
  description: 'Your changes have been saved.',
  closable: true,
  action: { label: 'Undo', onClick: handleUndo },  // optional
});

Confirmation Modals (Destructive Actions)

<PMConfirmationModal
  trigger={<PMButton variant="danger">Delete</PMButton>}
  title="Delete project?"
  message="This action cannot be undone."
  confirmText="Delete"
  confirmColorScheme="red"
  onConfirm={handleDelete}
  isLoading={isDeleting}
/>

Inline Alerts

<PMAlert.Root status="warning">
  <PMAlert.Indicator />
  <PMAlert.Title>Attention</PMAlert.Title>
  <PMAlert.Description>This feature is in beta.</PMAlert.Description>
</PMAlert.Root>

Empty States

<PMEmptyState
  title="No standards yet"
  description="Create your first coding standard to get started."
  icon={<LuInbox />}
>
  <PMButton variant="primary">Create Standard</PMButton>
</PMEmptyState>

Icons

Icons come from react-icons/lu (Lucide icon set). Import with the Lu prefix:

import { LuTrash2, LuPlus, LuChevronDown } from 'react-icons/lu';

<PMButton><LuPlus /> Add Item</PMButton>
<PMIconButton variant="ghost"><LuTrash2 /></PMIconButton>

Control size via fontSize or size props on the icon element.

Responsive Design

Use Chakra's responsive object syntax with breakpoints base, sm, md, lg, xl:

<PMBox
  display={{ base: 'none', md: 'flex' }}
  width={{ base: '100%', lg: '60%' }}
  padding={{ base: '4', md: '6' }}
/>

Mobile-first approach: base styles apply to all sizes, then override at larger breakpoints.

Button Variant Guide

VariantUsage
primaryMain action on the page (one per view)
secondaryImportant but not primary actions
tertiaryLow-emphasis actions
outlineAlternative to secondary with border emphasis
ghostMinimal actions (toolbar buttons, inline actions)
successPositive confirmations
warningCaution-required actions
dangerDestructive actions (delete, remove)

Hooks

@packmind/ui exports several hooks for common UI patterns:

useTableSort

Manages sorting state for PMTable. Returns sortKey, sortDirection, handleSort, and getSortDirection:

import { useTableSort } from '@packmind/ui';

const { sortKey, sortDirection, handleSort, getSortDirection } = useTableSort({
  defaultSortKey: 'name',
  defaultSortDirection: 'asc',
});

<PMTable columns={columns} data={data} onSort={handleSort} />

Chakra Re-exports

  • pmUseFilter — Chakra's useFilter for filtering collections
  • pmUseListCollection — Chakra's useListCollection for managing list data (useful with PMSelect, PMCombobox)
  • pmUseToken — Chakra's useToken for accessing design tokens programmatically
import { pmUseToken, pmUseListCollection } from '@packmind/ui';

Anti-Patterns

  • Do not import from @chakra-ui/react directly — always use @packmind/ui wrappers.
  • Do not use inline styles or hardcoded colors — use semantic tokens and component props.
  • Do not create custom modal/overlay implementations — use PMDialog, PMDrawer, or PMPopover with PMPortal.
  • Do not build custom loading indicators — use PMSkeleton or PMSpinner.
  • Do not use as="h1" on headings — use the level prop on PMHeading for semantic HTML.

Resources

references/

  • component-catalog.md — Full inventory of all PM components and hooks with props, organized by category.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.