.claude/skills/ts-code-complexity-scanner/SKILL.md
Measures cyclomatic complexity, cognitive complexity, and function length across codebases to identify maintenance hotspots. Use when someone asks about code complexity, function length analysis, maintainability metrics, or needs to find the most complex parts of their codebase. Trigger words: complexity, cyclomatic, cognitive complexity, long functions, hotspots, maintainability index, code metrics.
npx skillsauth add eliferjunior/Claude code-complexity-scannerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill analyzes source code to measure cyclomatic complexity, cognitive complexity, and function length. It identifies the most complex functions and files in a codebase, helping teams focus refactoring efforts on the code that's hardest to maintain and most likely to harbor bugs.
Detect the primary language from file extensions and package files. Filter to source code only (exclude node_modules, vendor, dist, build, pycache, .git).
For each function/method, count:
if, elif/else if → +1 eachfor, while, do-while → +1 eachcase in switch (each case) → +1 eachcatch → +1&&, || in conditions → +1 each?: → +1More nuanced than cyclomatic — penalizes nesting:
Rank files by:
Present findings in three tiers:
User prompt:
Scan src/ for the most complex functions
Agent output:
Complexity Report — src/ (89 files scanned)
🔴 CRITICAL (complexity > 25)
src/billing/calculator.ts
calculateInvoiceTotal() Cyclomatic: 34 Cognitive: 48 Lines: 180
applyDiscountRules() Cyclomatic: 26 Cognitive: 31 Lines: 95
src/api/middleware/auth.ts
validateAndRefreshToken() Cyclomatic: 28 Cognitive: 35 Lines: 120
🟡 WARNING (complexity 15-25)
src/workers/sync.ts
reconcileRecords() Cyclomatic: 19 Cognitive: 24 Lines: 88
src/utils/validators.ts
validateAddress() Cyclomatic: 16 Cognitive: 18 Lines: 65
Summary:
Files scanned: 89 | Functions analyzed: 412
Average complexity: 6.8 | Median: 4
Functions above threshold: 14 (3.4%)
Recommended target: reduce critical functions below 15
User prompt:
What are the complexity hotspots in our Django app?
Agent output:
Complexity Hotspots — myapp/ (67 files)
Top 10 by Cyclomatic Complexity:
Rank Function CC Lines File
1 process_order() 38 340 views/checkout.py
2 generate_report() 27 210 reports/builder.py
3 sync_inventory() 24 180 tasks/inventory.py
4 parse_import_file() 22 150 importers/csv.py
5 calculate_shipping() 19 95 shipping/rates.py
Nesting depth violations (>4 levels):
views/checkout.py:142 — 6 levels deep in process_order()
reports/builder.py:89 — 5 levels deep in generate_report()
Recommended refactoring order: process_order() first (highest complexity,
most changed file per git history, 340 lines is 3x recommended max).
development
Expert guidance for Fireworks AI, the platform for running open-source LLMs (Llama, Mixtral, Qwen, etc.) with enterprise-grade speed and reliability. Helps developers integrate Fireworks' inference API, fine-tune models, and deploy custom model endpoints with function calling and structured output support.
development
Convert any website into clean, structured data with Firecrawl — API-first web scraping service. Use when someone asks to "turn a website into markdown", "scrape website for LLM", "Firecrawl", "extract website content as clean text", "crawl and convert to structured data", or "scrape website for RAG". Covers single-page scraping, full-site crawling, structured extraction, and LLM-ready output.
tools
Expert guidance for Firebase, Google's platform for building and scaling web and mobile applications. Helps developers set up authentication, Firestore/Realtime Database, Cloud Functions, hosting, storage, and analytics using Firebase's SDK and CLI.
development
When the user needs to build file upload functionality for a web application. Use when the user mentions "file upload," "image upload," "upload endpoint," "multipart upload," "presigned URL," "S3 upload," "file validation," "upload to cloud storage," or "accept user files." Handles upload endpoints, file validation (type, size, magic bytes), cloud storage integration, and upload status tracking. For image/video processing after upload, see media-transcoder.