agent-complexity-optimizer
A general-purpose code complexity optimization scanner supporting 13+ AI agents
Install & Use
Copy this prompt and send it to your AI assistant (Claude / Cursor / TRAE / Codex / WorkBuddy etc.) to auto-install:
Help me install this AI Skill: agent-complexity-optimizer. It is used for: A general-purpose code complexity optimization scanner supporting 13+ AI agents Full Skill content: https://321skill.com/skills/agent-complexity-optimizer/raw/index.md Read that page and install it.
The prompt includes a link to the full Skill content. You can also view the full content.
This Skill addresses the challenge developers face in identifying hidden performance bottlenecks during coding. In practice, teams often encounter severe performance degradation under high concurrency due to inefficient patterns like nested loops, N+1 queries, and sorting within loops, which are easily missed during manual code reviews. This tool automatically scans the entire codebase, precisely pinpoints O(n²) hotspots and code segments with excessive complexity, and provides structured remediation suggestions, all without modifying any files.
Usage is straightforward. Simply execute npx agent-complexity-optimizer in your terminal. It will automatically detect the AI coding agents (such as Claude Code, Cursor, Windsurf, etc.) installed in your current environment and write the correct configuration format. For Claude Code users, it can also be installed directly via the plugin marketplace: /plugin marketplace add sebastianbreguel/agent-complexity-optimizer. You can then trigger an analysis using natural language commands like 'scan project complexity', which outputs a comprehensive report including severity levels, file locations, and optimization suggestions.
It is particularly well-suited for development teams or individual developers who need to continuously optimize code quality. This is especially true for teams already using multiple AI coding agents (like Claude Code, Codex, Copilot, etc.), as they can obtain complexity analysis through a single unified tool, avoiding the need to switch between different platforms. For backend developers, full-stack engineers, and agent developers, this tool can significantly reduce the risk of performance regressions during code reviews.
It is recommended to run this tool regularly during project iterations, such as before each commit or integrated into CI/CD pipelines. Please note that it primarily targets algorithmic complexity patterns (nested loops, N+1 queries, etc.) and is not a general-purpose code quality checker. For Python, it uses AST parsing; for other languages, it employs regex matching, which may result in a small number of false positives or false negatives. Manual verification alongside code review results is advised.
Key Features
Compared to similar tools like codex-complexity-optimizer, this tool supports 13+ AI coding agents (including Claude Code, Codex, Cursor, Windsurf, Copilot, etc.) and can automatically detect installed agents and write the correct configuration, eliminating the need for manual configuration for each tool.
Limitations
Requires a Node.js environment (npx or npm must be installed). For non-Python languages, it uses regex matching instead of AST parsing, which may result in lower detection accuracy for dynamic languages or complex nested scenarios compared to the AST-based approach.
FAQ
Which programming languages are supported?
Python uses AST parsing. For 20+ other languages including JavaScript/TypeScript/JSX/TSX/Java/Go/C/C++/C#/Ruby/PHP/Swift/Rust, regex matching is used. Additional languages (such as Lua, Zig, Elixir, etc.) are also supported.
How do I install it in Claude Code?
In Claude Code, execute: `/plugin marketplace add sebastianbreguel/agent-complexity-optimizer` followed by `/plugin install complexity-optimizer@complexity-optimizer`
Installation guide for AI assistants
If your AI coding assistant (Claude Code, Cursor, TRAE etc.) can see this page, send it this message to auto-install:
Visit https://321skill.com/skills/agent-complexity-optimizer/raw/index.md to read the original Skill definition (Markdown format) for agent-complexity-optimizer, and install it according to the instructions.
Raw Markdown URL for AI: /skills/agent-complexity-optimizer/raw/index.md