Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

tl-complexity-assessmentTL 复杂性评估

Agent Skill

tl-complexity-assessment 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

275

周安装

11

GitHub Stars

公开资料未说明

下载量

89
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:tl-complexity-assessment(TL 复杂性评估)
来源仓库:https://github.com/toddlevy/tl-agent-skills
仓库路径:skills/tl-complexity-assessment
安装命令:
npx skills add https://github.com/toddlevy/tl-agent-skills --skill tl-complexity-assessment
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/toddlevy/tl-agent-skills --skill tl-complexity-assessment

简介

tl-complexity-assessment 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于研究检索类任务,可结合来源仓库和原始 README 核验具体用法。
  • 通过 npx skills add 命令从 GitHub 安装,支持主流 AI 宿主环境。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

tl-complexity-assessment

Find the files that need to be split up. Get a ranked, evidence-based list of complexity hotspots with specific refactoring recommendations.

Quick Start

For experienced users — run the scanner and get a report:

# Bash
./scripts/complexity-scan.sh src/

# PowerShell
.\scripts\complexity-scan.ps1 -TargetDir src/

For guided assessment — follow the phases below.


When to Use

  • "find complex files"
  • "what needs to be split up"
  • "assess complexity" / "code health check"
  • "find monoliths" / "find god files"
  • "identify refactoring candidates"
  • "this file is too big"
  • Before major refactoring efforts
  • When onboarding to a new codebase
  • Sprint planning for tech debt reduction

Do Not Use When

  • Looking for bugs (use debugging skills instead)
  • Assessing security vulnerabilities (use security audit)
  • Reviewing code style (use linting/formatting tools)
  • File is already small and focused (<150 lines, single responsibility)

Outcomes

  • Analysis: Ranked list of complexity hotspots with evidence and recommendations
  • Decision: Which files/modules to refactor first (ROI-based prioritization)
  • Artifact: Optional findings register (markdown) for tracking remediation
  • Next Steps: Clear refactoring recommendations for each finding

The Iron Law

NO COMPLEXITY CLAIMS WITHOUT EVIDENCE

Every finding must include file path, line count or metric, and specific observation.

What Good Looks Like

❌ BAD: "UserService.ts is too complex and should be refactored"

✅ GOOD: "UserService.ts (847 lines, 23 exports) mixes 4 concerns:
   - Authentication (lines 1-150)
   - Validation (lines 151-320)
   - API calls (lines 321-600)
   - Formatting (lines 601-847)

   Recommendation: Split into auth.ts, validation.ts, api.ts, formatters.ts
   Effort: E2 (4-8 hours) | Impact: High (imported by 12 files)"

Assessment Categories

Category 1: Size Indicators

IndicatorThresholdSeverity
File lines>500High
File lines300-500Medium
Function lines>50High
Function lines30-50Medium
Component lines>300High
Component lines150-300Medium

Category 2: Responsibility Indicators

IndicatorThresholdSeverity
Exports per file>10High
Exports per file6-10Medium
Classes per file>2High
Functions per file>15Medium

Category 3: Coupling Indicators

IndicatorThresholdSeverity
Import statements>20High
Import statements10-20Medium
Cross-domain imports>5 distinct domainsHigh
Circular dependenciesAnyCritical

Category 4: Cyclomatic Complexity Proxies

IndicatorThresholdSeverity
Nested conditionals>3 levels deepHigh
Switch cases>7 casesMedium
Ternary chains>2 chainedMedium
Callback depth>3 levelsHigh

Category 5: React-Specific Smells

IndicatorThresholdSeverity
useEffect hooks>3 per componentHigh
useEffect hooks2-3 per componentMedium
useState hooks>5 per componentMedium
Inline sub-componentsAnyMedium
Props count>7 propsMedium
Business logic in pageNon-trivialHigh

Category 6: Structural Smells

IndicatorPatternSeverity
God filesutils.ts, helpers.ts, common.ts, shared.tsHigh
Catch-all routers>10 routes inlineHigh
Mega schemas>10 unrelated tablesHigh
Mixed concernsAPI + UI in same fileMedium
Barrel bloatindex.ts >50 re-exportsMedium

Assessment Phases

Phase 1: Automated Discovery

Run these commands to gather metrics. Adapt paths to your project structure.

Find large files:

find src/ -name "*.ts" -o -name "*.tsx" | xargs wc -l 2>/dev/null | sort -rn | head -30

Count exports per file:

rg "^export " --type ts -c | sort -t: -k2 -rn | head -20

Count imports per file:

rg "^import " --type ts -c | sort -t: -k2 -rn | head -20

Find god files:

rg -l "utils|helpers|common|shared" --type ts --glob "!node_modules" | head -20

Find React components with many hooks:

rg "useEffect\(" --type tsx -c | sort -t: -k2 -rn | head -20

Find deeply nested conditionals:

rg "if.*if.*if" --type ts -l | head -20

Find files with many functions:

rg "^(export )?(async )?(function |const \w+ = )" --type ts -c | sort -t: -k2 -rn | head -20

Phase 2: Manual Analysis

For each candidate file from Phase 1:

  1. Read the file - Understand what it does
  2. Identify responsibilities - List distinct concerns
  3. Check coupling - What does it import from? What imports it?
  4. Assess cohesion - Do all parts serve a single purpose?
  5. Document evidence - File path, line count, specific observations

Phase 3: Scoring

Score each finding 0-10:

ScoreMeaning
0-2Acceptable - monitor only
3-4Low priority - refactor when convenient
5-6Medium priority - plan for refactor
7-8High priority - refactor soon
9-10Critical - blocking quality/velocity

