Complexity report

From berkcangumusisik/claude-code-practices · View interactive version

Complexity report is an AI agent skill from the GitHub repository berkcangumusisik/claude-code-practices. Reports cyclomatic complexity hotspots and refactoring suggestions

How to use this skill

Skill file

Complexity Report

Directory: $1 (or src/ if not specified)

  1. Find complex functions manually (no external tool needed):
# Functions longer than 50 lines
grep -n "^function \|^  [a-z].*(.*) {" ${1:-src}/**/*.ts 2>/dev/null | head -30

Read the top 10 largest files and functions.

  1. For each file over 300 lines or function over 40 lines:
  1. Rank by complexity and report:
Top 5 Complexity Hotspots:
  src/auth/middleware.ts:handleRequest()   CC: 18  Lines: 87
  src/api/router.ts:routeRequest()         CC: 14  Lines: 120
  ...

Refactoring recommendations:
  1. handleRequest() - extract 3 auth validation blocks into separate functions
  2. ...
  1. Offer to refactor the top offender.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.