code-complexity
Skill6 starsChanged 8 months agoMITView on GitHub
Enforce cyclomatic complexity limits, function/file length limits, nesting depth, parameter counts, and duplication detection. Keeps code readable and maintainable.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- AnastasiyaW/codex-claude-code-configtheir own version, first seen Apr 23, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- AnastasiyaW/codex-claude-code-config★ 153same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository64 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-backward-compatibilitySkill
- api-design-standardsSkill
- api-versioningSkill
- database-designSkill
- distributed-systemsSkill
- observability-by-defaultSkill
- performance-budgetsSkill
- resilience-patternsSkill
- twelve-factor-appSkill
- codex-cross-reviewSkill
- dispatching-parallel-agentsSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- subagent-driven-developmentSkill
- architecture-awarenessSkill
- intent-to-specSkill
- project-diagnosisSkill
- using-shipworthySkill
- systematic-debuggingSkill
- documentation-as-codeSkill
- accessibilitySkill
- frontend-standardsSkill
- retrospectiveSkill
- writing-skillsSkill
- ci-cd-awarenessSkill
- context-managerSkill
- environment-setupSkill
- feature-flag-disciplineSkill
- finishing-a-development-branchSkill
- guardrail-audit-logSkill
- incident-responseSkill
- mcp-integrationSkill
- migration-strategiesSkill
- production-readinessSkill
- scope-creep-detectionSkill
- session-memorySkill
- slo-sli-definitionSkill
- tech-debt-trackingSkill
- using-git-worktreesSkill
- zero-downtime-migrationsSkill
- brainstormingSkill
- decision-frameworksSkill
- design-documentsSkill
- executing-plansSkill
- writing-plansSkill
- confidence-based-strictnessSkill
- error-handling-patternsSkill
- feedback-driven-adaptationSkill
- quality-gatesSkill
- response-schema-validationSkill
- test-driven-developmentSkill
- verification-before-completionSkill
- adaptive-securitySkill
- bias-detectionSkill
- compliance-awarenessSkill
- container-securitySkill
- dependency-managementSkill
- pii-detectionSkill
- secrets-managementSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
If you need a comment like // Step 3: ..., that step is its own function.
- Distinctive: line 80
If you copy-paste 3+ lines, extract a function.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Complexity
Limits at a Glance
| Metric | Limit | Action When Exceeded |
| Cyclomatic complexity | < 15 per function | Extract helper functions |
| Function length | ~50 lines max | Split into focused functions |
| File length | ~300 lines max | Extract modules/classes |
| Nesting depth | Max 4 levels | Early returns, extract functions |
| Parameter count | Max 4-5 params | Use an options/config object |
| Duplicate blocks | > 3 lines repeated 2+ times | Extract shared function |
Cyclomatic Complexity (< 15 per function)
Each if, else, case, &&, ||, catch, and ternary adds 1. When a function exceeds 15, extract validation, branching logic, or case handling into separate functions.
Function Length (~50 Lines Max)
If you need a comment like // Step 3: ..., that step is its own function.
// BAD -- 120-line function with section comments
function handleRequest(req: Request) { /* validate, fetch, transform, respond */ }
// GOOD -- each concern is a named function
function handleRequest(req: Request) {
const input = validateInput(req);
const data = fetchDependencies(input);
return saveAndRespond(transformData(data));
}Deep Nesting (Max 4 Levels)
// BAD -- 5 levels deep
function process(items) {
if (items) {
for (const item of items) {
if (item.active) {
if (item.type === 'premium') {
if (item.balance > 0) { /* buried logic */ }
}
}
}
}
}
// GOOD -- flat with early returns and filtering
function process(items) {
if (!items) return;
const eligible = items.filter(i => i.active && i.type === 'premium' && i.balance > 0);
for (const item of eligible) { /* top-level logic */ }
}Parameter Count (Max 4-5)
// BAD -- 7 positional params
function createUser(name, email, role, team, avatar, locale, timezone) { ... }
// GOOD -- options object
interface CreateUserOptions {
name: string; email: string; role: Role;
team?: string; avatar?: string; locale?: string; timezone?: string;
}
function createUser(options: CreateUserOptions) { ... }Duplication Detection
If you copy-paste 3+ lines, extract a function. Duplicated code means duplicated bugs. Two functions that are 80% identical should share a parameterized helper.
Enforcing with Tooling
{
"rules": {
"complexity": ["error", 15],
"max-lines-per-function": ["warn", { "max": 50, "skipBlankLines": true }],
"max-depth": ["error", 4],
"max-params": ["warn", 5],
"max-lines": ["warn", { "max": 300 }]
}
}Review Checklist
- No function exceeds cyclomatic complexity of 15
- Functions are under ~50 lines
- Files are under ~300 lines
- No nesting deeper than 4 levels
- Functions with 5+ parameters use an options object
- No copy-pasted blocks longer than 3 lines
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

