clean-code

Enforce pragmatic coding standards for AI agents with self-check and script verification.

17|1|Updated Apr 20, 2022
One-click install
npx skills add https://github.com/jvegaf/harmony --skill clean-code-jvegaf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-code
Source: https://github.com/jvegaf/harmony/tree/main/.agents/skills/clean-code
Command: npx skills add https://github.com/jvegaf/harmony --skill clean-code-jvegaf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill enforces pragmatic coding standards to ensure code is simple, maintainable, and directly addresses the problem without unnecessary complexity or verbosity.

Core Features & Use Cases

  • Enforces SOLID principles: Promotes Single Responsibility, Don't Repeat Yourself, Keep It Simple, You Ain't Gonna Need It, and the Boy Scout Rule.
  • Clear Naming Conventions: Guides on naming variables, functions, and constants for maximum readability.
  • Function Best Practices: Defines rules for function size, arguments, and side effects.
  • Code Structure Guidelines: Advocates for guard clauses, flat nesting, composition, and colocation.
  • AI Coding Style: Directs AI agents on how to respond to user requests for features, bugs, or unclear requirements.
  • Self-Check Mechanism: Mandates a rigorous self-verification process before task completion.
  • Script Verification: Outlines how to run and interpret validation scripts.

Quick Start

Apply the clean code principles to refactor the provided Python function to be more concise and readable.

Frequently Asked Questions about clean-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce clean code standards when using AI agents for coding?

To enforce clean code standards with AI agents, apply pragmatic coding principles focusing on conciseness, directness, and solution-orientation. This guides AI behavior through strict naming conventions, function rules, and structural guidelines like guard clauses and flat nesting.

What coding principles help keep code concise and maintainable?

Clean code principles like Single Responsibility (SRP), Don't Repeat Yourself (DRY), Keep It Simple (KISS), You Ain't Gonna Need It (YAGNI), and the Boy Scout Rule help keep code concise, simple, and maintainable by directly addressing problems without unnecessary complexity.

How do I refactor code to be more concise and readable?

To refactor code for conciseness and readability, apply clear naming conventions, function best practices, and code structure guidelines. Use guard clauses, flat nesting, composition, and colocation to simplify logic and improve overall code readability.

Can I use a self-check mechanism to verify AI-generated code quality?

Yes, you can verify AI-generated code quality using a mandatory self-check mechanism. This involves a rigorous self-verification process and script validation to ensure code quality, adherence to standards, and task completion before finalizing.

Does this clean code approach work for any programming language?

The clean code approach works across programming languages by enforcing universal coding standards. It guides AI agents on principles like SRP, DRY, KISS, and YAGNI, alongside naming conventions and function rules that apply regardless of language syntax.