Score Formula:

Score = (Severity × 2) + (Impact × 2) + (Effort_Inverse)

Where:

  • Severity: 1 (Low) to 3 (Critical)
  • Impact: 1 (isolated) to 3 (affects many files)
  • Effort_Inverse: 3 (easy fix) to 1 (hard fix)

Phase 4: Report

For each finding, report:

### [Rank] File: `path/to/file.ts`

**Score:** 8/10 | **Severity:** High | **Effort:** Medium

**Metrics:**
- Lines: 847
- Exports: 23
- Imports: 18 (from 6 domains)

**Observations:**
- Contains 4 unrelated responsibilities: auth, validation, API calls, formatting
- 3 useEffect hooks managing different concerns
- Imported by 12 other files

**Recommendation:**
Split into:
- `auth.ts` - Authentication utilities
- `validation.ts` - Form validation
- `api.ts` - API client functions
- `formatters.ts` - Display formatting

**Evidence:**
Lines 1-150: Auth functions
Lines 151-320: Validation schemas
Lines 321-600: API calls
Lines 601-847: Formatting utilities

Priority Matrix

ROI = Severity × (4 - Effort)

SeverityE0 (<1h)E1 (1-4h)E2 (4-8h)E3 (>8h)
Critical12 🔥9 🔥63
High8642
Medium4321

🔥 = Address first (ROI ≥ 9)


Red Flags - Stop and Reassess

If you catch yourself:

  • Claiming "this file is complex" without metrics
  • Recommending splits without identifying responsibilities
  • Skipping files because they "look fine"
  • Using vague terms like "too big" or "messy"
  • Recommending refactors without considering import impact

Return to Phase 1. Gather evidence.


Rationalizations (Do Not Skip)

RationalizationWhy It's WrongRequired Action
"File is large but organized"Organization doesn't fix responsibility sprawlIdentify distinct responsibilities, recommend splits
"It's a utility file, expected to be big"Utility files are complexity magnetsBreak into domain-specific utilities
"Would take too long to refactor"Note effort, still report findingDocument with E3 effort, let prioritization decide
"Tests would break"Tests prove the split pointsNote as consideration, not blocker
"Team knows this code"Tribal knowledge is tech debtDocument for bus factor mitigation

Time-Boxing Guidelines

Codebase SizeDiscoveryAnalysisTotal
Small (<10k LOC)30 min30 min1 hour
Medium (10-50k LOC)1 hour1 hour2 hours
Large (50k+ LOC)2 hours2 hours4 hours

When time expires: Document what you found. Mark incomplete areas with next actions.


Output Format

Provide a summary table followed by detailed findings:

## Complexity Assessment Summary

| Rank | File | Score | Severity | Recommendation |
|------|------|-------|----------|----------------|
| 1 | `src/utils/helpers.ts` | 9 | Critical | Split into 4 domain files |
| 2 | `src/components/Dashboard.tsx` | 8 | High | Extract 3 sub-components |
| 3 | `src/api/client.ts` | 7 | High | Separate by API domain |

### Top Finding Details
[Detailed findings for top 5-10 items]

Example Real Output

See Example Output for a worked-through assessment report (summary table, per-file score, observations, recommendations, evidence).

What To Do After Assessment

Once you have findings, here's how to act on them:

Immediate (This Sprint)

  1. Fix 🔥 Critical findings (ROI ≥ 9) - These block velocity
  2. Run tl-knip to remove dead exports before splitting
  3. Add tests for files you're about to split

Plan (Next Sprint)

  1. Create tickets for High-priority findings (score 7-8)
  2. Group related splits (e.g., all API files together)
  3. Estimate using the Effort column

Monitor (Ongoing)

  1. Re-run assessment monthly to catch new complexity
  2. Add complexity checks to PR reviews
  3. Set team threshold: "No new files over 300 lines without review"

Cognitive vs Cyclomatic Complexity

See Cognitive Complexity for the difference between cyclomatic and cognitive complexity, scoring rules, and ESLint/SonarJS integration.

Code Review Metrics

See Code Review Metrics for optimal PR size thresholds, review time budgets, and a CI complexity-gate workflow example.

Verification Checklist

Before completing assessment:

  • Ran automated discovery commands
  • Every finding has file path and line count
  • Every finding has specific observations (not vague)
  • Responsibilities identified for each split recommendation
  • Effort estimated for each recommendation
  • Priority calculated using ROI formula
  • Time-boxing respected
  • Summary table provided with top findings

Skill Resources

Automated Discovery

Run the scanner script for quick assessment:

# Bash
./scripts/complexity-scan.sh src/

# PowerShell
.\scripts\complexity-scan.ps1 -TargetDir src/

Reference Documentation

DocumentPurpose
references/react-patterns.mdReact hook limits, component size, inline sub-components
references/coupling-analysis.mdImport analysis, circular deps, dependency direction
references/refactoring-strategies.mdExtract function/module/component patterns

Load these references when deeper analysis is needed for a specific category.


Related Skills

  • tl-knip - Find unused exports (reduces false positives in export counts)
  • codebase-audit - Broader code health assessment
  • ui-audit - UI-specific complexity and drift detection
  • semgrep/skills/code-security - Security vulnerability detection (complementary to structural complexity)

References

Quilted Sources

Official Skills

First-Party Documentation

Academic/Industry

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.79%
按下载量换算31

Claude

30.46%
按下载量换算27

Cursor

16.13%
按下载量换算14

Gemini CLI

8.84%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills