home / skills / autumnsgrove / groveengine / update-ui-inventory

update-ui-inventory skill

/.claude/skills/update-ui-inventory

This skill updates the UI component inventory and documentation to reflect added or removed components and ensure alignment with code.

npx playbooks add skill autumnsgrove/groveengine --skill update-ui-inventory

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
5.5 KB
---
name: update-ui-inventory
description: Update the UI component inventory and documentation when components are added or removed. Use when adding new components, after code reviews flag inventory mismatches, or periodically to ensure docs match reality.
---

# Update UI Inventory Skill

## When to Activate

Activate this skill when:
- Adding new UI components to the engine
- Removing or deprecating components
- The component-inventory CI check fails
- You want to verify docs match the actual component count
- After merging PRs that add/remove components

## Files Involved

| File | Purpose |
|------|---------|
| `.github/component-inventory.json` | Source of truth for component counts |
| `docs/design-system/COMPONENT-REFERENCE.md` | User-facing component documentation |
| `packages/engine/src/lib/ui/components/` | Actual component source files |

## Inventory Structure

The inventory tracks 13 component categories:

```json
{
  "components": {
    "total": 186,
    "breakdown": {
      "primitives": 45,
      "nature": 64,
      "ui": 29,
      "typography": 11,
      "chrome": 6,
      "terrarium": 7,
      "gallery": 4,
      "charts": 4,
      "content": 4,
      "states": 4,
      "forms": 3,
      "indicators": 3,
      "icons": 2
    }
  }
}
```

## Step-by-Step Process

### 1. Count Components in Each Category

Run these commands to get actual counts:

```bash
# Count .svelte files in each category
for dir in primitives nature ui typography chrome terrarium gallery charts content states forms indicators icons; do
  count=$(find packages/engine/src/lib/ui/components/$dir -name "*.svelte" 2>/dev/null | wc -l | tr -d ' ')
  echo "$dir: $count"
done
```

### 2. Compare with Inventory

Read the current inventory and compare:

```bash
cat .github/component-inventory.json
```

### 3. Identify Discrepancies

Look for:
- **New components**: Files exist but aren't in the count
- **Removed components**: Count includes files that no longer exist
- **Moved components**: Component relocated to different category

### 4. Update Inventory JSON

Edit `.github/component-inventory.json`:

```json
{
  "lastUpdated": "YYYY-MM-DD",
  "lastAuditedBy": "claude/<context>",
  "components": {
    "total": <sum of all categories>,
    "breakdown": {
      "<category>": <new count>,
      ...
    }
  }
}
```

### 5. Update Component Reference

Edit `docs/design-system/COMPONENT-REFERENCE.md`:

1. **Update the intro line**:
   ```markdown
   > 186 components organized by category...
   ```

2. **Update Quick Links** (the anchor links include counts):
   ```markdown
   - [ui/ - Core UI Components](#ui---core-ui-components-29)
   ```

3. **Update section headers**:
   ```markdown
   ## ui/ - Core UI Components (29)
   ```

4. **Add new component to relevant table** (if significant):
   For Glass components, add to "Other Glass Components" table:
   ```markdown
   | `GlassNewComponent` | Description of what it does |
   ```

5. **Update the last updated date** at the bottom:
   ```markdown
   *Last updated: YYYY-MM-DD*
   ```

### 6. Commit Changes

```bash
git add .github/component-inventory.json docs/design-system/COMPONENT-REFERENCE.md
git commit -m "docs: update component inventory

- Update <category> count: X -> Y
- Add <ComponentName> to COMPONENT-REFERENCE.md
- Bump total: A -> B"
```

## Quick Reference: Counting Commands

```bash
# Single category count
find packages/engine/src/lib/ui/components/ui -name "*.svelte" | wc -l

# List all files in a category (to identify new ones)
ls packages/engine/src/lib/ui/components/ui/*.svelte

# Find Glass components specifically
ls packages/engine/src/lib/ui/components/ui/ | grep -i glass

# Total across all categories
find packages/engine/src/lib/ui/components -name "*.svelte" | wc -l
```

