CLSkills
Testingbeginner

Test Naming Fixer

Share

Rename tests to follow 'should...when...' convention

Test Naming Fixer

Rename tests to follow 'should...when...' convention

Rename tests to follow consistent naming conventions.

Instructions

  1. Scan all test files for inconsistent naming:
grep -rn "it(\|test(" tests/ --include="*.test.*"
  1. Apply the should [expected behavior] when [condition] pattern:

Before → After:

"login test"               → "should redirect to dashboard when credentials are valid"
"handles empty array"      → "should return empty result when input array is empty"
"createUser"               → "should create user with default role when role not specified"
"error case"               → "should throw ValidationError when email is invalid"
"it works"                 → "should return computed total when given valid line items"
  1. Fix describe block naming:
// Bad: describe('tests')
// Good: describe('UserService')  or  describe('POST /api/users')
  1. Search and replace across all test files.

Rules

  • describe: name of the unit being tested (class, function, endpoint)
  • it/test: should [verb] [expected] when [condition]
  • No implementation details in test names — describe behavior

Quick Info

CategoryTesting
Difficultybeginner
Version1.0.0
AuthorClaude Skills Hub
testingnamingconventions

Install command:

curl -o ~/.claude/skills/test-naming-fixer.md https://claude-skills-hub.vercel.app/skills/testing/test-naming-fixer.md