Auditing Your Code

Cleaning up naming

Premium episode

This episode is included with faster. membership.

Unlock with membership

Episode 7

Cleaning up naming

4:53PREMIUM

The speaker discusses an "audit names" command that automates a previously manual process of code cleanup. This command aims to improve code consistency and readability, which is especially important for AI coding agents that lack the historical context humans possess. The command checks for generic names, single-letter variables, inconsistencies, and abbreviations.

Specific examples include:

  • Adding "is" prefixes to Boolean variables (e.g., changing "active" to "isActive").
  • Converting negative Booleans to positive ones (e.g., changing "hasUnmapped" to "isMappable").
  • Standardizing component names (e.g., changing "icon BTN" to "icon button").
  • Making single-letter variables explicit, even in filter chains.
  • Extracting magic strings into constants.

The speaker finds some of the issues identified by the audit command to be minor but ultimately beneficial to address. The speaker suggests running the audit command, especially on large, long-running projects, and scoping it to specific modules if necessary. The recommendation is to generally use the command in "plan mode" to allow the system to automatically fix the issues, emphasizing the ease and benefit of letting machines handle these tasks.