Py Complexity
Analyzes Python code for cyclomatic complexity, highlighting potential issues and improving maintainability.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add py-complexity npx -- -y @trustedskills/py-complexity
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"py-complexity": {
"command": "npx",
"args": [
"-y",
"@trustedskills/py-complexity"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill analyzes Python code to determine its cyclomatic complexity. It provides a numerical score representing the potential difficulty of testing and maintaining the code, highlighting areas that may benefit from refactoring. The tool helps developers understand code structure and identify complex functions or modules.
When to use it
- Code Review: Quickly assess the complexity of new code submissions during peer reviews.
- Refactoring Planning: Identify which parts of a codebase are most ripe for simplification and improvement.
- Testability Assessment: Gauge how difficult it will be to write comprehensive unit tests for specific functions or modules.
- Onboarding New Developers: Help new team members understand the structure and potential pitfalls within an existing project.
Key capabilities
- Calculates cyclomatic complexity score.
- Identifies complex code sections.
- Provides insights into code maintainability.
Example prompts
- "Analyze the complexity of this Python function: [code snippet]"
- "What's the cyclomatic complexity of
my_module.py?" - "Show me the most complex functions in my project."
Tips & gotchas
- The skill requires a valid Python environment to execute. Ensure necessary dependencies are installed before use.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.