Skip to content
Back to skills

Common Best Practices

ASecurity

Enforce SOLID principles, guard-clause style, function size limits, and intention-revealing naming across all languages. Use when refactoring for readability, applying clean-code patterns, reviewing naming conventions, or reducing function complexity.

  • 549 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 6, 2026
developmentgojavaswiftrefactoring

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned June 6, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill common-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Common Best Practices?

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

Security grade badge for Common Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-common-best-practices/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-common-best-practices)

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: common-best-practices
description: Enforce SOLID principles, guard-clause style, function size limits, and intention-revealing naming across all languages. Use when refactoring for readability, applying clean-code patterns, reviewing naming conventions, or reducing function complexity.
metadata:
  triggers:
    files:
    - '**/*.ts'
    - '**/*.tsx'
    - '**/*.go'
    - '**/*.dart'
    - '**/*.java'
    - '**/*.kt'
    - '**/*.swift'
    - '**/*.py'
    keywords:
    - solid
    - kiss
    - dry
    - yagni
    - naming
    - conventions
    - refactor
    - clean code
---
# Global Best Practices

## **Priority: P0 (FOUNDATIONAL)**

## Core Principles

- **SOLID**: Follow SRP (One reason to change), OCP (Open to extension), LSP, ISP, DIP.
- **KISS/DRY/YAGNI**: Favor readability. Abstract repeated logic. No " in case" code.
- **Naming**: Use intention-revealing names (`isUserAuthenticated` > `checkUser`). Match language casing.

## Code Hygiene

- **Size Limits**: Functions < 30 lines. Services < 600 lines. Utils < 400 lines.
- **Early Returns**: Use guard clauses. Avoid deep nesting.
- **Comments**: Explain **why**, not **what**. Refactor bad code; don't comment it.
- **Input**: Validate/sanitize all external inputs.

## Anti-Patterns

- **No Hardcoded Constants**: Use named config/env vars.
- **No Deep Nesting**: Use guard clauses.
- **No Global State**: Prefer dependency injection.
- **No Empty Catches**: Always handle, log, or rethrow.

## References

- [Code Structure Patterns](references/CODE_STRUCTURE.md) — file/function organization
- [Effectiveness Guide](references/EFFECTIVENESS.md) — practical application examples

Files in this skill

  • SKILL.md1.6 KB
  • references/CODE_STRUCTURE.md1 KB
  • references/EFFECTIVENESS.md1.5 KB

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.