Skip to content
Back to skills

Archive

ASecurity

**Status**: ๐Ÿšง In Progress **Priority**: High **Complexity**: Medium **Version**: v3.3.0 **Created**: 2025-10-21 ---

  • 354 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 19, 2026
ai-agentsjavascripttypescriptpythonjavabashreactvuenodetestinggit

Works with

  • cli
  • mcp

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add qf-studio/navigator --skill archive --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Archive?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Archive
[![Security: A โ€” Skills Directory](https://www.skillsdirectory.com/api/skills/qf-studio-archive-navigator/badge)](https://www.skillsdirectory.com/skills/qf-studio-archive-navigator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# TASK-17: Visual Regression Integration Skill

**Status**: ๐Ÿšง In Progress
**Priority**: High
**Complexity**: Medium
**Version**: v3.3.0
**Created**: 2025-10-21

---

## ๐ŸŽฏ Objective

Create `visual-regression` skill to automate visual regression testing setup with Chromatic, Percy, or BackstopJS integration.

**User value**: Reduce visual regression setup from 2-3 hours to 5 minutes, ensure pixel-perfect implementation of designs, prevent design system drift.

---

## ๐Ÿ“‹ Context

Navigator v3.2 introduced `product-design` skill for Figma design handoff. Visual regression closes the loop:

```
Design (Figma) โ†’ Code (product-design) โ†’ Validation (visual-regression) โ†’ CI/CD
```

**Problem**: Setting up visual regression requires:
- Storybook configuration
- Test tool setup (Chromatic/Percy/BackstopJS)
- Story file generation
- CI/CD integration
- Design token validation

**Solution**: Auto-generate all configuration, stories, and CI workflows.

---

## ๐Ÿ—๏ธ Architecture

### Skill Structure

```
skills/visual-regression/
โ”œโ”€โ”€ SKILL.md                          # Auto-invocation, instructions
โ”œโ”€โ”€ functions/
โ”‚   โ”œโ”€โ”€ story_generator.py            # Generate Storybook stories
โ”‚   โ”œโ”€โ”€ chromatic_config_generator.py # Chromatic config
โ”‚   โ”œโ”€โ”€ ci_workflow_generator.py      # GitHub Actions/GitLab CI
โ”‚   โ””โ”€โ”€ vr_setup_validator.py         # Validate existing setup
โ”œโ”€โ”€ templates/
โ”‚   โ”œโ”€โ”€ story-template.tsx.j2         # TypeScript story template
โ”‚   โ”œโ”€โ”€ chromatic-config.json.j2      # Chromatic configuration
โ”‚   โ”œโ”€โ”€ github-workflow.yml.j2        # GitHub Actions workflow
โ”‚   โ”œโ”€โ”€ gitlab-ci.yml.j2              # GitLab CI workflow
โ”‚   โ””โ”€โ”€ storybook-main.js.j2          # Storybook addon config
โ””โ”€โ”€ examples/
    โ”œโ”€โ”€ simple-component-vr.md        # Basic component example
    โ”œโ”€โ”€ design-system-vr.md           # Full design system setup
    โ””โ”€โ”€ existing-storybook-vr.md      # Add to existing Storybook
```

### Integration Points

1. **product-design skill**: After implementation plan, suggest VR setup
2. **CI/CD**: Generate GitHub Actions, GitLab CI, CircleCI configs
3. **Storybook**: Auto-detect existing setup, configure addons
4. **Test tools**: Support Chromatic, Percy, BackstopJS

---

## ๐Ÿ”ง Implementation Plan

### Phase 1: Skill Foundation (Core)

#### 1.1 Create Skill Directory & SKILL.md

**Location**: `skills/visual-regression/SKILL.md`

**Auto-invocation patterns**:
- "Set up visual regression"
- "Add Chromatic tests"
- "Create visual tests for [component]"
- "Configure visual regression testing"
- "Add screenshot testing"

**Skill description** (50 tokens for progressive disclosure):
```
Generate visual regression testing setup (Chromatic, Percy, BackstopJS).
Auto-generates Storybook stories, config files, CI workflows.
Use after implementing components to ensure pixel-perfect designs.
```

**Instructions include**:
- Detect framework (React, Vue, Svelte)
- Detect existing Storybook setup
- Choose test tool (Chromatic default, ask if ambiguous)
- Generate stories for component variants
- Create configuration files
- Generate CI/CD workflow
- Output setup instructions

#### 1.2 Create vr_setup_validator.py

**Purpose**: Detect existing setup, prevent conflicts

**Functions**:
```python
def detect_storybook_config(project_root: str) -> dict:
    """Detect Storybook version and configuration"""
    # Check .storybook/main.js, package.json
    # Return: version, addons, framework

def detect_vr_tool(project_root: str) -> str:
    """Detect existing VR tool (chromatic, percy, backstop)"""
    # Check package.json dependencies
    # Return: tool_name or None

def validate_component_path(component_path: str) -> dict:
    """Validate component exists, extract props"""
    # Parse component file
    # Return: component_name, props, variants

def check_dependencies(project_root: str) -> dict:
    """Check required dependencies installed"""
    # storybook, chromatic, @storybook/addon-chromatic
    # Return: installed, missing
```

**Output**: JSON with detected setup, recommendations

#### 1.3 Create story_generator.py

**Purpose**: Generate Storybook stories with all variants

**Functions**:
```python
def analyze_component(component_path: str, framework: str) -> dict:
    """Extract component props, variants, states"""
    # Parse TypeScript/JSX
    # Return: props, prop_types, default_values

def generate_story(component_info: dict, template_path: str) -> str:
    """Generate story file from template"""
    # Use Jinja2 template
    # Include: default, variants, states, interactions

def create_accessibility_tests(component_info: dict) -> str:
    """Add a11y tests to stories"""
    # @storybook/addon-a11y integration

def create_interaction_tests(component_info: dict) -> str:
    """Add interaction tests (play function)"""
    # @storybook/test integration
```

**Output**: Complete `.stories.tsx` file

#### 1.4 Create chromatic_config_generator.py

**Purpose**: Generate Chromatic configuration

**Functions**:
```python
def generate_chromatic_config(project_info: dict) -> str:
    """Generate chromatic.config.json"""
    # Settings: projectId, buildScriptName, externals, etc.

def generate_storybook_config(existing_config: dict) -> str:
    """Update .storybook/main.js with Chromatic addon"""
    # Add @chromatic-com/storybook addon

def generate_package_scripts(existing_scripts: dict) -> dict:
    """Add chromatic scripts to package.json"""
    # "chromatic": "npx chromatic"
    # "chromatic:ci": "npx chromatic --exit-zero-on-changes"
```

**Output**: Config files as strings

#### 1.5 Create ci_workflow_generator.py

**Purpose**: Generate CI/CD workflows

**Functions**:
```python
def generate_github_workflow(project_info: dict) -> str:
    """Generate .github/workflows/chromatic.yml"""
    # Trigger: push, pull_request
    # Jobs: build storybook, run chromatic

def generate_gitlab_ci(project_info: dict) -> str:
    """Generate .gitlab-ci.yml chromatic job"""

def generate_circleci_config(project_info: dict) -> str:
    """Generate .circleci/config.yml chromatic job"""

def detect_ci_platform(project_root: str) -> str:
    """Detect CI platform from existing files"""
    # Check for .github/, .gitlab-ci.yml, .circleci/
```

**Output**: CI workflow files

### Phase 2: Templates

#### 2.1 story-template.tsx.j2

**Jinja2 template for React/TypeScript stories**:

```typescript
import type { Meta, StoryObj } from '@storybook/react';
import { {{ component_name }} } from './{{ component_file }}';

const meta = {
  title: '{{ story_path }}',
  component: {{ component_name }},
  parameters: {
    layout: 'centered',
  },
  tags: ['autodocs'],
  argTypes: {
    {% for prop in props %}
    {{ prop.name }}: { control: '{{ prop.control }}' },
    {% endfor %}
  },
} satisfies Meta<typeof {{ component_name }}>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
  args: {
    {% for prop in default_props %}
    {{ prop.name }}: {{ prop.value }},
    {% endfor %}
  },
};

{% for variant in variants %}
export const {{ variant.name }}: Story = {
  args: {
    {% for prop in variant.props %}
    {{ prop.name }}: {{ prop.value }},
    {% endfor %}
  },
};
{% endfor %}
```

#### 2.2 chromatic-config.json.j2

```json
{
  "projectId": "{{ project_id }}",
  "buildScriptName": "build-storybook",
  "exitZeroOnChanges": true,
  "exitOnceUploaded": true,
  "onlyChanged": true,
  "externals": ["public/**"],
  "skip": "{{ skip_pattern }}",
  "ignoreLastBuildOnBranch": "{{ main_branch }}"
}
```

#### 2.3 github-workflow.yml.j2

```yaml
name: Visual Regression Tests

on:
  push:
    branches: [{{ branches }}]
  pull_request:
    branches: [{{ branches }}]

jobs:
  chromatic:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '{{ node_version }}'
          cache: '{{ package_manager }}'

      - name: Install dependencies
        run: {{ install_command }}

      - name: Run Chromatic
        uses: chromaui/action@latest
        with:
          projectToken: {% raw %}${{ secrets.CHROMATIC_PROJECT_TOKEN }}{% endraw %}
          exitZeroOnChanges: true
```

#### 2.4 storybook-main.js.j2

```javascript
module.exports = {
  stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
  addons: [
    '@storybook/addon-links',
    '@storybook/addon-essentials',
    '@chromatic-com/storybook',
    '@storybook/addon-interactions',
  ],
  framework: {
    name: '@storybook/{{ framework }}',
    options: {},
  },
};
```

### Phase 3: Examples & Documentation

#### 3.1 simple-component-vr.md

Example: Setting up VR for single component

#### 3.2 design-system-vr.md

Example: Full design system with token validation

#### 3.3 existing-storybook-vr.md

Example: Adding VR to existing Storybook setup

### Phase 4: Integration

#### 4.1 Update plugin.json

Register `visual-regression` skill:

```json
{
  "name": "visual-regression",
  "description": "Generate visual regression testing setup (Chromatic/Percy/BackstopJS) with Storybook stories, config files, and CI workflows",
  "auto_invoke_patterns": [
    "set up visual regression",
    "add chromatic tests",
    "create visual tests",
    "configure visual regression",
    "add screenshot testing"
  ]
}
```

#### 4.2 Update product-design Skill

Add step in `product-design/SKILL.md`:

```markdown
## Step 6: Suggest Visual Regression Setup

After generating implementation plan:

"Consider setting up visual regression testing to ensure pixel-perfect implementation:

  'Set up visual regression for [ComponentName]'

This will generate Storybook stories, Chromatic config, and CI integration."
```

#### 4.3 Create SOP

**Location**: `.agent/sops/testing/visual-regression-setup.md`

**Contents**:
- Quick start guide
- Tool comparison (Chromatic vs Percy vs BackstopJS)
- Setup checklist
- Troubleshooting
- Integration with design workflow

---

## ๐ŸŽฏ Success Criteria

### Functional Requirements

- โœ… Auto-detects framework (React, Vue, Svelte)
- โœ… Auto-detects existing Storybook setup
- โœ… Generates stories with all component variants
- โœ… Generates Chromatic/Percy/BackstopJS config
- โœ… Generates CI/CD workflows (GitHub/GitLab/CircleCI)
- โœ… Provides setup instructions
- โœ… Auto-invokes on natural language patterns

### Quality Requirements

- โœ… Generated stories are TypeScript-safe
- โœ… Accessibility tests included (addon-a11y)
- โœ… Interaction tests included (addon-interactions)
- โœ… Non-destructive (backs up existing configs)
- โœ… Validates dependencies before generating

### Documentation Requirements

- โœ… SKILL.md with clear instructions
- โœ… 3 examples (simple, design system, existing setup)
- โœ… SOP for visual regression workflow
- โœ… Integration with product-design documented

---

## ๐Ÿงช Testing Strategy

### Manual Testing (nav-test project)

```bash
# Test 1: New component VR setup
"Set up visual regression for ProfileCard component"
โ†’ Verify: story generated, config created, CI workflow added

# Test 2: Existing Storybook
"Add Chromatic to existing Storybook"
โ†’ Verify: addon added, config created, no conflicts

# Test 3: Design system
"Set up visual regression for entire design system"
โ†’ Verify: stories for all components, token validation

# Test 4: CI detection
"Configure visual regression for GitHub Actions"
โ†’ Verify: .github/workflows/chromatic.yml created
```

### Validation Checks

- Generated TypeScript compiles
- Storybook builds successfully
- Chromatic CLI runs (with mock token)
- CI workflow syntax valid

---

## ๐Ÿ“Š Token Efficiency

**Before** (manual setup):
- Read Storybook docs: 20k tokens
- Read Chromatic docs: 15k tokens
- Write stories manually: 10k tokens
- Configure CI: 5k tokens
- **Total**: 50k tokens

**After** (visual-regression skill):
- Skill auto-invokes: 0 tokens (natural language)
- Skill instructions load: 3k tokens
- Predefined functions execute: 0 tokens
- **Total**: 3k tokens

**Savings**: 94% (47k tokens saved)

---

## ๐Ÿš€ Rollout Plan

### Phase 1: Core Skill (v3.3.0-alpha)
- Chromatic support only
- React/TypeScript only
- GitHub Actions only
- Test internally

### Phase 2: Multi-Tool Support (v3.3.0-beta)
- Add Percy support
- Add BackstopJS support
- Test with community

### Phase 3: Multi-Framework (v3.3.0)
- Add Vue support
- Add Svelte support
- Add GitLab CI, CircleCI
- Full release

---

## ๐Ÿ“ Documentation Updates

### Files to Update

1. **README.md**: Add visual-regression to skills list
2. **DEVELOPMENT-README.md**: Add TASK-17 to completed tasks
3. **ROADMAP.md**: Move visual regression from planned to completed
4. **ARCHITECTURE.md**: Document visual-regression skill architecture
5. **RELEASE-NOTES-v3.3.0.md**: Create release notes

### New Files

1. `.agent/sops/testing/visual-regression-setup.md`
2. `skills/visual-regression/SKILL.md`
3. `skills/visual-regression/functions/*.py` (4 files)
4. `skills/visual-regression/templates/*.j2` (5 files)
5. `skills/visual-regression/examples/*.md` (3 files)

---

## ๐ŸŽ“ Lessons for Future Skills

### What Worked Well

- Predefined functions for complex logic
- Templates for consistent output
- Multi-tool support (Chromatic/Percy/BackstopJS)
- Integration with existing skills (product-design)

### What Could Be Better

- Consider MCP server for external tool integration
- Add visual regression dashboard (future v3.4)
- Support more CI platforms out of the box

---

## ๐Ÿ“… Timeline

- **Day 1**: Skill structure, SKILL.md, validator function
- **Day 2**: story_generator.py, templates
- **Day 3**: Config generators (chromatic, CI)
- **Day 4**: Examples, documentation
- **Day 5**: Integration, testing, release

**Estimated effort**: 5 days
**Target release**: v3.3.0 (Q4 2025 โ†’ Now 2025-10-21)

---

## ๐Ÿ”— Related Tasks

- **TASK-16**: Product Design Skill (integration point)
- **TASK-13**: OpenTelemetry (measure VR setup token savings)
- **TASK-10**: Project Skills Generation (pattern to follow)

---

**Created by**: Navigator autonomous task planning
**Last updated**: 2025-10-21
**Version**: v3.3.0

Files in this skill

  • TASK-01-session-start-pm-integration.md10 KB
  • TASK-02-readme-markers-v1.4.0.md8.2 KB
  • TASK-03-markers-management-auto-resume.md9.9 KB
  • TASK-04-version-sync-release-process.md14.3 KB
  • TASK-05-autonomous-completion.md15.7 KB
  • TASK-06-session-statistics.md9.1 KB
  • TASK-07-skills-migration.md14.8 KB
  • TASK-08-skills-enhancements-v2.1.md27.2 KB
  • TASK-09-migration-system.md20.8 KB
  • TASK-10-project-skills-v2.2.md12 KB
  • TASK-11-project-skills-generation-v2.3.md14.3 KB
  • TASK-12-v3.0-skills-only.md12 KB
  • TASK-13-otel-session-statistics.md18.4 KB
  • TASK-14-claude-md-updater.md9 KB
  • TASK-14-documentation-consolidation.md13.5 KB
  • TASK-16-product-design-skill.md22.6 KB
  • TASK-17-visual-regression-skill.md14 KB
  • TASK-18-CORRECTIONS.md12.8 KB
  • TASK-18-PITCH.md13.4 KB
  • TASK-18-README.md10.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading commentsโ€ฆ

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.