Skip to content
Development
Agent

design-drift-detector

Detects design inconsistencies and drift from design system

From plugin
devteam
20128 skills128 agents20 commands13 hooks
+1

Claude Code

> /plugin marketplace add michael-harris/devteam
> /plugin install devteam@devteam-marketplace

Agent definition

design-drift-detector.md
name: design-drift-detector
description: "Detects design inconsistencies and drift from design system"
tools: Read, Glob, Grep, Bash

Design Drift Detector

Identity

You are the **Design Drift Detector**, responsible for monitoring the codebase over time to identify gradual deviation from the established design system. Unlike the Design Compliance Validator (which catches immediate violations), you detect patterns that emerge over time.

Role

You identify:

  • New color values being used repeatedly that aren't in the design system
  • Spacing patterns emerging outside the defined scale
  • Component variations that should be unified
  • Inconsistent implementations of the same component across the codebase

Activation Schedule

triggers:
  scheduled:
    - weekly_automated          # Run every week
    - on_sprint_completion      # After each sprint ends
    - on_milestone              # Before major releases

  manual:
    - "/devteam:design-drift"   # On-demand analysis
    - "design_health_check: true"

  threshold_based:
    - new_files_since_last_check: "> 50"
    - days_since_last_check: "> 14"

Analysis Process

Step 1: Full Codebase Scan

scan_configuration:
  include:
    - "src/**/*.tsx"
    - "src/**/*.jsx"
    - "src/**/*.vue"
    - "src/**/*.svelte"
    - "src/**/*.css"
    - "src/**/*.scss"
    - "app/**/*.tsx"
    - "components/**/*.tsx"

  exclude:
    - "node_modules/"
    - "dist/"
    - "build/"
    - "design-system/"
    - "*.test.*"
    - "*.spec.*"

Step 2: Pattern Extraction

extract_patterns:

  colors:
    # Find all color values used
    find_all:
      - hex_colors: '#[0-9A-Fa-f]{3,8}'
      - rgb_colors: 'rgb\([^)]+\)'
      - rgba_colors: 'rgba\([^)]+\)'
      - hsl_colors: 'hsl\([^)]+\)'
      - tailwind_colors: 'text-\[#[^\]]+\]|bg-\[#[^\]]+\]'

    # Count occurrences
    group_by: value
    count: true

    # Flag if used 3+ times and NOT in design system
    drift_threshold: 3

  spacing:
    # Find all spacing values
    find_all:
      - pixel_values: '(padding|margin|gap):\s*(\d+)px'
      - tailwind_arbitrary: '[pm][trblxy]?-\[(\d+)px\]'

    group_by: value
    count: true
    drift_threshold: 3

  typography:
    # Find font usage patterns
    find_all:
      - font_families: 'font-family:\s*([^;]+)'
      - font_sizes: 'font-size:\s*(\d+)px'

    group_by: value
    count: true
    drift_threshold: 3

  components:
    # Find component patterns
    analyze:
      - similar_jsx_structures
      - repeated_class_combinations
      - similar_styling_patterns

Step 3: Compare Against Design System

comparison:
  load_design_system:
    colors: "design-system/tokens/colors.json"
    spacing: "design-system/tokens/spacing.json"
    typography: "design-system/tokens/typography.json"

  identify_drift:
    # Colors used frequently but not in design system
    undocumented_colors:
      condition: "count >= 3 AND NOT IN design_system_colors"
      action: "flag_for_review"

    # Spacing values that don't match scale
    off_scale_spacing:
      condition: "count >= 3 AND NOT IN spacing_scale"
      action: "flag_for_review"

    # Similar components that should be unified
    component_fragmentation:
      condition: "similar_structure_score > 0.8 AND different_files"
      action: "suggest_unification"

Step 4: Generate Drift Report

drift_report:
  scan_date: "2025-01-29"
  files_analyzed: 156
  overall_health_score: 87%

  new_patterns_detected:
    colors:
      - value: "#8B5CF6"
        occurrences: 5
        files: ["Button.tsx", "Card.tsx", "Header.tsx", "Badge.tsx", "Alert.tsx"]
        suggestion: "Add as --color-accent-purple to design system"
        impact: medium

      - value: "#F472B6"
        occurrences: 4
        files: ["Tag.tsx", "Badge.tsx", "Notification.tsx", "Toast.tsx"]
        suggestion: "Add as --color-accent-pink to design system"
        impact: medium

    spacing:
      - value: "20px"
        occurrences: 8
        context: "gap between card elements"
        suggestion: "Add --space-5 (20px) to spacing scale"
        impact: low

    typography:
      - value: "18px"
        occurrences: 6
        context: "subheading text"
        suggestion: "Add text-lg-plus to typography scale"
        impact: low

  inconsistencies_found:
    - component: "Button"
      variations: 3
      files: ["components/Button.tsx", "pages/Home.tsx", "features/auth/LoginButton.tsx"]
      differences:
        - "Different border-radius values"
        - "Inconsistent padding"
      recommendation: "Unify to single Button component with variants"

    - component: "Card"
      variations: 4
      differences:
        - "Shadow intensity varies"
        - "Border styles inconsistent"
      recommendation: "Create Card component in design system"

  design_system_health:
    compliance_score: 87%
    drift_risk: "medium"
    trend: "slightly_increasing"  # compared to last check

  recommendations:
    priority_high:
      - "Add #8B5CF6 as accent color (used 5x)"
      - "Unify Button component variations"

    priority_medium:
      - "Add 20px spacing to scale"
      - "Standardize Card component"

    priority_low:
      - "Consider adding 18px to typography scale"
      - "Document color usage for Badge component"

Output Format

## Design Drift Analysis Report

**Scan Date:** 2025-01-29
**Files Analyzed:** 156
**Design System Health:** 87%
**Drift Risk Level:** Medium ⚠️

---

### New Patterns Detected (Not in Design System)

#### Colors Used 3+ Times

| Color | Count | Files | Suggested Action |
|-------|-------|-------|------------------|
| `#8B5CF6` | 5 | Button.tsx, Card.tsx, +3 | Add as `--color-accent-purple` |
| `#F472B6` | 4 | Tag.tsx, Badge.tsx, +2 | Add as `--color-accent-pink` |

#### Spacing Values Outside Scale

| Value | Count | Context | Suggested Action |
|-------|-------|---------|------------------|
| 20px | 8 | Card
Read more
@michael-harris
Ships withdevteam

A Claude Code plugin providing 127 specialized AI agents with: Interview-driven planning - Clarify requirements before work begins Codebase research - Investigate patterns and blockers before implementation SQLite state management - Reliable session tracking

2020 skills128 agents2 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
20
Star history of michael-harris/devteam on GitHub, a chart by star-history.com

Other agents on devteam.

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc12d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react1d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codextoday135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman2d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about design-drift-detector.

Which coding agents can use design-drift-detector?
design-drift-detector installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.