Building a Background English Coach into Claude Code

The author, a non-native English speaker, built a system using Claude Code's hooks to automatically analyze their prompts for grammar mistakes and unnatural phrasing, rewrite them in clean English, and log the results for later review.

đź’ˇ

Why it matters

This system demonstrates a clever way to leverage Claude Code hooks to enhance the user experience and improve language skills for non-native speakers.

Key Points

  • 1The author frequently writes grammatically questionable prompts in Claude Code, which they want to improve
  • 2The system uses the UserPromptSubmit hook to catch each prompt, send it to a separate claude --print process for grammar analysis, and append the results to a log file
  • 3The system runs entirely in the background, never touching the main coding session, and costs nothing extra on top of the Claude Max plan
  • 4The author uses an environment variable to prevent an infinite recursion loop when the hook triggers the background process

Details

As a software engineer who uses Claude Code extensively, the author found that their non-native English skills often resulted in grammatically questionable prompts. They built a system using Claude Code's hooks to automatically analyze these prompts, rewrite them in clean English, and log the results for later review. The system works by catching each prompt submission using the UserPromptSubmit hook, sending the prompt to a separate claude --print process for grammar analysis, and appending the results to a grammar-log.md file. To prevent an infinite recursion loop, the author uses an environment variable to signal between the parent and child processes. The entire system runs in the background, never touching the main coding session, and costs nothing extra on top of the Claude Max plan. This provides a practical, real-world use case for Claude Code hooks and helps the author improve their English skills as a side effect.

Like
Save
Read original
Cached
Comments
?

No comments yet

Be the first to comment

AI Curator - Daily AI News Curation

AI Curator

Your AI news assistant

Ask me anything about AI

I can help you understand AI news, trends, and technologies