# How can I use ChatGPT or Claude to learn Ruby without it doing the learning for me?

Source: https://poignantguide.net/answers/read/how-can-i-use-chatgpt-or-claude-to-learn-ruby-without-it-doing/
Site: Poignant Guide Ruby Q&A, category AI tools and learning to code
Published: 2026-11-26. Updated: 2026-11-26. Replies: 0.

## Question by Odile Marchetti (staff), 2026-11-26

Use the assistant as a tutor that explains and quizzes you, not as a typist that hands over finished code. Write your own attempt first, ask for a hint before an answer, have it explain each line, then run everything in irb. If you cannot predict what a line prints before you run it, you have not learned it yet.

## Why this needs a plan

AI tools are now an everyday part of programming. The [Stack Overflow 2025 Developer Survey](https://survey.stackoverflow.co/2025/ai) reports that 84% of respondents use or plan to use AI tools in their development process, up from 76% the year before. Among people who said they were learning to code, 39.5% used them daily.

The same survey shows why checking matters. More developers said they distrust the accuracy of AI tools (46%) than trust it (33%), and only 3% reported highly trusting the output. Experienced developers were the most cautious. Treat an answer from any assistant as a claim to test, not a fact. Checked on 12 November 2026; the survey is a snapshot of 2025.

Learning is different from finishing a task. If the assistant writes the method, you get a method that works and a head that has not changed.

## The method: attempt, hint, explain, verify

1. **Attempt.** Write your own version first, even if it is wrong. A wrong attempt tells you what you are missing.
2. **Hint.** Ask for a nudge, not the solution.
3. **Explain.** Once you have working code, ask for a line by line explanation in plain words, then say it back in your own words.
4. **Verify.** Run it in irb and check each method against the Ruby docs.

Some tools are built to support this. The [Claude Code output styles documentation](https://docs.claude.com/en/docs/claude-code/output-styles) describes a "Learning" style in which Claude explains its choices and leaves small pieces of code for you to write, marking the spot with a `TODO(human)` comment. Even without a special mode, you can ask for the same thing in your first message.

## Prompts that teach, and prompts that do the work

| Instead of | Try |
| --- | --- |
| "Write a Ruby method that reverses words." | "I wrote this method (pasted). It prints the wrong thing. Give me a hint, not the fix." |
| "Fix this error." | "Explain this error message line by line. What should I check first?" |
| "Explain blocks." | "Quiz me on blocks with three short questions. Wait for my answers." |
| "Give me the finished script." | "Review my script and point out one thing to improve. Do not rewrite it." |

## Checking an AI answer: a worked example

Assistants sometimes invent methods that sound plausible. Here is how to catch one in irb. Say you were told to use `sum_of_squares`:

```ruby
nums = [1, 2, 3]
nums.respond_to?(:sum_of_squares)   # => false
nums.respond_to?(:sum)              # => true
nums.sum { |n| n * n }              # => 14
```

`respond_to?` asks an object whether it has a method of that name. The invented method does not exist, but `sum` does, and it takes a block. The [Ruby reference manual](https://docs.ruby-lang.org/en/3.3/Array.html) is the final word on what Array can do. Look up every method an assistant uses that you have not met before.

## Mistakes beginners make

1. **Pasting the whole assignment.** You get code you cannot explain. Your instructor may also have a rule on AI help, so read the course policy before using any tool on graded work.
2. **Believing the confident tone.** A fluent explanation can still be wrong. Run the code.
3. **Skipping the typing.** Copy and paste does not build the habit. Type the lines yourself.

## Check this in order before you trust an answer

1. Can you say what each line does without looking?
2. Does it run in irb on your Ruby version (`ruby -v`)?
3. Does every method it uses exist in the docs for that version?
4. Can you break it on purpose and explain the error? The thread [What does undefined method for nil:NilClass mean](/answers/read/what-does-undefined-method-for-nilnilclass-mean-and-how-do-i-fix-it/) helps with that step.
5. Can you rewrite it tomorrow from memory?

Two other threads make this checking easier: [How do I use irb and binding.irb](/answers/read/how-do-i-use-irb-and-bindingirb-to-try-and-debug-ruby-code/) for poking at code, and [How do I write my first Ruby test with Minitest?](/answers/read/how-do-i-write-my-first-ruby-test-with-minitest/) so a test, not the assistant's word, decides whether code is right. The guide's [Expansion Pak 1](https://poignantguide.net/ruby/expansion-pak-1.html) on irb is the best place to build that habit.

---
Cite as: Poignant Guide Ruby Q&A, "How can I use ChatGPT or Claude to learn Ruby without it doing the learning for me?", https://poignantguide.net/answers/read/how-can-i-use-chatgpt-or-claude-to-learn-ruby-without-it-doing/, accessed 2026-11-27.
