skills/refine/SKILL.md
Review and finish the current branch. Use when the user wants the agent to inspect the branch diff, fix code review, lint, typecheck, test, documentation, and PR gaps, then commit, push, and create or update the PR.
npx skillsauth add sceiler/skills refineInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Run one branch-finishing pass on the current branch. This skill is for taking a branch from "changes exist" to "ready for review or merge": inspect the diff, do a real code review, fix what is wrong, verify the branch, update supporting docs when needed, then commit, push, and create or update the PR.
tsc directly.Return a concise shipping summary that includes:
Use these patterns to distinguish strong unit tests from weak ones.
Bad:
// math.ts
export function add(a: number, b: number) {
const result = a + b
return result
}
// math.test.ts
import { add } from './math'
import { describe, it, expect, vi } from 'vitest'
describe('add', () => {
it('calls internal addition logic', () => {
const spy = vi.spyOn(Number.prototype, 'valueOf')
add(1, 2)
expect(spy).toHaveBeenCalled()
})
})
Good:
// math.ts
export function add(a: number, b: number) {
return a + b
}
// math.test.ts
import { add } from './math'
import { describe, it, expect } from 'vitest'
describe('add', () => {
it('returns the sum of two numbers', () => {
expect(add(1, 2)).toBe(3)
})
it('handles negative numbers', () => {
expect(add(-1, 2)).toBe(1)
})
})
Why the bad version is wrong:
Bad:
// user-service.ts
export async function getDisplayName(api: { fetchUser(id: string): Promise<{ first: string; last: string }> }, id: string) {
const user = await api.fetchUser(id)
return `${user.first} ${user.last}`
}
// user-service.test.ts
import { describe, it, expect, vi } from 'vitest'
import { getDisplayName } from './user-service'
describe('getDisplayName', () => {
it('calls fetchUser once', async () => {
const api = {
fetchUser: vi.fn().mockResolvedValue({ first: 'Ada', last: 'Lovelace' }),
}
await getDisplayName(api, '1')
expect(api.fetchUser).toHaveBeenCalledWith('1')
expect(api.fetchUser).toHaveBeenCalledTimes(1)
})
})
Good:
// user-service.test.ts
import { describe, it, expect, vi } from 'vitest'
import { getDisplayName } from './user-service'
describe('getDisplayName', () => {
it('returns the full display name for the fetched user', async () => {
const api = {
fetchUser: vi.fn().mockResolvedValue({ first: 'Ada', last: 'Lovelace' }),
}
await expect(getDisplayName(api, '1')).resolves.toBe('Ada Lovelace')
})
})
Why the bad version is wrong:
Bad:
// menu.ts
export function buildMenu(role: 'admin' | 'user') {
return {
showBilling: role === 'admin',
showUsers: role === 'admin',
showProfile: true,
}
}
// menu.test.ts
import { describe, it, expect } from 'vitest'
import { buildMenu } from './menu'
describe('buildMenu', () => {
it('matches the admin snapshot', () => {
expect(buildMenu('admin')).toMatchSnapshot()
})
})
Good:
// menu.test.ts
import { describe, it, expect } from 'vitest'
import { buildMenu } from './menu'
describe('buildMenu', () => {
it('enables billing and users for admins', () => {
expect(buildMenu('admin')).toEqual({
showBilling: true,
showUsers: true,
showProfile: true,
})
})
it('hides admin-only items for normal users', () => {
expect(buildMenu('user')).toEqual({
showBilling: false,
showUsers: false,
showProfile: true,
})
})
})
Why the bad version is wrong:
Bad:
// eligibility.ts
export function isEligible(age: number, hasConsent: boolean) {
return age >= 18 || hasConsent
}
// eligibility.test.ts
import { describe, it, expect } from 'vitest'
import { isEligible } from './eligibility'
describe('isEligible', () => {
it('returns true for an adult', () => {
expect(isEligible(18, false)).toBe(true)
})
})
Good:
// eligibility.test.ts
import { describe, it, expect } from 'vitest'
import { isEligible } from './eligibility'
describe('isEligible', () => {
it('returns true for an adult', () => {
expect(isEligible(18, false)).toBe(true)
})
it('returns true for a minor with consent', () => {
expect(isEligible(16, true)).toBe(true)
})
it('returns false for a minor without consent', () => {
expect(isEligible(16, false)).toBe(false)
})
})
Why the bad version is wrong:
Bad:
// session.ts
export function isExpired(expiresAt: number) {
return Date.now() >= expiresAt
}
// session.test.ts
import { describe, it, expect } from 'vitest'
import { isExpired } from './session'
describe('isExpired', () => {
it('returns false for a future timestamp', () => {
expect(isExpired(Date.now() + 1)).toBe(false)
})
})
Good:
// session.ts
export function isExpired(expiresAt: number, now: () => number = Date.now) {
return now() >= expiresAt
}
// session.test.ts
import { describe, it, expect } from 'vitest'
import { isExpired } from './session'
describe('isExpired', () => {
it('returns false before the expiration time', () => {
expect(isExpired(1_000, () => 999)).toBe(false)
})
it('returns true at the expiration time', () => {
expect(isExpired(1_000, () => 1_000)).toBe(true)
})
})
Why the bad version is wrong:
Bad:
// port.ts
export function parsePort(input: string) {
const port = Number(input)
if (!Number.isInteger(port) || port < 1 || port > 65535) {
throw new Error('Invalid port')
}
return port
}
// port.test.ts
import { describe, it, expect } from 'vitest'
import { parsePort } from './port'
describe('parsePort', () => {
it('throws for invalid input', () => {
expect(() => parsePort('abc')).toThrow()
})
})
Good:
// port.test.ts
import { describe, it, expect } from 'vitest'
import { parsePort } from './port'
describe('parsePort', () => {
it('returns the parsed port for valid input', () => {
expect(parsePort('3000')).toBe(3000)
})
it('throws a clear error for invalid input', () => {
expect(() => parsePort('abc')).toThrowError('Invalid port')
})
})
Why the bad version is wrong:
Characteristics of a good unit test:
tools
Field-tested engineering principles. Apply when writing, modifying, or reviewing code. Emphasizes verification over assumption, scope discipline, root cause analysis, staying current, and automation. These principles are distilled from real project experience and hundreds of debugging sessions.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.