Use names that clearly convey purpose and maintain consistency across related components. Avoid generic identifiers (like `dir`) in favor of descriptive ones (like `codex_home`), and ensure placeholder names in string templates are self-explanatory (prefer `SUMMARY_TEXT` over `{}`). For related functions or elements, establish consistent naming patterns...
Use names that clearly convey purpose and maintain consistency across related components. Avoid generic identifiers (like dir
) in favor of descriptive ones (like codex_home
), and ensure placeholder names in string templates are self-explanatory (prefer SUMMARY_TEXT
over {}
). For related functions or elements, establish consistent naming patterns with meaningful symmetry, particularly for operations that are conceptually opposite.
When naming variables, functions, or constants:
openai_request_max_retries
when it applies to all providers)fully_qualified_tool_name()
, its counterpart should be parse_fully_qualified_tool_name()
)Example:
// Poor naming
const TEMPLATE: &str = "Summary: {}";
fn get_name(s: &str, t: &str) -> String { /* ... */ }
fn extract(name: &str) -> (&str, &str) { /* ... */ }
// Better naming
const SUMMARY_TEMPLATE: &str = "Summary: {SUMMARY_TEXT}";
fn fully_qualified_tool_name(server: &str, tool: &str) -> String { /* ... */ }
fn parse_fully_qualified_tool_name(name: &str) -> (&str, &str) { /* ... */ }
Enter the URL of a public GitHub repository