<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/enforcing-your-ruby-style-guide-on-ai-generated-code-flixahyod" -->

---
title: Enforcing Your Ruby Style Guide on AI-Generated Code
description: A practical guide to enforcing Ruby style conventions on AI-generated code in Rails projects using Claude Code hooks. The approach, called harness engineering,...
canonical: https://daily.dev/posts/enforcing-your-ruby-style-guide-on-ai-generated-code-flixahyod
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Enforcing Your Ruby Style Guide on AI-Generated Code | daily.dev
og:description: A practical guide to enforcing Ruby style conventions on AI-generated code in Rails projects using Claude Code hooks. The approach, called harness engineering,...
og:url: https://daily.dev/posts/enforcing-your-ruby-style-guide-on-ai-generated-code-flixahyod
og:image: https://api.daily.dev/og/posts/FLiXaHYOD.png
og:image:alt: Enforcing Your Ruby Style Guide on AI-Generated Code
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Enforcing Your Ruby Style Guide on AI-Generated Code

**[thoughbot](https://daily.dev/sources/thoughbot)** · 11 min read · 1 upvotes · 0 comments

## Summary

A practical guide to enforcing Ruby style conventions on AI-generated code in Rails projects using Claude Code hooks. The approach, called harness engineering, combines feedforward rules (a CLAUDE.md file and .claude/rules/) with a feedback loop: a Stop hook that runs RuboCop against any Ruby files the agent touches, auto-corrects what it can, gives the agent one chance to fix remaining violations, and surfaces what it can't. The post also covers creating a .rubocop_strict.yml to prevent silencing critical cops (ThreadSafety, Lint/Debugger) and writing a custom RuboCop cop to deterministically block inline disable directives for those cops.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://thoughtbot.com/blog/enforcing-your-ruby-style-guide-on-ai-generated-code>

## Similar posts on daily.dev

- [Stop AI Spaghetti: Enforcing Rails Architecture in 2026](https://daily.dev/posts/stop-ai-spaghetti-enforcing-rails-architecture-in-2026-ocxjimlhf) · Ruby Flow · 0 upvotes · 0 comments
- [How do you know the software is working?](https://daily.dev/posts/how-do-you-know-the-software-is-working--8tsgxuywp) · Ruby Flow · 0 upvotes · 0 comments
- [My Harness: How I stopped babysitting AI and went kitesurfing](https://daily.dev/posts/my-harness-how-i-stopped-babysitting-ai-and-went-kitesurfing-3uyqgo837) · Ruby Flow · 7 upvotes · 2 comments
- [AI in Focus: A new Claude Skill for Rails code audits](https://daily.dev/posts/ai-in-focus-a-new-claude-skill-for-rails-code-audits-rz5imfffg) · thoughbot · 1 upvotes · 0 comments
- [Code Audits in the Days of AI](https://daily.dev/posts/code-audits-in-the-days-of-ai-wr9p0hjzm) · thoughbot · 0 upvotes · 0 comments

---

Tags: [#ruby](https://daily.dev/tags/ruby), [#rails](https://daily.dev/tags/rails), [#claude-code](https://daily.dev/tags/claude-code)

[View this post on daily.dev](https://daily.dev/posts/enforcing-your-ruby-style-guide-on-ai-generated-code-flixahyod)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Enforcing Your Ruby Style Guide on AI-Generated Code","url":"https://daily.dev/posts/enforcing-your-ruby-style-guide-on-ai-generated-code-flixahyod","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/enforcing-your-ruby-style-guide-on-ai-generated-code-flixahyod"},"datePublished":"2026-06-08T00:13:47.357Z","dateModified":"2026-06-11T10:19:51.750Z","description":"A practical guide to enforcing Ruby style conventions on AI-generated code in Rails projects using Claude Code hooks. The approach, called harness engineering,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/bf1e856cc39beab1987b6202e62e3395?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/bf1e856cc39beab1987b6202e62e3395?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"thoughbot","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"thoughbot","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/9fe12feb57f944a29ff63a79e350081a","url":"https://daily.dev/sources/thoughbot"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/enforcing-your-ruby-style-guide-on-ai-generated-code-flixahyod","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ruby,rails,claude-code","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"thoughbot","item":"https://daily.dev/sources/thoughbot"},{"@type":"ListItem","position":3,"name":"Enforcing Your Ruby Style Guide on AI-Generated Code"}]}
```

