/design-system-ops:codebase-indexfrom design-system-ops
Generates machine-readable index files (.ai/index/) with component inventory, uses/usedBy dependency graph, and summary statistics for design system codebases. Run after adding or removing components.
Ships in design-system-ops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A skill for generating a pre-computed, machine-readable index of a design system's codebase. The index contains three pieces: a component inventory, a relationship graph, and summary statistics. Together they form a queryable map that eliminates the need for AI agents or developers to explore the codebase from scratch every time they need to understand the system.
Confirm that every path in this skill's frontmatter references: exists relative to this SKILL.md. If any is missing, stop: the install is incomplete, usually because a flattening installer (for example npx skills install) dropped the repo-root knowledge-notes/ directory. Tell the user to reinstall by a method in 1-INSTALL.md and run verify-install.sh from the install root. Proceed without the references only if the user explicitly says to, and then say in the output that it was produced without the pack's reference material.
An agent exploring a codebase from scratch is slow and misses things; an agent loading a pre-computed index gets the whole picture in a few thousand tokens. This skill writes that index, and it is the pack's single producer of the component inventory and dependency graph: token-audit, component-audit, docs-coverage, component-decision-tree and agent-instructions read .ai/index/ rather than building their own. Run it after adding or removing components, and commit the output alongside the code.
If .ds-ops-config.yml exists, follow the configuration-and-recurring knowledge note (../../knowledge-notes/configuration-and-recurring.md) for loading, integration fallbacks and recurring runs. This skill reads:
system.framework — pre-selects framework detectionsystem.component_paths — overrides default component directory scanningsystem.category_model — atomic design, functional, or custom categorisationintegrations.* — component data sources (see below)recurring.* — delta against the previous index (see Recurring workflow)Figma MCP (integrations.figma.enabled: true):
integrations.figma.file_keyStorybook (integrations.storybook.enabled: true):
integrations.storybook.url/index.jsonGitHub (integrations.github.enabled: true):
Scan the project root to determine:
src/components/, src/lib/, components/, packages/, and any paths in tsconfig.json or framework configatoms/, molecules/, organisms/), functional (forms/, navigation/, feedback/), flat, or monorepo packagesIf no component files are found under any candidate root, stop and ask where they live; don't write an empty index.
Ask for or confirm (skip questions already answered by config or detection):
utils/ directory with reusable UI primitives)internal/ directories, components not re-exported from barrel files)Framework detection rules:
| Signal | Framework |
|---|---|
.jsx / .tsx files with JSX returns | React |
.vue files with <template> blocks | Vue |
.svelte files | Svelte |
.astro files | Astro |
.component.ts with @Component decorator | Angular |
customElements.define() | Web Components |
| Mixed signals | Ask the user |
For every component file found, extract:
.metadata.ts, .metadata.json, description in Storybook, JSDoc/TSDoc block, or Figma description)var(--color-action-primary), $space-gap, theme.colors.primary, Tailwind utilities that map to configured tokens). Record the token names as the codebase writes them. This is the token-to-component edge that token-audit and component-audit read for blast radius, so they don't each build a second graphWhat counts as a component:
Category assignment:
uncategorised and flag for manual reviewProduce the inventory in YAML for readability and token efficiency:
components:
Button:
path: src/components/atoms/Button/Button.tsx
category: atoms
metadata: true
tokens: [--color-action-primary, --color-on-action, --space-inset-md]
Card:
path: src/components/molecules/Card/Card.tsx
category: molecules
metadata: true
DataTable:
path: src/components/organisms/DataTable/DataTable.tsx
category: organisms
metadata: false
For every component in the inventory, trace two relationships:
How to trace relationships:
@acme/button is a workspace package, not an external dependency — map workspace package names (from package.json workspaces, pnpm-workspace.yaml, or equivalent) and tsconfig.json paths aliases (@/components/*) to their source directories. Then filter to imports that resolve to components in the inventory, and drop genuine third-party packages, utility imports and type-only importsuses Button and Button usedBy CardDeep tracing rules:
uses: [] (empty) are leaf nodes — they have no internal dependencies on other system components. These are the terminal nodes in the graph.usedBy: [] (empty) are root nodes — nothing else in the scanned repo renders them. Label these "no in-repo consumers", not orphans or unused: a public component exported from the package entry point is meant to be consumed by product repos this index doesn't scan. Only non-exported components with no in-repo consumers are worth flagging, and even then as candidates.Instance counting: Import count and instance count are different metrics. A page might import Button once but render it five times. Instance counting requires parsing templates, not just import statements.
<Name[\s/>] — the trailing space, / or > stops <Button from also matching <ButtonGroup. Resolve import aliases first (import { Button as Btn } means count <Btn)<UI.Button — match <Namespace\.Name[\s/>] (escape the dot) for each namespace import<button-group[\s/>] as well as <ButtonGroup[\s/>]<slot /> and someone writes <Button><Icon /></Button>, the Icon instance belongs to the parent scope, not to Button's internals. Don't recurse into slot content for instance counting.relationships:
Card:
uses: [Text, Button, Icon]
usedBy: [ProductCard, UserProfile]
Button:
uses: [Icon]
usedBy: [Card, Form, Nav, Modal, Dialog, Header]
Icon:
uses: []
usedBy: [Button, Card, Nav, MenuItem, Alert]
Tooltip:
uses: []
usedBy: [CopyButton]
CopyButton:
uses: [Tooltip]
usedBy: [CodeBlock]
This format makes dependency chains explicit. An agent reading this graph knows immediately that Tooltip is actively used (by CopyButton, which is used by CodeBlock) even though no page imports Tooltip directly.
Compute aggregate metrics that give an at-a-glance picture of the system's shape (figures below are illustrative):
summary:
totalComponents: 55
componentsWithMetadata: 54
relationshipsMapped: 302
categories:
atoms: 18
molecules: 15
organisms: 12
templates: 4
pages: 6
noInRepoConsumers:
exported: 14 # public components; consumed by product repos, not a finding
internal: 2 # not exported and not rendered in-repo; candidates for review
mostDependedOn:
- name: Icon
fanIn: 14
- name: Button
fanIn: 11
- name: Text
fanIn: 9
highestFanOut:
- name: Header
fanOut: 8
- name: ProductCard
fanOut: 6
metadataCoverage: 98%
averageInstancesPerComponent: 9.6
Key metrics to compute:
uses arrays)usedBy: [] and no direct use in pages or layouts, split into public exports (expected) and internal components (candidates for review). Never label these "unused" — consumers outside the repo weren't checkedGenerate three output files to be committed alongside the codebase. Both YAML files start with the same generation metadata, so any reader can tell whether the index is current:
meta:
generatedAt: 2026-03-10T14:22:05Z
commit: 3f9c2ab # git rev-parse --short HEAD at generation time
dirtyWorkingTree: false # true if uncommitted changes were scanned
scannedPaths: [packages/*/src, src/components]
excludedPaths: ["**/*.stories.tsx", "**/*.test.tsx"]
component-inventory.ymlThe generation metadata plus the full component inventory from Step 2.
component-relationships.ymlThe generation metadata plus the full relationship graph from Step 3 and the summary statistics from Step 4.
query-protocols.mdA markdown file with instructions for how to use the index. This file teaches AI agents (or developers) how to read the map:
# Query protocols
When answering questions about the design system codebase:
1. Check freshness first. Compare meta.commit with `git rev-parse --short HEAD`.
If they differ, run `git diff --name-only <meta.commit> HEAD` against
meta.scannedPaths. If component files changed, treat the index as stale
for those components: read the source for them, and suggest regenerating.
2. Check the index next. Before reading any source file, check whether the
answer exists in component-inventory.yml or component-relationships.yml.
3. Don't re-read an index that's current. If the relationship graph has
already been loaded in this session and HEAD hasn't moved, reason over it.
4. Follow-up questions should be cheap. After the initial index load,
subsequent questions should require zero or minimal file reads.
## Common query patterns
### "What components exist?"
→ Read component-inventory.yml. The full list with paths and categories.
### "Where is [Component] used?"
→ Check component-relationships.yml → relationships → [Component] → usedBy.
### "What does [Component] depend on?"
→ Check component-relationships.yml → relationships → [Component] → uses.
### "Is [Component] actually used?"
→ Check usedBy. If usedBy is non-empty, it's used in this repo. If usedBy is
empty, check whether it appears in any page or layout file directly. If it
still has no in-repo consumers, say exactly that: product repos outside
meta.scannedPaths weren't checked, so it isn't evidence of "unused".
### "What atoms appear on [Page]?" (application repos only)
→ Pages and layouts exist in application repos, not in a design system
package. If meta.scannedPaths holds an app, trace Page → imports → their
imports → ... until you reach components with uses: []. In a system repo,
say there are no pages to trace.
### "Which components bind [token]?"
→ Search component-inventory.yml for the token name under tokens:. The
list is the in-repo blast radius of a token change.
### "If I change [Component], what breaks?"
→ Follow the usedBy chain recursively. Direct consumers are in usedBy.
Indirect consumers are the usedBy of those consumers. Continue until
you reach page/layout level.
### "Should I create a new component for [pattern]?"
→ Check the inventory for existing components that might serve the need.
Check relationships to understand composition options. A new component
is warranted only if no existing component or composition covers it.
Default output location: .ai/index/ in the project root. This keeps the index files co-located with the codebase and clearly namespaced.
.ai/
index/
component-inventory.yml
component-relationships.yml
query-protocols.md
Recommend to the user:
.ai/index/ from AGENTS.md (agent-instructions does this) so agents find the index before exploringFollows the recurring-run procedure in the configuration-and-recurring note. Specific to this skill: compare the new index against the previous one and produce a delta report:
This delta is valuable for tracking system evolution over time and catching unintentional structural changes.
What SKILL.md sets; muted values are Claude Code's defaults
36 skills in this plugin
/accessibility-per-componentAudit one design system component's accessibility against WCAG 2.2 AA: keyboard, screen reader, contrast, focus, ARIA, target size. Trigger: a11y audit, is this accessible, WCAG check, screen reader support, keyboard navigation check. Not for page- or product-wide audits./adoption-reportAdoption report: coverage (what the system provides), reach (teams with access) and adoption (teams shipping with it), design vs engineering, trend and at-risk teams. Triggers: adoption report, usage metrics, which teams use the system. Not docs coverage — use docs-coverage./agent-instructionsWrite the AGENTS.md that tells coding agents how to use this design system: where things live, sourced rules, how to check work, what not to do; Claude, Cursor or Copilot pointers on request. Triggers: AGENTS.md for our system, make it AI-navigable, agent instructions. Inventory: codebase-index.Generated from the plugin's indexed repository (murphytrueman/design-system-ops) — no native marketplace selected
npx claudepluginhub p/murphytrueman-design-system-ops2 plugins ship this exact skill · first indexed Sep 25, 2026
Other plugins' skills for the same job