skills/refactoring/simplifying-method-calls/SKILL.md
Improve method interfaces by renaming, separating queries from modifiers, and introducing parameter objects. Trigger: When cleaning up method signatures, implementing CQRS, or reducing parameter lists.
npx skillsauth add johnnystefan/test-saas-business refactoring/simplifying-method-callsInstall 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.
This skill enables the agent to improve the interfaces of class methods. By simplifying how methods are called and what they return, the agent reduces the mental load for developers and makes the system's internal API more intuitive and robust.
createOrder(), renderCustomerInfo()).private or protected to reduce the public surface area.setHeight(val) instead of setValue('height', val)).DateRange instead of separate start and end dates).-1), throw specific exceptions to separate normal execution flow from error handling.// BEFORE: Method gets data AND changes state (side effect)
getTotalOutstandingAndSetReady(): number {
this.isReady = true; // Modifier
return this.calculateTotal(); // Query
}
// AFTER: Responsibilities split
getTotalOutstanding(): number {
return this.calculateTotal();
}
setReady(): void {
this.isReady = true;
}
// BEFORE: Repeating group of parameters
amountInvoicedIn(start: Date, end: Date): number { /* ... */ }
amountOverdueIn(start: Date, end: Date): number { /* ... */ }
// AFTER: Parameters grouped into an immutable object
class DateRange {
constructor(
public readonly start: Date,
public readonly end: Date
) {}
}
amountInvoicedIn(range: DateRange): number { /* ... */ }
amountOverdueIn(range: DateRange): number { /* ... */ }
// BEFORE: Returning special values for errors
withdraw(amount: number): number {
if (amount > this.balance) return -1;
this.balance -= amount;
return 0;
}
// AFTER: Using proper exception handling
withdraw(amount: number): void {
if (amount > this.balance) {
throw new InsufficientFundsError();
}
this.balance -= amount;
}
tools
Zustand 5 state management patterns. Trigger: When implementing client-side state with Zustand (stores, selectors, persist middleware, slices).
databases
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.
development
Vitest unit testing patterns with React Testing Library. Trigger: When writing unit tests for React components, hooks, or utilities.
tools
Vite 8 (Rolldown-powered) build tool configuration, plugin API, SSR, and migration guide. Trigger: When working with vite.config.ts, Vite plugins, building libraries, or SSR apps with Vite.