# Clean Code Guard

Review generated or changed production code before it ships, using Clean Code, SOLID...

- Repository: https://github.com/amElnagdy/guard-skills (1302 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-07-04
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add amElnagdy/guard-skills --skill clean-code-guard -g -a claude-code -y`
Codex: `npx skills add amElnagdy/guard-skills --skill clean-code-guard -g -a codex -y`
Cursor: `npx skills add amElnagdy/guard-skills --skill clean-code-guard -g -a cursor -y`
Gemini CLI: `npx skills add amElnagdy/guard-skills --skill clean-code-guard -g -a gemini-cli -y`

## Description

Review generated or changed production code before it ships, using Clean Code, SOLID, DRY, KISS, YAGNI, and LLM-specific failure-mode checks in any programming language. Best used reactively after an agent writes, edits, refactors, or fixes code, before presenting, committing, or merging the result. Use when the user asks "review this PR", "is this safe to merge?", "make this cleaner", "audit this code", "refactor this", "fix this bug", or after a coding agent produced implementation code. Can also guide writing when explicitly invoked before a risky edit. Invoke it on your own initiative the moment you finish writing, editing, or refactoring non-trivial production code, before presenting or committing, don't wait to be asked. DO NOT USE for factual/conceptual questions, CI/tooling config, git workflow, running/debugging tests, pure architecture discussion, prose writing, data analysis, or test-code review (use test-guard).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# clean-code-guard

You are reviewing generated or changed code before it ships. Apply the rules below as a guard pass after the first implementation pass, and once this skill is active, keep applying it to every later code change in the same session, re-running the self-check before delivery after each edit rather than reverting to unguarded output because the skill loaded earlier. If the user explicitly invokes this skill before writing code, use the same rules while writing and still run the self-check before delivery.

## Compatibility

This is a portable instruction skill. It requires no MCP server, network access,
API key, shell command, local executable, or bundled script. It can be used in
any runtime that supports `SKILL.md` plus directly linked [references/](references/)
files; `agents/openai.yaml` is lightweight display metadata.

This skill does not replace project linters, formatters, type checkers, or test
runners. Use the project's own tools for mechanical verification; use this skill
for the judgement layer around code quality and review.

## How to use this skill

This skill has three modes, pick based on the user's request.

**Guard-pass mode** (recommended): after code has been generated, edited, refactored, or fixed, check the diff or target files against the *Always-applied imperatives* below. Fix violations before presenting, committing, or merging the work.

**Live mode** (explicit): when the user invokes this skill before a risky code edit, apply the same imperatives while writing, then run the *Self-check before delivery* checklist. If you violate any rule, fix it before showing the user.

**Review mode** (triggered when the user asks you to review, audit, critique, or rate code): walk [references/review-checklist.md](references/review-checklist.md) against the target file(s) and produce a structured findings report. Do not edit code in review mode unless asked.

The rest: https://github.com/amElnagdy/guard-skills/blob/HEAD/skills/clean-code-guard/SKILL.md
