# Your AI Code Is Trash. Here’s Why

Source: https://www.youtube.com/watch?v=-8zrlwrTCp8
Recap page: https://rapidrecap.app/video/-8zrlwrTCp8
Generated: 2025-11-15T15:33:34.251+00:00

---
## Quick Overview

The main reason AI code output is often considered 'trash' is the lack of explicit, project-specific rules guiding the AI agent, leading to bloated, messy, and contextually irrelevant code, which can be fixed by implementing custom User Rules within the AI platform to enforce desired architectural patterns, code cleanliness, and specific operating system commands like using Cmd instead of Ctrl on macOS.

**Key Points:**
- AI code output becomes 'trash' when agents lack explicit rules, resulting in bloated code that doesn't adhere to project architecture (03:59).
- The speaker shares five simple rules added to his settings to ensure his AI agent (Corbin) performs better, focusing on code quality and context awareness (00:05, 00:13).
- A critical rule enforces that bug fixes must end with a mandatory one-sentence summary using exactly three alarm emojis (3:39, 05:57).
- Another rule mandates providing Mac-specific keyboard shortcuts (Cmd instead of Ctrl) because the user operates on macOS (05:13).
- A rule for code reuse prevents the AI from duplicating UI elements across pages, forcing it to reuse or refactor components (03:46).
- Rules can be applied globally or locally to specific folders (like 'docs/BUG_SOLUTIONS.md') to ensure consistent behavior across different project contexts (07:09).
- Implementing these rules streams the entire workflow, preventing the AI from making messy errors and significantly improving code quality and maintainability (08:04).

![Screenshot at 00:36: The user navigates to the 'Rules, Memories, Commands' section in the settings panel to begin configuring custom instructions for the AI agent.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-00-36.png)

**Context:** The video discusses the common frustration developers face when using AI coding assistants, where the output code is often poorly structured or includes unnecessary complexity because the AI lacks specific context about the project's existing architecture and conventions. The presenter demonstrates how to overcome this by setting up custom 'User Rules' within his AI agent environment, which act as persistent, enforced instructions for every interaction.

## Detailed Analysis

The presenter argues that AI-generated code often fails due to a lack of enforced context, leading to code bloat, messiness, and failure to adhere to established software architecture, which is a major productivity blocker. He introduces five specific 'User Rules' he implemented to force his AI agent to behave like a senior engineer. The first rule requires the agent to always check a specific documentation file ('docs/BUG_SOLUTIONS.md') before fixing any bug. The second, labeled CRITICAL, mandates that every bug fix summary must conclude with exactly three alarm emojis ("") and be the absolute last sentence of the response. The third rule ensures platform specificity by requiring Mac-specific commands (Cmd instead of Ctrl) since the user is on macOS. The fourth rule enforces component reuse by instructing the agent to reuse or refactor shared UI components when adding new elements across pages. The fifth rule dictates that when editing README files, social media links must be added immediately after the main title using specific Markdown formatting. The presenter emphasizes that these rules provide enormous value by streamlining the development process, ensuring clean, scalable code that aligns with existing project structure, and preventing the AI from generating repetitive or unnecessary code, thereby saving significant debugging time.

### Introduction to AI Code Quality

- Agent output is trash due to lack of explicit rules
- Rules can enforce architectural standards like component reuse (03:59)

### Rule 1 & 2

- Bug Fixing Protocol: Always check docs/BUG_SOLUTIONS.md before fixing bugs
- Critical rule: must end bug fixes with a one-sentence summary and exactly three alarm emojis (05:53)

### Rule 3 & 4

- Contextual Enforcement: Always provide Mac-specific shortcuts (Cmd instead of Ctrl) as the user is on macOS
- Enforce UI element reuse/refactoring to prevent code duplication across pages (05:13, 03:46)

### Rule 5

- Documentation Formatting: When editing READMEs, always add social media links immediately after the main title using specific Markdown structure (02:07, 03:00)

### Practical Application & Value

- These rules are valuable because they streamline the entire workflow, preventing errors and ensuring scalable, clean code architecture for any file type (08:04, 06:53)

![Screenshot at 00:00: Presenter speaking directly to the camera while showing the Thumio AI Thumbnail Editor interface in the background.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-00-00.png)
![Screenshot at 00:33: The presenter navigates to the settings menu within the development environment to access configuration options.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-00-33.png)
![Screenshot at 00:37: The 'Rules, Memories, Commands' section is highlighted in the settings sidebar, indicating where custom agent instructions are managed.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-00-37.png)
![Screenshot at 00:55: A close-up view of the 'User Rules' section displaying several active, detailed instructions for the AI agent.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-00-55.png)
![Screenshot at 01:57: A screenshot of a saved rule \('Delete any test files I create after confirming they are no longer needed.'\) displayed in an image viewer after being double-clicked.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-01-57.png)
![Screenshot at 03:33: The presenter explains the importance of Markdown formatting, which is visible in the edited rule text overlay.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-03-33.png)
![Screenshot at 04:08: The presenter navigates to the 'Terms of Service' page of the application to show that rules apply across different pages, including legal documents.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-04-08.png)
![Screenshot at 07:14: The file explorer view highlights the 'docs/bugreports' folder, showing specific, dated bug report templates used for context.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-07-14.png)
![Screenshot at 08:12: A final gesture from the presenter emphasizing the value of these rules in creating cleaner, better-structured code.](https://ss.rapidrecap.app/screens/-8zrlwrTCp8/00-08-12.png)
