本文へ移動
cccskills
無料GitHub で公開

complexity-check

Find overly complex code: files over 300 lines, functions over 50 lines, deeply nested conditions (4+ levels), and magic numbers. Use for code quality reviews, pre-release checks, or when asked to assess code maintainability.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md3.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Check the codebase for complexity violations.

Changed files

!git diff --name-only HEAD~1 2>/dev/null || git diff --name-only origin/main...HEAD 2>/dev/null || echo "all"

Focus on the changed files listed above. If "all", check the entire codebase.

Check 1: Large files

Find source files over 300 lines (exclude node_modules, dist, .git, vendor, coverage, build):

find . \( -name "*.py" -o -name "*.ts" -o -name "*.js" -o -name "*.tsx" -o -name "*.jsx" -o -name "*.go" -o -name "*.rb" \) \
  -not -path "*/node_modules/*" \
  -not -path "*/dist/*" \
  -not -path "*/.git/*" \
  -not -path "*/vendor/*" \
  -not -path "*/coverage/*" \
  -not -path "*/build/*" \
  | xargs wc -l 2>/dev/null | sort -rn | head -20

Flag any file with more than 300 lines.

Check 2: Long functions

Read each changed source file (or sample the largest files if "all"). Scan for function or method definitions and estimate the line count between consecutive definitions. Flag any function that appears to span more than 50 lines.

Look for these definition patterns:

  • Python: def or async def
  • TypeScript/JavaScript: function , async function , => {, ): void {, ): Promise<
  • Go: func
  • Ruby: def

If a definition is followed by the next definition more than 50 lines later, flag the first function.

Check 3: Deep nesting

Search changed files for lines with 4 or more levels of indentation inside conditional or loop structures. Use these grep patterns (adjust for tab vs space indentation):

For 4-space indentation (16+ spaces):

grep -n "^                " <file>

For tab indentation (4+ tabs):

grep -n "^\t\t\t\t" <file>

Flag files where deeply nested lines appear inside if, for, while, or switch blocks.

Check 4: Magic numbers

Search changed files for numeric literals (other than 0, 1, -1, 2, 100, 1000) used directly in conditions or calculations without a named constant. Look for patterns like:

  • if x > 42:
  • * 3600
  • % 7 ==
  • timeout = 30

Exclude test files and configuration files where literal values are expected.

Output format

Output exactly:

COMPLEXITY FINDINGS:
- <file>:<line> — <description>

Examples:

COMPLEXITY FINDINGS:
- src/auth/handler.ts:1 — file is 412 lines (limit: 300)
- src/auth/handler.ts:87 — function processLogin is approximately 63 lines (limit: 50)
- src/utils/parser.py:145 — 5 levels of nesting detected
- src/config.ts:23 — magic number 86400 (consider: SECONDS_PER_DAY)

If no findings: output exactly COMPLEXITY FINDINGS: none

Do not add any prose before or after the findings block.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Write an Architecture Decision Record (ADR) document for a technical decision. Use when documenting a technical choice, architectural decision, or design decision.

日本語の概要は準備中です。原文の説明を表示しています。

davila7/claude-with-skills132026年5月15日 更新

REST API design conventions for this codebase. Use when writing or reviewing API endpoints, route definitions, response formatting, or client code that calls the API.

日本語の概要は準備中です。原文の説明を表示しています。

davila7/claude-with-skills132026年5月15日 更新

Automatically format code files after every edit using Prettier and ESLint. Active in the background whenever Claude edits a file. Formatting is silent — no prompts, no output unless a formatter fails. Use when you want consistent formatting enforced automatically during a coding session.

日本語の概要は準備中です。原文の説明を表示しています。

davila7/claude-with-skills132026年5月15日 更新

Create a git branch named after a GitHub issue.

日本語の概要は準備中です。原文の説明を表示しています。

davila7/claude-with-skills132026年5月15日 更新

Draft the changelog entry for all unreleased commits in Keep a Changelog format. Groups commits into Added, Changed, Fixed, Removed, and Security. Use before releasing a new version or when updating CHANGELOG.md.

日本語の概要は準備中です。原文の説明を表示しています。

davila7/claude-with-skills132026年5月15日 更新

Draft a CHANGELOG.md entry for the current changes in Keep a Changelog format. Use when releasing, tagging a version, or updating CHANGELOG.md.

日本語の概要は準備中です。原文の説明を表示しています。

davila7/claude-with-skills132026年5月15日 更新

davila7 のスキルをすべて見る

このスキルの問題を報告する