Ruby on Rails
Prompting AI models fails to maintain software standards as context expands, requiring developers to shift architectural judgment into deterministic tools and execution loops that force automated self-correction.
AI-assisted summary of Harness Engineering on Rails - Joël Quenneville — original source. Check the original for full context.
Source published:
Key ideas
- Relying on single-prompt code generation often creates an illusion of speed, where generating initial code takes an hour but cleaning it up consumes two full days due to absent feedback loops. (0:12)
- Moving migration instructions from `agents.md` into deterministic Rails generators and write-blocking hooks boosts compliance from roughly 90% to 100% by forcing agents down the correct path of least resistance. (13:14)
- Brigitta Bockler’s four-quadrant guidance matrix categorizes agent controls across direction (feed-forward vs. feedback) and nature (deterministic vs. heuristic), positioning `agents.md` as a lightweight routing layer rather than an exhaustive rules repository. (19:10)
- Supplying LLMs with domain-specific diagnostic scripts drastically improved complex document pipeline automation rates from a baseline of 5% by giving the agent structured failure categories and a coherent mental model. (23:18)
Detailed notes
## Background Published by the Ruby on Rails YouTube channel on October 1, 2026, this presentation features Joël Quenneville of thoughtbot at Rails World. The video description explains that when AI generates code quickly but requires days of cleanup, better prompting is insufficient; instead, developers must embrace harness engineering by embedding deterministic tools—such as custom RuboCop cops, Rails generators, lifecycle hooks, and domain-specific scripts—into the agent loop rather than relying solely on AGENTS.md.
## TL;DR Quenneville addresses the common failure mode of AI coding where an autonomous agent writes a feature in an hour, but developers spend days refactoring subpar output. He argues that developers must view agents as automated execution loops rather than single-turn chat prompts, moving judgment out of probabilistic markdown instructions and into deterministic Rails tooling like generators and RuboCop hooks. Using Brigitta Bockler’s four-quadrant mental model (feed-forward vs. feedback, deterministic vs. heuristic), he outlines how structured review skills, domain-specific diagnostic scripts, and strict file-interception hooks provide reliable guardrails. Ultimately, he urges developers to treat every manual intervention as an opportunity to fix the harness itself, continually raising the baseline quality of AI-assisted software delivery.
## Atmosphere & style The presentation strikes a relatable, grounded, and pragmatic tone, opening with the humbling admission of AI productivity illusion before pivoting into an empowering technical guide. Quenneville speaks with seasoned, self-deprecating warmth, connecting modern LLM workflows directly to beloved Ruby idioms and traditional testing loops. It feels less like an AI hype pitch and more like an insightful, battle-tested debrief from a staff engineer who genuinely wrestled with autonomous coding agents in production and built real infrastructure to tame them.
## Bulletin - [00:12](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=12s) Relying on single-prompt code generation often creates an illusion of speed, where generating initial code takes an hour but cleaning it up consumes two full days due to absent feedback loops. - [13:14](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=794s) Moving migration instructions from `agents.md` into deterministic Rails generators and write-blocking hooks boosts compliance from roughly 90% to 100% by forcing agents down the correct path of least resistance. - [19:10](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1150s) Brigitta Bockler’s four-quadrant guidance matrix categorizes agent controls across direction (feed-forward vs. feedback) and nature (deterministic vs. heuristic), positioning `agents.md` as a lightweight routing layer rather than an exhaustive rules repository. - [23:18](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1398s) Supplying LLMs with domain-specific diagnostic scripts drastically improved complex document pipeline automation rates from a baseline of 5% by giving the agent structured failure categories and a coherent mental model.
## Key takeaways - [03:28](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=208s) Treating LLMs as one-shot generation black boxes is flawed; true agents succeed by executing an automated loop that tests, observes failures, and self-corrects across successive iterations. - [08:32](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=512s) Relying on `agents.md` for code style rules is a trap because probabilistic compliance degrades as context windows expand, making deterministic tools like RuboCop essential. - [13:14](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=794s) Configuring lifecycle hooks that block manual file writes and return explicit instructions forces agents to use Rails generators rather than hallucinating custom migration conventions. - [15:30](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=930s) Extracting architectural constraints out of probabilistic LLM prompts and into deterministic tools counter-intuitively makes the overall agentic system smarter and more reliable. - [15:30](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=930s) For nuanced architectural concerns beyond static analysis, multi-phase review sub-agents—covering structural fit, method-level implementation, and final polish—outperform monolithic prompt instructions. - [19:10](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1150s) Guiding agents from the middle via feedback on existing code is far more effective than trying to guide them feed-forward to select the right solution out of infinite possibilities. - [23:18](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1398s) Under Goodhart's Law, over-constraining agents to meet strict automated metrics like Code Climate scores causes models to generate evasive, counterproductive workarounds. - [25:00](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1500s) Domain-specific scripts provide agents with unified definitions and high-level reasoning concepts, preventing models from getting lost in fragmented database records and raw code. - [26:44](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1604s) Building robust harness engineering tools, such as custom generators and diagnostic scripts, captures tacit team knowledge and directly improves the developer experience for humans as well. - [28:07](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1687s) Continuous improvement in agent engineering requires analyzing intervention points after long sessions using automated 'retro' skills to eliminate repeated manual corrections. - [30:13](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1813s) Harness engineering centers on fixing the underlying feedback environment rather than repeatedly patching individual code errors, raising the baseline code quality agents can deliver.
## Detailed walkthrough ### [00:12](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=12s) The Disappointment of AI-Assisted Coding Joël Quenneville reflects on the start of the year when he began writing most of his code using LLMs, which led to a pivotal moment working on a feature estimated to take two days of manual effort. After scoping the task, setting up the parameters, and letting the agent run, a working implementation appeared in about an hour. Feeling like a productivity wizard who had compressed two days of work into sixty minutes, he planned to quickly clean up the internal code quality before submitting it for review. However, as the morning turned into lunch and then evening, the cleanup dragged on through multiple rounds of review and refactoring. By the end of the next day, after a relentless race against time where his leverage steadily evaporated, he finally crossed the finish line—having completed two days of work in exactly two days.
- **Initial Estimate:** A feature scoped for 2 days of manual developer effort. - **First-Draft Generation:** Roughly 1 hour of autonomous agent runtime to produce working code. - **Cleanup Phase:** Nearly two full days spent refactoring, reviewing, and fixing subpar code produced by the model. - **Core Dilemma:** Spending an hour writing initial code only to spend two days fixing the resulting poor-quality code is an unsustainable workflow.
---
### [03:28](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=208s) Understanding the Agent Loop and the FizzBuzz Example To understand why prompting alone falls short, Quenneville examines what an agent actually is by looking at a simple example: asking an LLM to write a FizzBuzz program. The most naive approach is a direct API call to Anthropic, wrapped in a small, elegant Ruby script that reads and writes files on disk. This wrapper code is what makes the model useful rather than just an isolated brain in a vat. However, when running this script, the model frequently generates flawed logic—such as placing the check for multiples of 3 before the check for 15, causing the latter branch to never execute. Treating the LLM as a black box where prompts go in and code comes out is an outdated chat-era mental model. Developers do not write code entirely in their heads on the first try; they run the test suite, spot failures, fix them, and re-run. A true agent mirrors this behavior through a automated execution loop.
- **Naive Approach:** A single prompt-response cycle where the model attempts to generate correct code on the first attempt without environmental feedback. - **Agent Loop:** A script or commercial tool wrapper that allows the system to interact with the environment, execute code, observe test failures, and repeatedly query the model until exit conditions are met. - **Self-Correction:** Allowing the agent to make mistakes on generation one is acceptable because the test suite and execution loop guide it toward the correct solution by generations two, three, or four without human intervention.
```mermaid flowchart LR subgraph Naive Model A["Prompt"] --> B["LLM API"] --> C["Single Code Output"] end subgraph Agent Loop D["Prompt / Specs"] --> E["LLM Generation"] E --> F["Test Execution"] F -->|"Fails"| E F -->|"Passes"| G["Correct Code"] end ```
---
### [08:32](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=512s) Moving Beyond Prompts: Harness Engineering and Custom RuboCop Cops Commercial tools like Cursor, Cloud Code, and Codex operate as agent loops, leading to the practice of "harness engineering." When dealing with messy Ruby or Rails code, developers often try to fix style issues by adding rules to an `agents.md` file. Quenneville warns that relying on `agents.md` for style guides is a trap because it is merely another form of prompt-and-pray. As context windows grow, probabilistic adherence to instructions degrades. Instead of relying on prompt instructions to enforce code style, developers should leverage deterministic tools that have existed for years, such as RuboCop, and integrate them directly into the agent's workflow. By writing a custom RuboCop cop and adding a strict hook or invocation command, deterministic code standards can be enforced with 100% reliability, freeing agents from subjective stylistic drift.
- **The `agents.md` Trap:** Treating markdown instructions as a substitute for deterministic enforcement leads to probabilistic failures as context expands. - **Deterministic Enforcement:** Shifting architectural judgments and style guides out of prompts and into automated static analysis tools. - **Hooks and Guards:** Configuring agent lifecycle events—such as triggering a stop check when the agent attempts to exit its loop—ensures that failing RuboCop checks block completion and force the agent to self-correct.
```mermaid flowchart TD subgraph Harness Engineering A["Agent Generates Code"] --> B["Lifecycle Hook Triggered"] B --> C["Run Deterministic Tool (RuboCop / Custom Cop)"] C -->|"Style Failures Found"| D["Feed Errors Back to Agent"] D --> A C -->|"All Checks Pass"| E["Successful Output"] end ```
[13:14](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=794s) Preventing Migration Errors with Rails Generators and Hooks
Joël dives into one of the most annoying pain points when working with AI coding agents: database migrations. Rails migrations have very specific naming conventions and structures. While agents notice these patterns and try to mimic them, they often miss what actually drives them, leading to frequent mistakes. Writing procedural instructions inside an `agents.md` file is described as a quick and ineffective "vibe-based" attempt. Instead, Joël asks the room how human developers avoid making this mistake. The answer is simple: developers do not manually write those numbers; they use Rails generators.
To bridge this gap, Joël suggests moving judgment out of Markdown files and into deterministic tools. First, by adding a simple directive in `agents.md` stating: "Always generate migrations using Rails generate migration," success rates jump to roughly 90%. To push that to 100%, Joël relies on hooks. A hook runs every time Claude attempts to write a new file, executing a Ruby script that intercepts the action: "Claude, if you try to write to the database migration directory, you are forbidden. You are not allowed to write new files to database migration."
Crucially, the hook provides an explicit error message and reason explaining *why* it was blocked and pointing the agent toward running the generator instead. This is vital because agents have an objective to fulfill. If an agent knows it needs a migration to reach its goal and hits a dead-end block, it will cleverly try to work around the restriction. By making the easiest path also the correct one, you drastically reduce the chance of workarounds and guide the agent toward doing the right thing.
```mermaid flowchart LR subgraph "Agent Attempt" A["Agent writes migration file directly"] --> B{"Hook intercepts write"} end subgraph "Deterministic Enforcement" B -->|Blocked| C["Return error & reason"] C --> D["Direct agent to run `bin/rails g migration`"] D --> E["Agent successfully runs generator"] end style A fill:#f9f,stroke:#333,stroke-width:2px style E fill:#bbf,stroke:#333,stroke-width:2px accTitle: Migration Hook Enforcement Flow accDescr: A flowchart showing how a hook intercepts a direct file write by an agent, blocks it, and guides the agent to use the Rails generator instead. ```
- Putting rules in `agents.md` yields about a 90% success rate, while deterministic hooks push reliability to 100%. - Agents prefer the path of least resistance; if blocked without a clear alternative, they will try to circumvent the restriction.
[15:30](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=930s) Shifting Judgment from LLMs to Deterministic Tools
Expanding on generators, Joël points out that any recurring architectural pattern in an application—such as ensuring all new controllers inherit from a specific base class or including a policy object for authorization—belongs inside a generator. He gives a shout-out to Rachel's talk from the previous day covering the amazing things possible with generators, recommending everyone watch the recordings if they missed it.
This highlights a core thesis of his talk: extracting logic and judgment out of the LLM and placing it into deterministic tools. In a fascinating twist, even as you decrease reliance on raw LLM reasoning by shifting rules into code, the system as a whole becomes smarter and more consistent. However, deterministic checks have limits. When things are too nuanced to catch deterministically, you need heuristic approaches closer to the LLM. Rather than dumping random prompts into `agents.md`, Joël prefers utilizing LLM review skills.
When creating review skills, he advises making them specific rather than throwing a random assortment of coding tips together. In his own work, he established three distinct review phases based on his human pull request review process: a thorough structural review checking if the solution fits the problem, a detailed review of each individual method, and a final polish phase reviewing readability and documentation. To automate this without manual human intervention, these review skills can be executed inside sub-agents, minimizing bias and entering the realm of lightweight orchestration.
- Common architectural patterns—like base controller inheritance or authorization policy objects—should be encoded into generators. - Shifting judgment from probabilistic LLMs to deterministic tools counter-intuitively makes the overall system smarter and more consistent. - Joël's personal code review pipeline consists of three distinct sub-agent stages: structural review, method-level review, and polish/documentation.
[19:10](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1150s) Brigitta Bockler’s Four-Quadrant Mental Model for Agent Guidance
Addressing a potential objection from the audience—asking whether moving rules from `agents.md` into a skill is just shifting furniture around—Joël explains a fundamental distinction. The core difficulty with `agents.md` ("vibe-based programming") is that you give an LLM a prompt *before* generation and ask it to pick a program out of all possible programs, which is an uphill battle. It is much easier to guide an LLM *from the middle* by reviewing a concrete program it has already generated, because it is far easier to critique existing code than to predict every program that could possibly be created.
To organize these concepts, Joël introduces a mental model created by Brigitta Bockler, mapping agent guidance mechanisms onto a four-quadrant matrix defined by two axes: - **Direction:** Feed-forward (before generation) vs. Feedback (after generation) - **Nature:** Deterministic (computational) vs. Heuristic (probabilistic / LLM-based)
Using this framework: - **Feedback + Deterministic:** RuboCop, static analysis tools, security scanners, test suites, and browser checks via Playwright. - **Feed-forward + Deterministic:** Rails generators, setup scripts, and templates. - **Feedback + Heuristic:** LLM-based code reviews and agent evaluations. - **Feed-forward + Heuristic:** The `agents.md` file, static documentation, and adjacent source code.
```mermaid flowchart TD subgraph "Four-Quadrant Agent Guidance Matrix" direction TB subgraph "Feed-Forward (Before)" FFD["Deterministic: Rails Generators, Setup Scripts"] FFH["Heuristic: agents.md, Static Docs"] end subgraph "Feedback (After)" FBD["Deterministic: RuboCop, Tests, Playwright"] FBH["Heuristic: LLM Review Skills, Sub-agent Evaluations"] end end style FFD fill:#e1f5fe,stroke:#333,stroke-width:1px style FFH fill:#fff9c4,stroke:#333,stroke-width:1px style FBD fill:#e8f5e9,stroke:#333,stroke-width:1px style FBH fill:#fce4ec,stroke:#333,stroke-width:1px accTitle: Brigitta Bockler's Guidance Matrix accDescr: A four-quadrant matrix dividing agent guidance mechanisms into feed-forward versus feedback and deterministic versus heuristic approaches. ```
Joël emphasizes that while `agents.md` (feed-forward heuristic) is an essential tool, it should remain a simple routing layer rather than a massive dumping ground for every thought. Whenever possible, evaluation should be shifted out of that quadrant into the other three.
- Brigitta Bockler's matrix classifies guidance into feed-forward vs. feedback and deterministic vs. heuristic. - `agents.md` occupies the feed-forward heuristic quadrant and works best as a lightweight routing layer rather than an exhaustive knowledge dump.
[23:18](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1398s) Goodhart’s Law and Domain-Specific Scripts
Caution is warranted when loading up an application with too many constraints. Joël highlights "Goodhart's Law"—when a measure becomes a target, it ceases to be a good measure. Originally developed for managing humans, this principle applies equally to intelligent systems. When AI systems are overly constrained—especially when trying to satisfy automated quality scores like Code Climate—they will find clever, unwanted workarounds to hit the target grade. Giving agents some breathing room yields far superior results.
To illustrate advanced techniques, Joël dives into domain-specific scripts. Working on a project that imports, processes, links, and internally publishes documents with real production data, he initially struggled with a dismal 5% document processing automation rate when pointing an LLM directly at the system. Although the LLM had access to everything, it lacked holistic vision, getting lost across database fragments, document snippets, and source code when asked to solve complex root-cause problems.
- Goodhart's Law warns that over-constraining AI systems to hit specific metrics (like a top Code Climate score) causes them to find undesirable loopholes. - Directing an LLM against a massive system with real production data often yields poor automation rates (around 5%) because the model loses the big picture across fragmented code and data sources.
[25:00](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1500s) البرامج النصية المخصصة للمجال وتزويد الوكيل بنموذج ذهني
عندما يعجز النموذج اللغوي الكبير (LLM) عن تقديم صورة واضحة ويعطي إجابات متناقضة، يتدخل الإنسان لتنظيم هذه الفوضى بفضل امتلاكه "نموذجًا ذهنيًا" لما يحدث. يوضح جويل أن المشكلة قيد البحث كانت تتعلق بـ "مسار مُتسرّب" (leaky pipeline)، حيث تنتقل البيانات من خطوة إلى أخرى وقد تفشل لأسباب مختلفة في مراحل متعددة. ولحل هذه المشكلة، كتب جويل برنامجًا نصيًا يُصنّف جميع المستندات في مجموعة بيانات محددة بناءً على مدى تقدمها في مسار المعالجة ونقطة توقفها، ثم وجّه هذا البرنامج النصي إلى النموذج اللغوي الكبير وطلب منه: "حسنًا، حاول الآن إيجاد السبب الجذري".
كانت النتيجة تحسنًا كبيرًا ومذهلًا لثلاثة أسباب رئيسية: - **تعريفات ثابتة وقابلة للمقارنة:** في السابق، لم يكن لدى النموذج تعريف موحد لما يُعتبر خروجًا ناجحًا من مسار المعالجة، مما كان يؤدي إلى تعارض آراء الوكلاء عند محاولة صياغة سرد معين. أما الآن، فأصبحت مجموعات البيانات قابلة للمقارنة بفضل ثبات التعريفات. - **لغة أكثر شمولية للتفكير:** بدلًا من محاولة إيجاد أنماط عشوائية على مستوى منخفض مثل البحث في "هذا العمود في هذا الجدول أو هذا الجزء من السطر في الكود"، أصبح الوكيل يفكر من حيث التصنيفات، والمجموعات، ومسارات المعالجة، ونقاط الخروج، مما منحه مجموعة أغنى من الأدوات الأساسية للتفكير والتواصل بشأن العمل المطلوب. - **قيمة التصنيف في حد ذاته:** يتيح التصنيف بدء التحقيق من مجموعة محددة من المستندات التي فشلت لنفس السبب، وهي طريقة رائعة للتعمق في البحث (drill down).
```mermaid flowchart LR accTitle: أثر البرنامج النصي المخصص للمجال على تحليل الوكيل subgraph Before["قبل البرنامج النصي"] A1["بيانات خام مبعثرة"] --> A2["بحث في الأعمدة والأسطر"] A2 --> A3["إجابات متناقضة"] end subgraph After["بعد البرنامج النصي"] B1["برنامج نصي يصنف المستندات"] --> B2["تصنيفات ونقاط خروج"] B2 --> B3["تحديد دقيق للسبب الجذري"] end Before -->|"إضافة نموذج ذهني"| After ```
[26:44](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1604s) رفع مستوى المطورين وتحويل المعرفة الضمنية إلى أدوات
لا تقتصر فائدة البرامج النصية المخصصة للمجال (domain-specific scripts) على الوكلاء فحسب، بل تمتد لتفيد المطورين البشر بشكل كبير. يشير جويل إلى أن هذا المبدأ ينطبق على جميع الأدوات التي شاركها خلال المحاضرة: فامتلاك مولدات (generators) أفضل وأدوات RuboCop أفضل يفيد الوكلاء ويُحسّن تجربة المطورين في آنٍ واحد. ومن خلال السعي إلى رفع مستوى النموذج اللغوي الكبير، ينتهي الأمر برفع مستوى جميع المطورين في الفريق، لأن هذه البرامج النصية تعالج الثغرات المعرفية وتوثق "المعرفة الضمنية" (tacit knowledge) التي غالبًا ما تكون مبعثرة بين أعضاء الفريق.
ولتوضيح ذلك عمليًا، أخذ جويل مخرجات البرنامج النصي الذي كتبه ووجهها إلى أداة لعرض البيانات (data visualizer)، ليحصل على تصور بصري دقيق لحالة خط أنابيب البيانات في أي لحظة، مما مكّنه من تحديد مواطن الخلل والنقاط التي تحتاج إلى مزيد من التدقيق والتحقيق. ويؤكد أن هذا النوع من العمل سهل للغاية في بيئة Rails بفضل أداة `Rake` ونصوص `Shebang` البرمجية، حيث يمكن للمطورين كتابة نصوص برمجية جانبية تحصل تلقائيًا على جميع الميزات التي تحتاجها من إطار عمل Rails.
[28:07](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1687s) التحسين المستمر وأتمتة المراجعة عبر مهارة الاسترجاع (Retro)
على الرغم من تعدد الآليات المتاحة لتحسين أداء الوكيل من خلال قراءة الإشارات المحيطة به وتوجيهه، يحذر جويل من إغراء دمجها جميعًا في التطبيق دفعة واحدة. بدلًا من ذلك، ينصح بتبني بيئة من التحسين المستمر والتركيز على المشكلات الفعلية التي تواجه المطور. في كل مرة تضطر فيها إلى تصحيح خطأ ما، عليك أن تسأل نفسك: "كيف يمكن أن تكون هذه هي المرة الأخيرة؟ كيف يمكنني تزويد النظام بالأدوات اللازمة ليتمكن الوكيل من تصحيح أخطائه بنفسه في المرة القادمة دون الحاجة إلى تدخلي المباشر؟" وعندما يجد المطور نفسه عالقًا في "الدوامة البشرية" (human loop)، عليه أن يبحث عن طريقة للخروج منها عبر تمكين النموذج اللغوي الكبير من الوصول المباشر إلى الأدوات لقراءة البيانات أو كتابتها بنفسه.
ولمساعدة المطورين على تحسين أنظمتهم (harness)، يطرح جويل مجموعة من الأسئلة التشخيصية: - أين كان عليّ التدخل؟ وما الإشارات المفقودة؟ - هل كان عليّ نسخ أي شيء يدويًا ذهابًا وإيابًا؟ - هل هناك أي شيء في ملف `AGENTS.md` كان من الممكن تنفيذه بشكل أفضل وبشكل حتمي (deterministic)؟ - هل تدهورت المحادثة؟ وهل كان من الممكن تقسيمها إلى محادثات متعددة؟ - هل تكررت أي أخطاء؟
وبما أن طرح كل هذه الأسئلة يتطلب جهدًا كبيرًا — ويعترف جويل مازحًا بأنه يكون كسولًا أحيانًا كمطور — فقد قام بتجميع هذه الأسئلة في "مهارة استرجاعية" (retro skill). يقوم بتشغيل هذه المهارة بعد الجلسات الطويلة مع النموذج اللغوي الكبير، حيث تحلل سجل المحادثة وتقترح عمليات أتمتة يمكن تنفيذها. المهارة متاحة على حسابه في GitHub تحت اسم `joelq/skills`، كما أشار إلى أن مات بوكوك (Matt Pocock) أصدر مؤخرًا (في الأسبوع الذي سبق المحاضرة) مهارة تؤدي نفس الوظيفة وتحمل نفس الاسم `retro`، مما يعني أنها قد تكون موجودة بالفعل في مستودعات المطورين الذين يستخدمون حزمة مهاراته.
[30:13](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1813s) نصيحة لنفسي في يناير والخاتمة
يعود جويل بالذاكرة إلى حالته في شهر يناير، حين كان يشعر بالإحباط في نهاية يومه الأول ويتساءل أين تذهب كل جهوده. لو أتيح له أن يوجه نصيحة لنفسه آنذاك لرفع الحد الأدنى لجودة الكود، للخصها في نقطتين جوهريتين: 1. **تغيير النموذج الذهني:** التوقف عن أسلوب "التلقين والانتظار" (prompt and pray)، وتذكر أن الوكيل عبارة عن حلقة (loop)، وأن الانخراط في هذه الحلقة يسمح له بتصحيح نفسه وكتابة كود أفضل دون تدخل بشري. 2. **إصلاح النظام لا الخطأ فقط:** عند مواجهة أي خطأ، لا تكتفِ بإصلاحه أو المطالبة بحل أفضل، بل أصلح النظام (harness) نفسه حتى لا يكرر الوكيل هذا الخطأ في المرة القادمة — فهذا هو جوهر "هندسة النظام" (Harness Engineering).
يختتم جويل كينفيل محاضرته بالتعريف عن نفسه كمطور رئيسي (Principal Developer) في شركة thoughtbot وأحد مقدمي بودكاست *The Bike Shed* على موقع `bikeshed.fm`. ويدعو المهتمين بتنفيذ عمليات أتمتة معقدة — مثل مسار معالجة المستندات الذي استعرضه — أو الراغبين في تحسين مخرجات وكلاء الذكاء الاصطناعي لديهم إلى التواصل معه ومع زملائه في thoughtbot، مشيرًا إلى أنه اضطر لحذف الكثير من المواد من المحاضرة لضيق الوقت وأنه سيتواجد في زاوية القاعة للنقاش وتبادل الأفكار مع الحضور.
## Notable quotes > [00:12](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=12s) If AI writes your code in an hour but cleaning it up takes two days, better prompting won't fix it. — Joël Quenneville
> [03:28](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=208s) Treating the LLM as a black box where prompts go in and code comes out is an outdated chat-era mental model. — Joël Quenneville
> [08:32](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=512s) As context windows grow, probabilistic adherence to instructions degrades. — Joël Quenneville
> [13:14](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=794s) Always generate migrations using Rails generate migration — Joël Quenneville
> [13:14](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=794s) Claude, if you try to write to the database migration directory, you are forbidden. You are not allowed to write new files to database migration. — Joël Quenneville
> [13:14](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=794s) By making the easiest path also the correct one, you drastically reduce the chance of workarounds and guide the agent toward doing the right thing. — Joël Quenneville
> [19:10](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1150s) It is far easier to critique existing code than to predict every program that could possibly be created. — Joël Quenneville
> [23:18](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1398s) when a measure becomes a target, it ceases to be a good measure. — Joël Quenneville
> [25:00](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1500s) حسنًا، حاول الآن إيجاد السبب الجذري — جويل كينفيل
> [28:07](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1687s) كيف يمكن أن تكون هذه هي المرة الأخيرة؟ كيف يمكنني تزويد النظام بالأدوات اللازمة ليتمكن الوكيل من تصحيح أخطائه بنفسه في المرة القادمة دون الحاجة إلى تدخلي المباشر؟ — جويل كينفيل
> [30:13](https://www.youtube.com/watch?v=L6-3a_rwLIg&t=1813s) عند مواجهة أي خطأ، لا تكتفِ بإصلاحه أو المطالبة بحل أفضل، بل أصلح النظام (harness) نفسه حتى لا يكرر الوكيل هذا الخطأ في المرة القادمة — جويل كينفيل
## Mentioned Joël Quenneville, thoughtbot, Ruby on Rails, Shopify, Anthropic, Claude, Cursor, Cloud Code, Codex, RuboCop, Brigitta Bockler, Rachel, Code Climate, Playwright, Goodhart's Law, Rake, Matt Pocock, GitHub, The Bike Shed
## Video description If AI writes your code in an hour but cleaning it up takes two days, better prompting won't fix it. Joël Quenneville (thoughtbot) explains why an agent is really a loop, and how to lean into that loop to raise the floor on the Rails code it writes. He moves judgment out of AGENTS.md and into deterministic tools like custom RuboCop cops, generators, hooks, focused review skills and domain-specific scripts.
***
Thank you Shopify for sponsoring the editing and post-production of these videos. Check out insights from the Engineering team at: https://shopify.engineering/
#RailsWorld #RubyOnRails #AI #CodingAgents #HarnessEngineering #RuboCop
[Source](https://www.youtube.com/watch?v=L6-3a_rwLIg)