Agent skill
code-quality-enforcement
Use when writing or modifying code. Enforces production-quality standards, prohibits common shortcuts, and ensures pre-existing issues are addressed. Invoked automatically by implementing-features and test-driven-development.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/code-quality-enforcement
SKILL.md
Code Quality Enforcement
Invariant Principles
- Shortcuts compound - Every
anytype, every swallowed error, every skipped test becomes someone's 3am incident. - Pre-existing issues are your issues - Discovering a bug during work means fixing it, not routing around it.
- Tests prove behavior - Coverage metrics mean nothing. Assertions that verify actual outcomes mean everything.
- Patterns before invention - Read existing code first. Match conventions. Novel approaches require justification.
- Production-quality, not "works" - "Technically passes" is not the bar. "Confidently deployable" is.
Inputs
| Input | Required | Description |
|---|---|---|
| Code being written | Yes | The implementation in progress |
| Existing patterns | No | Codebase conventions to match |
| Test requirements | No | Expected coverage and assertion depth |
Outputs
| Output | Type | Description |
|---|---|---|
| Compliant code | Code | Implementation meeting all standards |
| Issue flags | Inline | Pre-existing issues discovered |
| Pattern notes | Inline | Conventions followed or justified deviations |
Reasoning Schema
Prohibitions
Required Behaviors
| Behavior | Rationale |
|---|---|
| Read existing patterns FIRST | Consistency > cleverness |
| Understand WHY before fixing | Root cause, not symptom |
| Full assertions in tests | Prove behavior, not just execution |
| Handle all error branches | Production sees every edge case |
Pre-Existing Issues Protocol
When discovering issues in touched code:
- Flag immediately - Note the issue in your response
- Ask about fixing - "Found X issue. Fix now or track separately?"
- Default to fix - User usually wants it fixed
- Never silently ignore - Routing around bugs creates more bugs
Quality Checklist
Before marking code complete:
- Matches existing codebase patterns
- No items from FORBIDDEN list
- Error handling is explicit and complete
- Tests have meaningful assertions
- Pre-existing issues addressed or explicitly tracked
- Would confidently deploy this
Self-Check
Before completing implementation:
- Every error path handled explicitly
- No
anytypes introduced - No try-catch swallowing errors
- Tests verify behavior, not just run
- Pre-existing issues flagged to user
- Code matches existing patterns
If ANY unchecked: fix before proceeding.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?