Junior Track Roadmap

AI: refactoring & extraction

This course reads a Rails app's Layer Contract against the app's own files. Services and query objects there return Result = Data.define(...) through a self.call class method. It starts with an audit of three controllers, which turn out to be thin already. It then reads a single-responsibility service, a service that orchestrates other objects inside one transaction, and query objects that answer cross-domain questions. The last lessons cover prompting an AI tool for an extraction that follows the app's conventions, and reviewing the result before it ships.

What you'll learn

  • ✓Auditing controller actions to separate HTTP orchestration from business decisions
  • ✓The Result = Data.define and self.call convention for services and query objects
  • ✓Single-responsibility services with an injected dependency and a bounded rescue
  • ✓Orchestrating other objects inside one transaction with an idempotent XP award
  • ✓Namespacing query objects by the business question they answer
  • ✓Writing specified extraction prompts and reviewing AI output against the app's conventions
Free preview · Lesson 1 3 min read

What extraction means in this app

This project's MEMORY.md states its architecture as a Layer Contract. Business logic lives in services, which return Result = Data.define(...). Read-only, cross-model questions live in query objects, which return the same kind of Result. Models keep validations, scopes and associations, with no…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...