# code-review

Adopt this skill: https://proskills.md/skills/other/kyegomez-swarms-examples-single-agent-capabilities-skills-code-review

Page: https://proskills.md/skills/other/kyegomez-swarms-examples-single-agent-capabilities-skills-code-review
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: examples/single_agent/capabilities/skills/code-review/SKILL.md
size: 2767
upstream: https://github.com/kyegomez/swarms/blob/master/examples/single_agent/capabilities/skills/code-review/SKILL.md

````text
---
name: code-review
description: Perform comprehensive code reviews focusing on best practices, security vulnerabilities, performance optimization, and maintainability
---

# Code Review Skill

When reviewing code, follow this systematic approach to ensure thorough evaluation:

## Review Checklist

### 1. Code Quality
- **Readability**: Is the code easy to understand?
- **Naming**: Are variables, functions, and classes well-named?
- **Structure**: Is the code properly organized and modular?
- **Comments**: Are complex sections adequately documented?
- **Complexity**: Are there overly complex functions that should be simplified?

### 2. Security Analysis
Check for common vulnerabilities:
- SQL injection vulnerabilities
- XSS (Cross-Site Scripting) vulnerabilities
- Authentication and authorization flaws
- Insecure data handling (passwords, sensitive data)
- Input validation and sanitization
- OWASP Top 10 vulnerabilities

### 3. Performance Considerations
- Identify potential bottlenecks
- Check for inefficient algorithms or data structures
- Look for unnecessary database queries or API calls
- Evaluate caching opportunities
- Assess memory usage patterns

### 4. Best Practices
- **DRY Principle**: Eliminate code duplication
- **SOLID Principles**: Verify adherence to design principles
- **Error Handling**: Check for proper exception handling
- **Testing**: Evaluate test coverage and quality
- **Dependencies**: Review external dependencies and their versions

### 5. Maintainability
- Is the code easy to modify and extend?
- Are there proper abstractions?
- Is the architecture scalable?
- Are there technical debt concerns?

## Review Format

Structure your review as follows:

1. **Summary**: High-level overview of the changes
2. **Critical Issues**: Security vulnerabilities or bugs that must be fixed
3. **Major Concerns**: Significant issues affecting quality or performance
4. **Suggestions**: Optional improvements and best practices
5. **Positive Feedback**: Acknowledge good practices and improvements

## Guidelines

- Be constructive and respectful
- Provide specific examples and suggestions
- Explain the "why" behind recommendations
- Prioritize issues by severity (critical, major, minor)
- Reference documentation or standards when applicable
- Consider the context and constraints of the project

## Example Reviews

**Security Issue:**
```
CRITICAL: SQL injection vulnerability detected at line 45
Current: f"SELECT * FROM users WHERE id = {user_id}"
Recommendation: Use parameterized queries to prevent SQL injection
```

**Performance Suggestion:**
```
SUGGESTION: Consider caching database results at line 123
The same query is executed multiple times in the loop. Cache the results
to improve performance by ~80%.
```
````

## File: README.md
upstream: https://github.com/kyegomez/swarms/blob/master/README.md

````text
<div align="left">
  <a href="https://swarms.world">
    <img src="https://github.com/kyegomez/swarms/blob/master/images/new_logo.png" style="margin: 15px; max-width: 350px" width="70%" alt="Logo">
  </a>
</div>

<p align="left">
  <!-- Main Navigation Links -->
  <a href="https://swarms.ai">Swarms Website</a>
  <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
  <a href="https://docs.swarms.world">Documentation</a>
  <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
  <a href="https://swarms.world">Swarms Marketplace</a>
  <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
  <a href="./README_zh.md">中文</a>
</p>

<p align="left">
  <a href="https://pypi.org/project/swarms/" target="_blank">
    <picture>
      <source srcset="https://img.shields.io/pypi/v/swarms?style=for-the-badge&color=3670A0" media="(prefers-color-scheme: dark)">
      <img alt="Version" src="https://img.shields.io/pypi/v/swarms?style=for-the-badge&color=3670A0">
    </picture>
  </a>
  <a href="https://pypi.org/project/swarms/" target="_blank">
    <picture>
      <source srcset="https://img.shields.io/pypi/dm/swarms?style=for-the-badge&color=3670A0" media="(prefers-color-scheme: dark)">
      <img alt="Downloads" src="https://img.shields.io/pypi/dm/swarms?style=for-the-badge&color=3670A0">
    </picture>
  </a>
  <a href="https://twitter.com/swarms_corp/">
    <picture>
      <source srcset="https://img.shields.io/badge/Twitter-Follow-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white" media="(prefers-color-scheme: dark)">
      <img src="https://img.shields.io/badge/Twitter-Follow-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white" alt="Twitter">
    </picture>
  </a>
  <a href="https://discord.gg/EamjgSaEQf">
    <picture>
      <source srcset="https://img.shields.io/badge/Discord-Join-5865F2?style=for-the-badge&logo=discord&logoColor=white" media="(prefers-color-scheme: dark)">
      <img src="https://img.shields.io/badge/Discord-Join-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord">
    </picture>
  </a>
</p>

## Overview

>
> Swarms, The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework 

Build, deploy, and scale high-performance multi-agent systems with Swarms Python, a fast, flexible, and optimized agent framework. Featuring production-ready harnesses for sequential, concurrent, and hierarchical architectures, seamless framework compatibility, and integrations with MCP, x402, and skills.

## Install

```bash
# pip
$ pip3 install -U swarms

# uv (recommended): https://github.com/astral-sh/uv
$ uv pip install swarms

# poetry
$ poetry add swarms
```

