SH

shield-testing

Enforces SHIELD 2.0 testing and CI/CD requirements to maintain quality standards before merging.

Install

mkdir -p .claude/skills/shield-testing && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19344" && unzip -o skill.zip -d .claude/skills/shield-testing && rm skill.zip

Installs to .claude/skills/shield-testing

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Testing and CI/CD requirements for SHIELD 2.0. Use this when writing tests, preparing PRs, or ensuring code quality before merge.
129 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Format code using Prettier
  • Lint source code
  • Execute unit tests
  • Build the project
  • Mock Electron APIs

How it works

It enforces a pre-merge checklist and testing structure that requires formatting, linting, and unit testing for all new features.

Inputs & outputs

You give it
Source code changes
You get back
Validation of code quality and test coverage

When to use shield-testing

  • Verify code quality before merge
  • Run unit tests for new features
  • Check build and lint status
  • Update documentation for tests

About this skill

SHIELD 2.0 Testing Guidelines

Pre-Merge Checklist

ALL checks must pass before merging to main:

  1. npm run format - Run Prettier
  2. npm run lint - Zero errors/warnings
  3. npm test -- --run - All tests pass
  4. npm run build - Successful build
  5. Manual testing completed
  6. Documentation updated

Test Requirements

Unit Tests

  • Required for all new features
  • Aim for >80% coverage on business logic
  • Located next to source files (*.test.ts)

Test Structure

import { describe, it, expect, vi } from "vitest";

describe("ComponentName", () => {
  describe("methodName", () => {
    it("should do expected behavior", () => {
      // Arrange
      // Act
      // Assert
    });
  });
});

Mocking

// Mock Electron APIs
vi.mock("electron", () => ({
  ipcRenderer: {
    invoke: vi.fn(),
    on: vi.fn(),
  },
}));

// Mock window.electronAPI
Object.defineProperty(window, "electronAPI", {
  value: {
    llm: { loadModel: vi.fn() },
  },
});

CI/CD Pipeline

GitHub Actions runs on every PR:

  1. Format Check: npx prettier --check "**/*.{ts,tsx,js,json,md,yml}"
  2. Lint: npm run lint
  3. Type Check: npx tsc --noEmit
  4. Tests: npm test -- --run
  5. Build: npm run build

Test Files Location

src/
├── App.test.ts
├── components/
│   └── chat/
│       └── chat.test.ts
electron/
└── services/
    ├── MCPService.test.ts
    └── AuditLogTypes.test.ts

Running Tests

# Run all tests
npm test -- --run

# Watch mode
npm test

# Specific file
npm test -- src/App.test.ts

# With coverage
npm test -- --coverage

What to Test

  • Business logic functions
  • State store actions
  • IPC handlers
  • Utility functions
  • Component rendering (basic)

What NOT to Test

  • Third-party library internals
  • Electron main process directly
  • LLM inference (mock it)

When not to use it

  • Testing third-party library internals
  • Testing Electron main process directly
  • Testing LLM inference

Prerequisites

npmvitest

Limitations

  • Zero linting errors allowed
  • Aim for >80% coverage on business logic

How it compares

It mandates specific CI/CD pipeline steps and mocking patterns for SHIELD 2.0 rather than allowing arbitrary testing configurations.

Compared to similar skills

shield-testing side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
shield-testing (this skill)05moReviewIntermediate
feature-flags66moReviewIntermediate
testing-workflow169moReviewIntermediate
playwright-pro82moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry