Skip to content
Back to skills

Code Quality Standards

ASecurity

Concrete code-quality thresholds and anti-patterns: 120-char lines, max 20 cyclomatic complexity, max 4 nesting levels, max 50 lines per function, no magic numbers, no global state, composition over inheritance, no bare except, rule-of-three before extracting an abstraction, delete dead code instead of commenting it out. Load when writing a new function or module, reviewing a diff for quality, refactoring a long or deeply nested function, or deciding whether to extract shared logic.

  • 146 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 5, 2026
ai-agentsrefactoringapi

Works with

  • api

Security analysis

A100/100

Scanned October 5, 2026

npx -y skills add Goldziher/ai-rulez --skill code-quality-standards --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Quality Standards?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Quality Standards
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/goldziher-code-quality-standards/badge)](https://www.skillsdirectory.com/skills/goldziher-code-quality-standards)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-quality-standards
description: "Concrete code-quality thresholds and anti-patterns: 120-char lines, max 20 cyclomatic complexity, max 4 nesting levels, max 50 lines per function, no magic numbers, no global state, composition over inheritance, no bare except, rule-of-three before extracting an abstraction, delete dead code instead of commenting it out. Load when writing a new function or module, reviewing a diff for quality, refactoring a long or deeply nested function, or deciding whether to extract shared logic."
---

## Readability

- Max 120 character line width.
- Prefer explicit code over clever tricks — if it needs a comment to explain what it does, rewrite it.
- No abbreviations in public API names (`context` not `ctx`, `repository` not `repo`).
- Keep functions short and focused on a single responsibility.

## Complexity limits

Max 20 cyclomatic complexity per function, max 4 levels of nesting depth, max 50 lines per function. Use early returns to flatten conditionals. Break complex functions into well-named helpers that each do one thing.

## Anti-patterns

- No magic numbers — use named constants.
- No global state — use dependency injection.
- No inheritance for code reuse — prefer composition.
- No bare exception handlers — catch specific types.
- No mocking internal services — use real objects for integration tests.
- No blocking I/O in async code paths — keep async paths fully async.

## Duplication

Extract shared logic after the third repetition, not before. Three similar lines are better than a premature abstraction. When extracting, ensure the shared code has a single reason to change — if two callers would evolve the logic differently, keep them separate. Premature abstraction creates worse coupling than duplication.

## Dead code

Remove dead code instead of commenting it out. Version control preserves history; commented-out code creates confusion and maintenance burden.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.