Claude Code Saving Every Prompt

Claude Code – Using Hooks To Save Every Prompt

Claude Code Tutor - Tony Tam

As a Claude Code tutor with over 365 hours of teaching experience, one of the most valuable practices I teach my students is saving their prompts. This isn’t just about keeping a history—it’s about building a knowledge base that makes you more effective over time.

When we start to generate code using Claude Code (or other tools such as Gemini, Codex), the underly code matters much less because they can be rewritten, refactored and thrown away if need be.

But the original prompt from the human user becomes much more valuable to save so we know what the user intent was. Claude Code has the ability to hook into the ‘claude’ command line from the terminal so that we can have Claude Code save every prompt and every response into a set of files so that

  1. We will have a history of what prompts and responses from AI
  2. We will have the prompts as bundled as a set of commits along with the code

Why is this useful?

  1. Saving your prompts will let you unwind how you got to where you are
  2. You can then start building a prompt library without having to save prompts into a text file
  3. You can use the prompts to start building common skills (Claude Code Skills) so that you can replicate more deterministically what you might have spent 10 to 20 prompts to accomplish (I can blog about that later)
  4. Feed your prompts into another AI and you can build custom Claude Code commands or have AI improve your prompts in the future
  5. I’m sure there are other ideas out there

➜  thrive-pantry git:(main) pwd
/Users/tonytam/git/thrive-pantry

➜  thrive-pantry git:(main) ls -1 docs/prompts
PROMPTS-20251230.md
PROMPTS-20260109.md
PROMPTS-20260110.md
PROMPTS-20260111.md
PROMPTS-20260112.md
PROMPTS-20260113.md
PROMPTS-20260114.md

➜  thrive-pantry git:(main) less docs/prompts/PROMPTS-20260114.md
# Prompts and Responses Log

This file automatically logs all prompts and Claude's responses.

---

## Prompt
**Time**: 2026-01-14 20:44:45 | **Session**: 5ba29ac2

```
make tests
```

### Response

All tests passed: **202 passed, 10 skipped, 0 failures**.

I fixed two test issues:
1. `pantry_product_card_test.dart:130` - Changed `find.byType(InkWell)` to `find.byType(InkWell).first` to handle multiple InkWell widgets
2. `pantry_product_card_test.dart:320` - Renamed test from "hides Nutri-Score badge in selection mode" to "hides delete button in selection mode" and updated assertions to match actual widget behavior (the Nutri-Score badge is intentionally visible in selection mode, only the delete button is hidden)

---

## Prompt
**Time**: 2026-01-14 20:46:56 | **Session**: 5ba29ac2

```
push to github branch claude/issue-262-20260114-1656
```

### Response

Pushed successfully to `origin/claude/issue-262-20260114-1656`.

To Make this hook work

  1. Ask Claude Code to create a hook for you to save your prompts and response after every prompt
  2. Notice that the prompt files are in your project directories under docs/prompts/prompts-[yyyymmdd].md
  3. Remember to use the following words ‘create claude code skills’

If it worked, you should see in ~/.claude/hooks/

➜  hooks git:(master) ✗ pwd
/Users/tonytam/.claude/hooks

➜  hooks git:(master) ✗ ls
play-sound.sh   save_prompts.py


More Claude Code Tutorials