### From source

```bash
# Clone the repository
$ git clone https://github.com/kyegomez/swarms.git
$ cd swarms
$ pip install -r requirements.txt
```

### Faster model calls and graphs with `swarms[fast]`

`swarms[fast]` adds two optional speedups:

- [RouteHub](https://github.com/The-Swarm-Corporation/RouteHub) for faster model calls through a drop-in LLM gateway. No code changes needed. To switch back to litellm, set `SWARMS_LLM_BACKEND=litellm`.
- [rustworkx](https://github.com/Qiskit/rustworkx), a graph library written in Rust, for faster `GraphWorkflow` graphs. Turn it on with `GraphWorkflow(backend="rustworkx")`.

```bash
$ pip3 install -U "swarms[fast]"
```

### Using Docker

The official image, [`swarmscorp/swarms`](https://hub.docker.com/r/swarmscorp/swarms) on Docker Hub, has swarms and its CLI installed on Python 3.13, for `linux/amd64` and `linux/arm64`.

```bash
# Pull the image
$ docker pull swarmscorp/swarms:latest

# Run a script from the current directory, passing your API key from the shell
$ docker run --rm -e OPENAI_API_KEY -v "$PWD:/app" swarmscorp/swarms python agent.py

# Open a Python shell with swarms installed
$ docker run -it --rm -e OPENAI_API_KEY swarmscorp/swarms
```

To build the image yourself, run `docker build -t swarms .` from the repository root.

---

## Environment Configuration

[Learn more about the environment configuration here](https://docs.swarms.world/environment-setup)

```
OPENAI_API_KEY=""
WORKSPACE_DIR="agent_workspace"
ANTHROPIC_API_KEY=""
GROQ_API_KEY=""
SWARMS_TELEMETRY_ON
```

### Your First Agent

An **Agent** is the fundamental building block of a swarm: an autonomous entity powered by an LLM + Tools + Memory. [Learn more Here](https://docs.swarms.world/api/agent)

```python
from swarms import Agent

# Initialize a new agent
agent = Agent(
    model_name="gpt-5.4", # Specify the LLM
    max_loops="auto",              # Set the number of interactions
    interactive=True,         # Enable interactive mode for real-time feedback
    temperature=None,
)

# Run the agent with a task
agent.run("What are the key benefits of using a multi-agent system?")
```

### Autonomous Agent with `max_loops="auto"`

Setting `max_loops="auto"` lets the agent decide for itself when the task is complete. It keeps reasoning and acting until it reaches a stopping condition, rather than halting after a fixed number of iterations. This is the recommended mode for open-ended, multi-step tasks where the number of steps isn't known in advance.

```python
from swarms import Agent

agent = Agent(
    agent_name="Autonomous-Research-Agent",
    agent_description="An autonomous agent that conducts multi-step research independently.",
    system_prompt=(
        "You are an autonomous research agent. Break down complex tasks into steps, "
        "execute each step thoroughly, and signal completion only when the full task is done."
    ),
    model_name="gpt-5.4",
    max_loops="auto",       # Agent decides when it's done; no fixed iteration cap
    autosave=True,
    verbose=True,
)

# The agent will keep looping (planning, executing, and reflecting) until it
# determines the task is fully complete.
result = agent.run(
    "Research the current state of quantum computing, identify the top three "
    "hardware approaches, and summarize the key challenges each faces."
)
print(result)
```

Use `max_loops="auto"` for open-ended research, iterative refinement, or any task where the number of steps depends on intermediate results. Use a fixed `max_loops` value for latency- or cost-sensitive production pipelines and tasks with a well-defined number of steps.

## MCP Integration

Set `mcp_url` or `mcp_urls` and an agent picks up tools from one or more [MCP](https://modelcontextprotocol.io) servers. Public servers such as [DeepWiki](https://mcp.deepwiki.com/mcp) work out of the box.

```python
from swarms import Agent

agent = Agent(
    agent_name="MCP-Agent",
    model_name="claude-sonnet-5",
    mcp_url="https://mcp.deepwiki.com/mcp",
    max_loops=1,
    temperature=None,
    max_tokens=16_000,
    reasoning_effort=None,
)

print(
    agent.run(
        "Use your tools to explain what the kyegomez/swarms repository does."
    )
)
```

### Serve an Agent as an MCP Server

The reverse direction works too. `MCPDeployer` turns any agent, or any swarm, into an MCP server that other agents and MCP hosts can call, with an auth layer in front of it. Each target becomes one tool; pass a list or a dict to serve several from one server. [See the MCPDeployer examples](examples/mcp/mcp_deployer/)

```python
from swarms import Agent, MCPDeployer

researcher = Agent(
    agent_name="Researcher",
    agent_description="Answers research questions with a short summary.",
    model_name="gpt-5.4",
    max_loops=1,
)

# Serves http://127.0.0.1:8000/mcp as the tool "researcher".
MCPDeployer(researcher, api_keys=["sk-local-dev"], port=8000).run()
```

Any other agent can then use it by pointing at the URL with the key:

```python
from swarms import Agent
from swarms.schemas.mcp_schemas import MCPConnection

client = Agent(
    agent_name="Client",
    model_name="gpt-5.4",
    mcp_url=MCPConnection(url="http://127.0.0.1:8000/mcp", api_key="sk-local-dev"),
    max_loops=2,
)
client.run("Use the researcher tool to summarise the state of solid-state batteries.")
```

### Your First Swarm: Multi-Agent Collaborati
````
