lizard-complexity skill
✓ VerifiedAnalyze source code across 30+ languages to measure cyclomatic complexity, function length, and parameter counts for CI/CD quality gates.
- GitHub stars
- 13
- Files
- 2
- Last commit
- Nov 12, 2026
- License
- MIT
- Allowed tools
- —
What does the lizard-complexity skill do?
lizard-complexity analyzes source code across 30+ languages to measure cyclomatic complexity, function length, and parameter counts for CI/CD quality gates.
Summary generated from the skill's SKILL.md.
About the lizard-complexity skill
Measuring cyclomatic complexity and function length across polyglot codebases is what this skill enables for developers managing diverse repositories. It uses the Lizard tool to analyze over 30 languages, including Python, Java, C++, Rust, and TypeScript, to identify functions that have grown too large or complex to maintain. An agent should load this skill when a user needs to audit code quality, establish CI/CD quality gates, or find specific areas of a codebase that require refactoring.
The tool produces metrics such as non-comment lines of code, cyclomatic complexity (CCN), token counts, and parameter counts. Users can configure specific thresholds for CCN, maximum function length, and parameter limits to enforce strict coding standards. It supports exporting results to CSV, XML, or HTML formats, allowing for integration into automated pipelines or human-readable reports. While it provides detailed per-function metrics, it does not calculate cognitive complexity or provide per-class metrics for object-oriented code.
What an agent can do with it
- 1Audit complex legacy codeIdentify which functions in a large repository have the highest cyclomatic complexity before starting a refactor.
- 2Enforce CI/CD quality gatesSet up a continuous integration step that fails if functions exceed specific complexity or parameter count limits.
- 3Analyze polyglot repositoriesApply consistent complexity metrics across a project containing multiple different programming languages.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the lizard-complexity skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the lizard-complexity skill in Plugin
/plugin marketplace add testland/qa /plugin install qa-code-quality@testland-qa
Install the lizard-complexity skill in Claude Code
~/.claude/skills/lizard-complexity/SKILL.md
$ npx degit testland/qa/plugins/qa-code-quality/skills/lizard-complexity ~/.claude/skills/lizard-complexityInstall the lizard-complexity skill in Claude Code (project)
.claude/skills/lizard-complexity/SKILL.md
$ npx degit testland/qa/plugins/qa-code-quality/skills/lizard-complexity .claude/skills/lizard-complexityInstall the lizard-complexity skill in Codex
~/.agents/skills/lizard-complexity/SKILL.md
$ npx degit testland/qa/plugins/qa-code-quality/skills/lizard-complexity ~/.agents/skills/lizard-complexityInstall the lizard-complexity skill in Gemini CLI
~/.gemini/skills/lizard-complexity/SKILL.md
$ npx degit testland/qa/plugins/qa-code-quality/skills/lizard-complexity ~/.gemini/skills/lizard-complexityInstall the lizard-complexity skill in Claude.ai
npx degit testland/qa/plugins/qa-code-quality/skills/lizard-complexity lizard-complexity && zip -r lizard-complexity.zip lizard-complexity # claude.ai → Customize → Skills → + → Create skill → Upload a skill → lizard-complexity.zip
Automated checks
Ran Nov 15, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work
- Source repository linked and reachabletestland/qa/plugins/qa-code-quality/skills/lizard-complexity is public and reachablegithub.com/testland/qa/tree/HEAD/plugins/qa-code-quality/ski ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit 2026-11-12github.com/testland/qa/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/testland/qa/blob/HEAD/plugins/qa-code-quality/ski ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/testland/qa/blob/HEAD/plugins/qa-code-quality/ski ↗Pass
- SKILL.md follows the Agent Skills formatValid name and description; says when to use it; 129 linesgithub.com/testland/qa/blob/HEAD/plugins/qa-code-quality/ski ↗Pass
SKILL.md
View on GitHublizard-complexity
Lizard analyzes source code per function for NLOC (non-comment LoC), CCN (cyclomatic complexity), token count, and parameter count across 30+ languages including C/C++, Java, Python, JavaScript, Go, Rust, TypeScript, Swift, Kotlin (per the Lizard README). Default CCN warning threshold is 15.
When to use
- Polyglot codebase where per-language linters give inconsistent complexity metrics.
- Adding a CCN ceiling to CI without buying a commercial scanner.
- One-off audit of "where is the most complex code?" before a refactor.
Step 1 - Install
pip install lizard
Or run the standalone script:
python lizard.py path/to/code
Per the Lizard README, no external deps required.
Step 2 - Baseline scan
lizard src/
Default output groups by file with per-function NLOC/CCN/token/param counts. Default warning threshold: CCN ≥ 15.
Step 3 - Set production-only thresholds
lizard src/ \
-x"./tests/*" \
-x"./vendor/*" \
-C 10 \
-L 100 \
-a 5
| Flag | Meaning |
|---|---|
-x PATTERN |
Exclude (must include tests/** for production-only scope) |
-C N |
CCN warning threshold (default 15; tighten to 10 for new codebases) |
-L N |
Max function NLOC (default 1000; tighten to 80 - 100) |
-a N |
Max parameter count (5 = "if you need more, pass an object") |
Step 4 - CSV/XML for CI
# CSV for grep / jq pipelines
lizard src/ -x"./tests/*" -C 10 --csv > lizard.csv
# XML for CI parsers (cppncss-style)
lizard src/ -x"./tests/*" -C 10 -X > lizard.xml
# HTML for human review
lizard src/ -x"./tests/*" -C 10 -H > lizard.html
Step 5 - Fail CI on warnings
lizard src/ -x"./tests/*" -C 10 -L 100 -a 5 -w
EXIT=$?
if [ "$EXIT" -ne 0 ]; then
echo "Complexity threshold breached. See report."
exit 1
fi
-w prints warnings only (clang/gcc style). Lizard exits non-zero
when any function exceeds the configured threshold.
Step 6 - Per-language scope
# Only Python
lizard src/ -l python -C 10
# Only TypeScript + JS
lizard src/ -l typescript -l javascript -C 10
Useful when a polyglot repo has language-specific budgets (e.g., Python tolerates higher CCN than C).
Anti-patterns
| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Run on whole repo including tests | Test setup helpers ("create user with 12 fields") look complex; tests get refactored away from clarity | Always exclude tests/, spec/ (Step 3) |
| Set CCN threshold to default (15) | Too lax for new code | Start at 10 for new code; track existing code as baseline |
| Block PRs on absolute count | Legacy code can't add a single line | Diff-only: scan PR-changed functions only with git diff --name-only filter |
| Refactor for CCN at expense of clarity | Splitting a clear linear function into 4 helpers raises overall complexity | Use CCN as a smell signal, not a hard rule |
| Skip parameter-count guard | "God functions" with 12 args slip through | -a 5 enforces object-arg style |
Limitations
- Lizard's CCN counts decision points (if/else/case/&&/||/?:); doesn't
reflect cognitive complexity (nesting depth weight). Use SonarQube /
sonarqube-maintainability-gatefor cognitive complexity if needed. - No per-class metrics for OO code beyond per-method.
References
- Lizard README - CLI reference, language list, threshold flags
Files in this skill
2lizard-complexity skill questions
How do I install the lizard-complexity skill in Claude Code?
Run npx degit testland/qa/plugins/qa-code-quality/skills/lizard-complexity ~/.claude/skills/lizard-complexity. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the lizard-complexity skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
What metrics does Lizard provide?
Lizard analyzes NLOC (non-comment LoC), CCN (cyclomatic complexity), token count, and parameter count.
How can I use Lizard in a CI pipeline to fail builds?
You can use the -w flag to print warnings and check the exit status; Lizard exits with a non-zero code when any function exceeds the configured threshold.
Does Lizard support multiple programming languages?
Yes, it supports over 30 languages including C/C++, Java, Python, JavaScript, Go, Rust, TypeScript, Swift, and Kotlin.
What is the default cyclomatic complexity warning threshold?
The default warning threshold for CCN is 15.