enforcing-code-quality
Skill11 starsChanged 3 months agoMITView on GitHub
Production code quality standards and the prohibited-pattern checklist for all code changes. Loaded by the code-quality rule module and invoked by test-driven-development at the GREEN step.
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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 17
Shortcuts compound: - Every any type, swallowed error, and skipped test becomes someone's 3am incident.
- Distinctive: line 20
Patterns before invention: - Read existing code first.
- Distinctive: line 82
When discovering issues in touched code:
- Distinctive: line 90
When encountering pre-existing issue:
- Distinctive: line 99
Before marking code complete: </CRITICAL>
- Distinctive: line 122
Before completing implementation - if ANY unchecked: fix before proceeding.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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 Quality Enforcement
<ROLE>
Senior Engineer with zero-tolerance for technical debt. Reputation depends on code that survives production without hotfixes or "we'll fix it later" rework.
</ROLE>Invariant Principles
- Shortcuts compound - Every
anytype, swallowed error, and 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 | 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
<analysis>
Before writing code:
- What existing patterns apply here?
- What error conditions are possible?
- What assertions would prove correctness?
- Are there pre-existing issues in touched code?
</analysis><reflection>
After writing code:
- Did I match existing conventions?
- Is every error case handled explicitly?
- Would tests catch a regression?
- Did I address or flag pre-existing issues?
</reflection>Prohibitions
<FORBIDDEN>
- Blanket try-catch (swallows real errors)
- `any` types (erases type safety)
- Non-null assertions without validation (`!` operator)
- Simplifying tests to make them pass
- Skipping or commenting out failing tests
- `error instanceof Error` shortcuts (loses error context)
- `eslint-disable` without understanding the rule
- Resource leaks (unclosed handles, dangling promises)
- Graceful degradation (fail loudly, not silently)
</FORBIDDEN>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
<analysis>
When encountering pre-existing issue:
- Is this blocking current work?
- Is fix scope contained?
- Will leaving it cause confusion later?
</analysis>Quality Checklist
<CRITICAL>
Before marking code complete:
</CRITICAL>- Matches existing codebase patterns
- No items from FORBIDDEN list
- Error handling is explicit and complete
- Tests have meaningful assertions
- Test assertions are Level 4+ on the Assertion Strength Ladder (
patterns/assertion-quality-standard.md) - Full Assertion Principle enforced: ALL output tested with exact equality (
assert result == expected), never substring checks; for dynamic output, construct full expected value dynamically - No bare substring checks on any output (
assert "X" in resultis BANNED -- static or dynamic) - No partial assertions on dynamic output (construct full expected, do not use membership checks)
- No mock.ANY in call assertions (BANNED -- construct expected argument)
- Every mock call asserted with ALL args; call count verified
- No length/existence-only assertions
- No partial-to-partial upgrades (Pattern 10: replacing one BANNED assertion with another is not a fix)
- No hallucinated APIs: method calls, imports, and config keys verified against actual library/framework
- AI-generated code has had API signatures spot-checked against source or documentation
- Pre-existing issues addressed or explicitly tracked
- Would confidently deploy this
Self-Check
<CRITICAL>
Before completing implementation - if ANY unchecked: fix before proceeding.
</CRITICAL>- Every error path handled explicitly
- No
anytypes introduced - No try-catch swallowing errors
- Tests verify behavior, not just run
- Test assertions are Level 4+ on the Assertion Strength Ladder (
patterns/assertion-quality-standard.md) - ALL output tested with exact equality (
assert result == expected_complete_output); for dynamic output, construct full expected value dynamically - No bare substring checks on any output (
assert "X" in resultis BANNED -- static or dynamic) - No mock.ANY in call assertions (BANNED -- construct expected argument dynamically)
- Every mock call asserted with ALL args; call count verified
- No length/existence-only assertions
- No tautological assertions (
assert result == func(same_input)) - Pre-existing issues flagged to user
- Code matches existing patterns
<FINAL_EMPHASIS> Zero shortcuts. Zero swallowed errors. Zero skipped assertions. Code that ships must be code you would defend at 3am. If any checklist item is unchecked, it is not done. </FINAL_EMPHASIS>
In this repository65 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- documentation-updatesSkill
- spellbook-auditingSkill
- advanced-code-reviewSkill
- adversarial-reviewSkill
- agent2agentSkill
- analyzing-domainsSkill
- analyzing-skill-usageSkill
- assembling-contextSkill
- async-await-patternsSkill
- auditing-green-mirageSkill
- autonomous-modeSkill
- branch-contextSkill
- code-reviewSkill
- creating-issues-and-pull-requestsSkill
- debuggingSkill
- dedupeSkill
- deep-researchSkill
- dehallucinationSkill
- design-explorationSkill
- designing-workflowsSkill
- developSkill
- devils-advocateSkill
- dispatching-parallel-agentsSkill
- distilling-prsSkill
- documenting-projectsSkill
- documenting-toolsSkill
- emotional-stakesSkill
- estimating-ticketsSkill
- executing-plansSkill
- fact-checkingSkill
- finding-dead-codeSkill
- finishing-a-development-branchSkill
- fixing-testsSkill
- fractal-thinkingSkill
- gathering-requirementsSkill
- generating-diagramsSkill
- instruction-engineeringSkill
- isolated-testingSkill
- managing-artifactsSkill
- merging-worktreesSkill
- opportunity-awarenessSkill
- optimizing-instructionsSkill
- polish-repoSkill
- reflexionSkill
- requesting-code-reviewSkill
- resolving-merge-conflictsSkill
- reviewing-design-docsSkill
- reviewing-impl-plansSkill
- reviewing-prsSkill
- rounding-up-worktree-sessionsSkill
- sharpening-promptsSkill
- smart-readingSkill
- test-driven-developmentSkill
- testing-strategySkill
- tooling-discoverySkill
- using-git-worktreesSkill
- using-lsp-toolsSkill
- using-skillsSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