## Documentation Guidelines

When adding components to COMPONENT-REFERENCE.md:

### Glass Components (Always Document)
Glass components define Grove's visual language - always add them to the "Other Glass Components" table with a clear description.

### Standard Components
Add to the "Standard Components" table if it's a general-purpose wrapper.

### Specialized Components
For category-specific components (nature, charts, etc.), add to the appropriate section if it's significant or has unique props worth documenting.

## Example: Adding a New Glass Component

After adding `GlassStatusWidget.svelte`:

1. **Count confirms ui went from 28 to 29**

2. **Update inventory**:
   ```json
   "ui": 29,
   "total": 186,
   "lastUpdated": "2026-01-21"
   ```

3. **Update COMPONENT-REFERENCE.md**:
   - Line 3: `> 186 components...`
   - Line 13: `- [ui/ - Core UI Components](#ui---core-ui-components-29)`
   - Line 74: `## ui/ - Core UI Components (29)`
   - After line 209, add to table:
     ```markdown
     | `GlassStatusWidget` | Real-time status widget with auto-refresh |
     ```
   - Last line: `*Last updated: 2026-01-21*`

## CI Integration

The `.github/workflows/component-inventory.yml` workflow:
- Runs on PRs touching `packages/engine/src/lib/ui/components/**`
- Counts actual components vs inventory
- Fails if there's a mismatch
- Provides helpful output showing discrepancies

When CI fails, run this skill to fix the mismatch.

## Checklist

Before finishing:

- [ ] All category counts match actual file counts
- [ ] Total equals sum of all categories
- [ ] `lastUpdated` date is today
- [ ] COMPONENT-REFERENCE.md counts match inventory
- [ ] New significant components added to appropriate documentation table
- [ ] Quick Links anchors updated if section headers changed
- [ ] Changes committed with descriptive message

Overview

This skill updates the UI component inventory and public component reference when components are added, removed, or moved. It keeps the source-of-truth JSON and the docs synchronized with the actual component files in the engine. Use it to resolve CI failures, finalize component PRs, or run periodic audits.

How this skill works

It counts .svelte files in each component category under packages/engine/src/lib/ui/components, compares those counts with the .github/component-inventory.json values, and identifies new, removed, or moved components. You then update the inventory JSON, adjust the COMPONENT-REFERENCE.md counts and tables as needed, set lastUpdated, and commit the changes. The CI workflow will pass once counts and docs match the filesystem.

When to use it

  • After adding new UI components or removing/deprecating components
  • When the component-inventory CI check fails on a PR
  • After merging PRs that touch packages/engine/src/lib/ui/components/**
  • When doing a periodic audit to ensure docs match reality
  • If components were reorganized or moved between categories

Best practices

  • Run per-category file counts with the provided find commands to avoid manual errors
  • Always update lastUpdated and lastAuditedBy in the inventory JSON
  • Update the total as the sum of all category counts and verify arithmetic
  • Add significant new components to the correct table in COMPONENT-REFERENCE.md (Glass, Standard, or Specialized)
  • Adjust quick-link anchors and section headers so counts in the docs match the JSON
  • Use a descriptive commit message listing category count changes and added/removed components

Example use cases

  • A PR introduces three new ui/ components — run counts, update .github/component-inventory.json and COMPONENT-REFERENCE.md, then commit
  • CI fails because someone removed a component — identify which category decreased, update the JSON and docs, and push the fix
  • A component was moved from nature/ to ui/ — update both category counts and the documentation section and anchors
  • Quarterly audit: run total count, reconcile any discrepancies, update lastUpdated and push a single docs commit

FAQ

What commands do I run to get accurate counts?

Use the provided find commands to count .svelte files per category (for loop across categories or single-category find). Use ls to inspect files when identifying new or moved components.

What sections of the docs must I update?

Update the intro component total line, quick-link anchors that include counts, the specific section header(s) showing category counts, any component tables where a new or removed component should be listed, and the Last updated line at the bottom.