Reviewer · Documentation
Accurate, self-explanatory code examples
When updating or adding code snippets in docs (e.g., CLAUDE.md), ensure the example stays fully consistent with the surrounding prose, uses the stable/public API, and explains any non-obvious but required configuration.
When updating or adding code snippets in docs (e.g., CLAUDE.md), ensure the example stays fully consistent with the surrounding prose, uses the stable/public API, and explains any non-obvious but required configuration.
Specifically:
- If the prose describes a behavior (e.g., “each agent runs for many loops”), the snippet must demonstrate the corresponding parameter (e.g.,
loops_per_agent=5). If the parameter name changed or moved, update both the snippet and the prose together so they never drift apart. - Only import from the library’s public/top-level API in examples. If the public re-export is missing and you must reference an internal module path (e.g.,
from swarms.structs.planner_worker_swarm import PlannerWorkerSwarm), add a short note that this is a temporary workaround pending the proper export, and cross-check other docs (tables, indexes) that might imply the public path is already available. - When a snippet includes a parameter or setting that is required for the example to work but isn’t obvious (e.g.,
streaming_on=Trueneeded for a streaming callback to fire), add a one-line comment explaining why it’s needed, e.g.:
# Agents must set streaming_on=True for streaming_callback to fire
agent = Agent(..., streaming_on=True)
This keeps examples copy-paste runnable, prevents silent breakage from refactors, and saves readers from reverse-engineering behavior that should be documented explicitly.</description>