Advanced code review skill with multi-language support and best practices enforcement
Performs comprehensive code reviews across multiple languages, detecting bugs, security vulnerabilities, and quality issues. Triggers when analyzing code files, reviewing pull requests, or optimizing existing codebases.
/plugin marketplace add trilogy-group/swarm-claude-plugin/plugin install devops-assistant@swarm-claude-pluginThis skill inherits all available tools. When active, it can use any tool Claude has access to.
The Code Reviewer skill provides comprehensive code analysis capabilities across multiple programming languages, enforcing best practices, identifying bugs, and suggesting improvements.
{
"code_reviewer": {
"enabled": true,
"languages": {
"javascript": {
"linter": "eslint",
"config": ".eslintrc.json",
"rules": {
"complexity": {"max": 10},
"line_length": {"max": 100},
"function_length": {"max": 50}
}
},
"python": {
"linter": "pylint",
"config": ".pylintrc",
"rules": {
"complexity": {"max": 10},
"line_length": {"max": 120},
"function_length": {"max": 50}
}
}
},
"security": {
"enabled": true,
"scanners": ["semgrep", "bandit", "snyk"]
},
"performance": {
"enabled": true,
"profiling": true
},
"reporting": {
"format": ["json", "markdown", "html"],
"include_suggestions": true,
"severity_threshold": "warning"
}
}
}
// Input code to review
function calculatePrice(items) {
let total = 0;
for(var i = 0; i < items.length; i++) {
total = total + items[i].price * items[i].quantity;
}
return total;
}
## Code Review Results
### Issues Found: 3
#### 1. Use Modern JavaScript Syntax (Style)
**Line 3**: Use `const` or `let` instead of `var`
```diff
- for(var i = 0; i < items.length; i++) {
+ for(let i = 0; i < items.length; i++) {
Lines 3-5: Use reduce() for better readability and performance
function calculatePrice(items) {
return items.reduce((total, item) =>
total + item.price * item.quantity, 0
);
}
Line 1: Add validation for undefined/null input
function calculatePrice(items) {
if (!items || !Array.isArray(items)) {
throw new Error('Invalid input: items must be an array');
}
// ... rest of function
}
## Advanced Features
### Multi-file Analysis
```python
# Example: Analyzing Python module dependencies
class CodeAnalyzer:
def analyze_imports(self, file_path):
"""Analyze import statements for circular dependencies"""
imports = self.extract_imports(file_path)
circular_deps = self.detect_circular_deps(imports)
unused_imports = self.find_unused_imports(imports)
return {
'circular_dependencies': circular_deps,
'unused_imports': unused_imports,
'import_depth': self.calculate_import_depth(imports)
}
// Detects and validates design pattern implementations
public class PatternDetector {
public List<Pattern> detectPatterns(String code) {
List<Pattern> patterns = new ArrayList<>();
if (isSingleton(code)) {
patterns.add(new Pattern("Singleton",
validateSingleton(code)));
}
if (isFactory(code)) {
patterns.add(new Pattern("Factory",
validateFactory(code)));
}
return patterns;
}
}
integration:
security_reviewer:
trigger: "on_code_change"
actions:
- scan_vulnerabilities
- check_dependencies
- validate_authentication
integration:
performance_tester:
trigger: "on_optimization_suggestion"
actions:
- benchmark_before
- apply_optimization
- benchmark_after
- report_improvement
// custom-rules.js
module.exports = {
rules: {
'no-console-log': {
create(context) {
return {
CallExpression(node) {
if (node.callee.type === 'MemberExpression' &&
node.callee.object.name === 'console' &&
node.callee.property.name === 'log') {
context.report({
node,
message: 'console.log should not be used in production'
});
}
}
};
}
}
}
};
{
"extends": ["airbnb", "plugin:@typescript-eslint/recommended"],
"rules": {
"max-len": ["error", 100],
"complexity": ["error", 10],
"no-unused-vars": "error"
}
}
[MESSAGES CONTROL]
max-line-length=120
max-complexity=10
min-public-methods=1
[DESIGN]
max-args=5
max-attributes=10
max-statements=50
| Language | Files/Second | Avg Time per File | Memory Usage |
|---|---|---|---|
| JavaScript | 50 | 20ms | 50MB |
| Python | 40 | 25ms | 60MB |
| Java | 30 | 33ms | 80MB |
| Go | 60 | 17ms | 40MB |
| Rust | 45 | 22ms | 55MB |
Review code changes incrementally rather than entire codebases:
@code-review --changes-only --since=last-commit
Integrate with pull request workflows:
on: [pull_request]
jobs:
code-review:
runs-on: ubuntu-latest
steps:
- uses: claude/code-reviewer@v1
with:
severity: warning
auto-fix: true
Configure severity based on environment:
{
"environments": {
"development": {"severity": "info"},
"staging": {"severity": "warning"},
"production": {"severity": "error"}
}
}
Slow Analysis
--files flag.codereviewignore fileFalse Positives
Missing Language Support
interface AnalyzeOptions {
language: string;
rules?: RuleSet;
severity?: 'error' | 'warning' | 'info';
autoFix?: boolean;
}
interface AnalyzeResult {
issues: Issue[];
metrics: Metrics;
suggestions: Suggestion[];
autoFixed?: boolean;
}
interface Issue {
severity: 'error' | 'warning' | 'info';
rule: string;
message: string;
line: number;
column: number;
suggestion?: string;
autoFixable: boolean;
}
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.