Skip to content
Go back

Stop repeating yourself with Claude Code's # shortcut

Published:  at  07:12 AM

Every session, same conversation. “Use tabs not spaces.” “Run tests before committing.” “Our API uses snake_case, not camelCase.” “The database is PostgreSQL, not MySQL.”

Claude doesn’t remember any of it. So you repeat yourself. Again.

Table of contents

Open Table of contents

The problem with starting fresh

Claude Code sessions are stateless by default. Every time you start a new conversation, Claude knows nothing about your project preferences, your team’s conventions, or that one weird thing about your codebase that trips up everyone.

You can use conversation history to resume old sessions, but that doesn’t help when you’re starting fresh work. And you shouldn’t have to dig through old conversations just to remind Claude how you like your imports organized.

The fix: type # and never repeat yourself again

Here’s how it works. Type # followed by any instruction, and Claude saves it to persistent memory:

# Always use TypeScript strict mode
# Run npm test before suggesting commits  
# Our database is PostgreSQL, not MySQL
# Prefer functional components over class components

When you hit enter, Claude prompts you to choose where to save it:

These instructions load automatically at the start of every session. No reminders needed.

How I actually use this

I start every new project with a CLAUDE.md file. Whether it’s something I’m building from scratch or a codebase I’m taking over that hasn’t been introduced to Claude Code yet, the first thing I do is have Claude review everything in the repo. We work through it together, file by file, and build up that initial context.

Then as we work, I use # to add to the file whenever something comes up.

Some are simple operational things:

# Run linting after updating any file
# Format code before suggesting commits

Others are the bigger architectural decisions you really want to establish before you start:

# Our database is PostgreSQL, not MySQL
# Auth tokens are stored in httpOnly cookies, not localStorage
# All API routes go through /api/v2, legacy /api/v1 is deprecated

Ideally you get those out of the way upfront. But sometimes you have to move fast and break things. That’s just how it goes. You’re three days into a project before you realize Claude keeps suggesting MySQL syntax, and now you’re correcting the same thing for the fifth time.

That’s when you type # Our database is PostgreSQL and never think about it again.

Building an onboarding doc one instruction at a time

Here’s what clicked for me. Every time something trips up Claude, I add a # instruction. Over a few weeks, my project’s CLAUDE.md became a living document of institutional knowledge.

# Our auth middleware is in /lib/auth, not /middleware
# Use Prisma for database queries, not raw SQL
# The staging API is at api-staging.example.com
# Never modify the legacy/ folder without approval

New team members who use Claude Code inherit all of this automatically. No onboarding doc to maintain separately. No “as I mentioned before…” frustration. The context just exists.

Why this actually matters

I used to spend the first few messages of every session re-establishing context. Now I just start working.

Keep using the shortcut. Keep adding to it as you work. It changes how quickly you can move because you stop fighting the same battles over and over.

Found this in Anthropic’s best practices guide1 under the memory section. If you haven’t discovered the double-tap Escape trick to edit your previous prompts, that one’s a game changer too.


Footnotes

  1. Claude Code Best Practices



Next Post
How to edit your previous prompt in Claude Code