cognitive-review

Audit code for cognitive load and readability across languages.

1|Updated Oct 17, 2025
One-click install
npx skills add https://github.com/tarrragon/claude --skill cognitive-review
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cognitive-review
Source: https://github.com/tarrragon/claude/tree/main/skills/cognitive-load-review
Command: npx skills add https://github.com/tarrragon/claude --skill cognitive-review

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

認知負擔 Code Review 工具旨在讓審查過程專注於降低未來維護者的認知成本,而不僅僅找出表面錯誤。透過系統化的審查維度,協助審查者在變數追蹤、呼叫層級、命名品質、條件分支、函式長度與參數複雜度等方面做出量化與可執行的改進建議。

Core Features & Use Cases

  • 變數狀態追蹤:評估閱讀者需要同時記住多少變數的狀態,並給出維持或分解的建議。
  • 呼叫層級追蹤:評估理解路徑需要多少層呼叫,提供扁平化或中介函式的建議。
  • 命名品質:檢查是否使用具體、自解的名稱,避免縮寫和模糊詞。
  • 條件分支與邏輯複雜度:評估條件分支數與巢狀深度,提供早期返回或重構的策略。
  • 函式長度與參數數量:評估單一函式的行數與參數數量,提出分解與參用物件的建議。
  • 審查輸出:輸出一份結構化的認知負擔報告,便於開發者追蹤與重構。

Quick Start

  • Example: cognitive-review path/to/your/code.py
  • 操作說明:向 AI 輸入你要審查的檔案路徑,系統將回傳符合認知負擔審查格式的報告。這份報告包含整體評估、熱點清單與重構建議。

Frequently Asked Questions about cognitive-review

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I evaluate cognitive load during a code review?

To evaluate cognitive load during a code review, you audit function length, nesting depth, boolean logic, and parameter count to identify readability hotspots. This generates a structured report with concrete refactor guidance to reduce future maintainers' cognitive costs.

What is the best way to refactor long functions and deep nesting?

The best way to refactor long functions and deep nesting is by applying early returns, flattening call hierarchies, and breaking down complex conditionals. Structural analysis enforces criteria for function length and nesting depth to provide actionable decomposition strategies.

How do I check code readability and naming quality across different languages?

Checking code readability and naming quality across languages involves scanning for unclear abbreviations and tracking variable state complexity. The audit evaluates whether names are self-explanatory and provides suggestions to improve clarity regardless of the programming language.

Can I assess boolean logic complexity and parameter count automatically?

Yes, you can assess boolean logic complexity and parameter count automatically by enforcing specific criteria thresholds. The review process identifies complex conditionals and suggests using parameter objects or breaking down functions to lower the overall cognitive burden.

When should I use a cognitive code review instead of a standard quality assessment?

You should use a cognitive code review instead of a standard quality assessment when your goal is to minimize future maintainers' cognitive costs rather than just finding surface errors. It systematically tracks variable states, call hierarchies, and branch complexity to output actionable refactoring reports.