home / skills / phrazzld / claude-config / fix-quality

fix-quality skill

/skills/fix-quality

This skill automates fixing the highest priority quality issue by running audits, applying a targeted fix, and verifying results.

npx playbooks add skill phrazzld/claude-config --skill fix-quality

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

Files (1)
SKILL.md
3.2 KB
---
name: fix-quality
description: |
  Run /check-quality, then fix the highest priority quality issue.
  Creates one fix per invocation. Invoke again for next issue.
  Use /log-quality-issues to create issues without fixing.
effort: high
---

# /fix-quality

Fix the highest priority quality infrastructure gap.

## What This Does

1. Invoke `/check-quality` to audit quality gates
2. Identify highest priority gap
3. Fix that one issue
4. Verify the fix
5. Report what was done

**This is a fixer.** It fixes one issue at a time. Run again for next issue. Use `/quality-gates` for full setup.

## Process

### 1. Run Primitive

Invoke `/check-quality` skill to get prioritized findings.

### 2. Fix Priority Order

Fix in this order:
1. **P0**: Missing test runner, missing CI workflow
2. **P1**: Coverage, git hooks, linting, strict TypeScript
3. **P2**: Commitlint, coverage in PRs
4. **P3**: Tool upgrades

### 3. Execute Fix

**No test runner (P0):**
```bash
pnpm add -D vitest @vitest/coverage-v8
```

Create `vitest.config.ts`:
```typescript
import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    globals: true,
    environment: 'node',
    coverage: {
      provider: 'v8',
      reporter: ['text', 'json', 'html'],
    },
  },
});
```

Add scripts to package.json:
```json
{
  "scripts": {
    "test": "vitest",
    "test:run": "vitest run",
    "coverage": "vitest run --coverage"
  }
}
```

**No CI workflow (P0):**
Create `.github/workflows/ci.yml`:
```yaml
name: CI
on: [push, pull_request]
jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: 'pnpm'
      - run: pnpm install
      - run: pnpm typecheck
      - run: pnpm lint
      - run: pnpm test:run
```

**No git hooks (P1):**
```bash
pnpm add -D lefthook
pnpm lefthook install
```

Create `lefthook.yml`:
```yaml
pre-commit:
  parallel: true
  commands:
    lint:
      glob: "*.{ts,tsx}"
      run: pnpm eslint {staged_files}
    typecheck:
      run: pnpm tsc --noEmit

pre-push:
  commands:
    test:
      run: pnpm test:run
```

**TypeScript not strict (P1):**
Update `tsconfig.json`:
```json
{
  "compilerOptions": {
    "strict": true
  }
}
```

### 4. Verify

After fix:
```bash
# Test runner works
pnpm test --run

# Hooks installed
[ -f ".git/hooks/pre-commit" ] && echo "✓ pre-commit hook"

# CI file exists
[ -f ".github/workflows/ci.yml" ] && echo "✓ CI workflow"
```

### 5. Report

```
Fixed: [P0] No test runner configured

Installed:
- vitest
- @vitest/coverage-v8

Created:
- vitest.config.ts
- Added test scripts to package.json

Verified: pnpm test runs successfully

Next highest priority: [P0] No CI workflow
Run /fix-quality again to continue.
```

## Branching

Before making changes:
```bash
git checkout -b infra/quality-$(date +%Y%m%d)
```

## Single-Issue Focus

This skill fixes **one issue at a time**. Benefits:
- Small, reviewable changes
- Easy to verify each fix
- Clear commit history

Run `/fix-quality` repeatedly to work through the backlog.

## Related

- `/check-quality` - The primitive (audit only)
- `/log-quality-issues` - Create issues without fixing
- `/quality-gates` - Full quality setup workflow

Overview

This skill automates one focused fix for the highest priority repository quality gap. It runs a quality audit, applies a single concrete remediation (one per invocation), verifies the change, and reports what was done. Invoke repeatedly to work through the backlog of issues in priority order.

How this skill works

The skill calls the /check-quality audit to get prioritized findings, selects the top priority gap, and applies a targeted fix (for example: add a test runner, create a CI workflow, install git hooks, or enable strict TypeScript). After applying the change it runs simple verification steps and returns a short report of installations, created files, and next recommended action. Each run produces exactly one change to keep commits small and reviewable.

When to use it

  • When you want to remediate repository quality issues one at a time with small commits.
  • When an audit shows missing test runner, CI, git hooks, or TypeScript settings and you want an automated fix.
  • When you prefer incremental, verifiable infrastructure changes to a large batch update.
  • When you need a quick repair to unblock CI or local developer workflows.
  • When you want to convert audit findings into concrete, reviewable commits.

Best practices

  • Run /check-quality first to get the prioritized findings before invoking this skill.
  • Create a short-lived branch (infra/quality-YYYYMMDD) for each fix to keep history clean.
  • Review the single change per run; run the skill again for the next priority item.
  • Keep project scripts (test, coverage) and typecheck commands in package.json to match CI steps.
  • Verify fixes locally (run tests, check hooks) before opening a PR.

Example use cases

  • No test runner found: install vitest, add config and test scripts, and verify tests run.
  • Missing CI workflow: create a GitHub Actions workflow that installs dependencies, typechecks, lints, and runs tests.
  • Missing git hooks: install and configure lefthook to run linting, typecheck, and pre-push tests.
  • TypeScript not strict: update tsconfig.json to enable strict mode and verify typecheck passes.
  • Progressively harden a repo by repeatedly invoking the skill to address P0 → P1 → P2 items.

FAQ

How many fixes does this skill apply per run?

One. The skill applies a single, highest-priority fix each invocation to keep changes small and reviewable.

Can I skip issues or change priority?

Use /check-quality to inspect findings and /log-quality-issues to create issues without fixing. To change priority ordering, adjust your internal workflow before invoking the fixer.