Choose descriptive, domain-specific names that clearly communicate intent and prevent confusion. Avoid generic names when more specific alternatives exist, especially when working alongside similar types or concepts from external libraries.
Choose descriptive, domain-specific names that clearly communicate intent and prevent confusion. Avoid generic names when more specific alternatives exist, especially when working alongside similar types or concepts from external libraries.
Key principles:
StagehandPage
instead of Page
to distinguish from Playwright’s Page
)systemPrompt
instead of instructions
)StagehandContainer
for HTMLElement | Window
)Schema
to distinguish type definitions from runtime valuesExample:
// Avoid generic names that could cause confusion
export interface Page extends PlaywrightPage { ... }
// Use descriptive, domain-specific names
export interface StagehandPage extends PlaywrightPage { ... }
// Avoid ambiguous parameter names
function configure(instructions?: string) { ... }
// Use semantically clear names
function configure(systemPrompt?: string) { ... }
This approach makes code self-documenting and reduces cognitive load when working with multiple similar concepts or external dependencies.
Enter the URL of a public GitHub repository