plugins/v1tamins/skills/v1-complexity/SKILL.md
Use when reducing cognitive complexity, flattening nested code, or simplifying functions. Triggers on "reduce complexity", "simplify", "too nested".
npx skillsauth add v1-io/v1tamins v1-complexityInstall 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.
Refactor functions to reduce cognitive complexity score while maintaining identical behavior.
Typical invocations:
/v1-complexity [file:function]v1-complexity from the skills menu or use $v1-complexity [file:function]Examples:
/v1-complexity # Analyze current diff
/v1-complexity services/analyst/core/query.py # Analyze specific file
/v1-complexity query.py:process_result # Analyze specific function
In Codex, the slash examples below map directly to $v1-complexity ....
What increments complexity (+1 each):
if, else if, else, ternary operatorsfor, foreach, while, do whilecatchswitch, casegoto, break, continue (labeled)&&, || in conditionsNesting multiplier:
What's free (no increment):
Target: Keep cognitive complexity under 15 per function
# Before: Complexity 6
def calculate(data):
if data is not None: # +1
total = 0
for item in data: # +1 +1 (nested)
if item > 0: # +1 +2 (nested)
total += item * 2
return total
# After: Complexity 4
def calculate(data):
if data is None: # +1
return None
total = 0
for item in data: # +1
if item > 0: # +1 +1 (nested)
total += item * 2
return total
# Before: Complexity 5
def process_eligible_users(users):
for user in users: # +1
if ((user.is_active and # +1 +1 +1 +1
user.has_profile) or
user.age > 18):
user.process()
# After: Complexity 3
def process_eligible_users(users):
for user in users: # +1
if is_eligible_user(user): # +1 +1
user.process()
def is_eligible_user(user):
return (user.is_active and user.has_profile) or user.age > 18
Extract logical blocks into separate functions with single responsibilities.
Analyze the target function:
Preserve existing tests - understand coverage before changes
Refactor using strategies above:
Verify behavior - run existing tests
Add tests if needed - for new helper functions with complex logic
tools
Use when planning or synthesizing user tests for prototypes, mockups, clickable demos, product concepts, design flows, landing pages, or early product specs. Triggers on "test this prototype", "prototype testing", "user test plan", "validate this product idea", "test with users".
development
Use when creating a polished self-contained HTML page would help the user understand, compare, review, present, tune, or interact with information better than Markdown. Triggers on "make an HTML page", "HTML artifact", "nice HTML", "visual report", "interactive explainer", "one-page dashboard", "shareable page".
data-ai
Use when turning a textbook, PDF, blog post, article, paper, course, notes, transcript, or other source material into suggested agent skills or skill improvements. Triggers on "what skills could come from this", "extract skills from", "turn this into skills", "skill ideas from this source".
development
Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for large prs, new features/architectures, a deep code quality audit, or especially harsh maintainability review.