domains / / strands-agents/sdk-python
Use descriptive names
Choose names that clearly convey purpose and intent rather than generic or ambiguous terms. Names should be specific enough to understand functionality without requiring additional context.
Choose names that clearly convey purpose and intent rather than generic or ambiguous terms. Names should be specific enough to understand functionality without requiring additional context.
Avoid generic names:
- Don’t use generic terms like
utils,helpers, orbasewhen more specific alternatives exist - Instead of
class Executor, useclass ConcurrentExecutororclass SequentialExecutor - Replace generic file names like
utils.pywith specific names likevalidation.pyorformatting.py
Use semantically meaningful names:
- Method names should clearly indicate their action:
serialize_state()anddeserialize_state()instead of ambiguous alternatives - Variable names should reflect their content:
next_nodes_to_execute(plural) instead ofnext_node_to_executewhen referring to multiple items - Parameter names should be self-documenting:
timeoutinstead oftimeout_secondswhen accepting atimedeltaobject
Choose appropriate specificity:
- Be specific enough to avoid confusion:
get_agent_card()instead of the vague_discover_agent_card() - Balance verbosity with clarity:
name_overrideinstead of the verboseagent_facing_tool_name - Use domain-specific terminology:
output_typeinstead ofstructured_output_typewhen the context makes “structured” redundant
Example:
# Avoid generic names
class Executor: # Too generic
pass
# Use descriptive names
class ConcurrentToolExecutor: # Clear purpose and scope
def serialize_state(self) -> dict: # Clear action
pass
def get_next_nodes(self) -> list[str]: # Clear return type
pass
This approach improves code readability and reduces the need for additional documentation to understand component purposes.