Skip to main content

The Safety-First Pattern

Here's a pattern that separates beginners from experts when working with General Agents. Beginners hope nothing goes wrong. Experts establish safety before anything changes.

You know that sinking feeling. You're cleaning up your files, moving things around, maybe deleting some old downloads. Then suddenly you realize you just deleted something important. Your stomach drops. You dig through the Trash. It's not there. It's gone.

Everyone who has ever organized files has experienced this moment. The fear of losing something irreplaceable makes us hesitate. We start a cleanup project, get nervous halfway through, and abandon it. The chaos persists because we're afraid to touch it.

In the next 20 minutes, you'll learn the pattern that eliminates this fear entirely. Not by being more careful, but by establishing a safety net BEFORE you make any changes. You'll direct Claude Code to create a backup, verify it's complete, and only then proceed with confidence.

This pattern applies far beyond files. When you work with General Agents on code changes, data transformations, system configurations, or any workflow where mistakes have consequences, the safety-first pattern is what separates confident experimentation from anxious hesitation.

This is Principle 6 (Constraints and Safety) in action: the constraint of "backup first" enables fearless experimentation.


The Fear is Real

Before we dive in, acknowledge the legitimate concern: losing files is a real problem with real consequences.

What You Might LoseImpact
Tax documentsFinancial disaster
Family photosIrreplaceable memories
Work projectsCareer consequences
Research notesMonths of effort gone

This fear is rational. The solution isn't "be more careful." The solution is make it impossible to lose things permanently.


The Conversation

You're ready to organize your Downloads folder, but you're nervous about losing something important. Here's how to direct Claude Code to establish safety first.

You Start With Safety

You:

Before we make any changes to my Downloads folder, I want a backup of important files. Can you help me create one?

Claude Code:

Good thinking. Creating a backup before making changes is the safest approach. Before I create the backup, I need to understand what counts as "important" for you.

I can backup:

  • All files (complete safety, largest backup)
  • Files modified in the last N days (recent work you're actively using)
  • Specific file types (PDFs, documents, spreadsheets. Common important formats)
  • A custom selection (you tell me exactly what matters)

Which approach works best for you?

You Define What Matters

Notice what just happened. The agent didn't assume what you wanted. It asked. This is critical. Different people have different definitions of "important." A photographer cares about images. An accountant cares about spreadsheets. A researcher cares about PDFs.

You:

Let's backup all PDFs and any file modified in the last 30 days.

Claude Code:

That's a good combination. PDFs often contain important documents, and anything modified recently is likely something you're actively working with.

I'll create a timestamped backup folder and copy those files. Here's what I'm going to do:

  1. Create backup/downloads-backup-2025-01-27/ in your workspace
  2. Copy all .pdf files from Downloads
  3. Copy all files modified in the last 30 days
  4. Report what was backed up

Creating backup now...

Created: backup/downloads-backup-2025-01-27/
Copied: 47 PDF files (12.3 MB)
Copied: 89 recently modified files (156.2 MB)
Total: 136 files backed up (168.5 MB)

Backup complete. Want me to verify it's complete before we proceed?

You Verify the Backup

You:

Yes, verify the backup is complete.

Claude Code:

Comparing source and backup...

PDF files in Downloads:     47
PDF files in backup: 47 ✓

Recent files in Downloads: 89
Recent files in backup: 89 ✓

All files successfully backed up.

The backup matches the source. You now have a complete copy of your important files. If anything goes wrong during organization, you can restore from backup/downloads-backup-2025-01-27/.


What Just Happened?

Let's examine what the agent did and why it matters.

Principle 6: Safety First

The agent created a safety net BEFORE any destructive operation. This isn't just being careful. It's a fundamental pattern:

WRONG ORDER:
1. Start moving files
2. Realize you need a backup
3. Try to undo changes
4. Panic

RIGHT ORDER:
1. Create backup
2. Verify backup is complete
3. Make changes with confidence
4. If problems occur, restore from backup

The backup constraint ENABLES the changes. Without the safety net, you'd hesitate. With it, you can experiment freely.

Principle 3: Verification

Notice that you didn't just trust the backup worked. You asked the agent to verify it. The agent compared counts:

  • Source files → Backup files
  • Numbers match → Backup complete

This is verification in action. The agent could have said "Done!" after copying. Instead, you directed it to prove completeness. Trust, but verify.

The Agent Asked, Not Assumed

Here's the most important observation: the agent asked what "important" meant before acting.

A dangerous pattern would be:

You: "Backup my important files."
Agent: "Done! I backed up everything."

This is bad because:

  • The agent assumed "important" meant "everything"
  • You didn't define your criteria
  • The backup might be huge (or miss things you actually needed)

The safe pattern is what actually happened:

You: "Backup my important files."
Agent: "What counts as important? I can backup [options]..."
You: "PDFs and recent files."
Agent: "Here's what I'll do... [creates backup]"

The agent clarified before acting. This prevents misunderstandings that could lead to data loss.

The Agent's Toolkit: Backup Commands

Behind the scenes, the agent used these commands:

  • mkdir - make directory - creates the backup folder
  • cp - copy - duplicates files to the backup location
  • find - locates files matching your criteria (PDFs, recent files)

When the agent verified the backup, it compared counts:

find ~/Downloads -name "*.pdf" | wc -l    # Count source PDFs
find backup/ -name "*.pdf" | wc -l # Count backup PDFs

Same number? Backup complete. The verification isn't magic—it's systematic comparison using the same tools you learned in Lesson 1.


The Pattern

Here's the pattern you just learned, expressed as a reusable template:

Before Any Destructive Operation

"Before [making changes / reorganizing / deleting / moving],
create a backup of [what matters to me]."

Examples:

  • "Before reorganizing my Downloads, create a backup of all documents."
  • "Before deleting old files, create a backup of anything from the last year."
  • "Before renaming my photo folders, create a backup of the entire Photos directory."

After the Backup

"Verify the backup is complete."

This step is non-negotiable. A backup that fails silently is worse than no backup. It gives false confidence.

Only Then Proceed

"Now we can [make the changes]."

With verified backup in place, you can proceed with confidence.


The Safety-First Mindset

This pattern extends beyond file organization. It's a universal safety mindset:

DomainSafety-First Pattern
File organizationBackup before moving files
Code changesCommit before refactoring
Database updatesExport before modifying
System configurationSnapshot before changing settings

The common thread: create a reversible state before any irreversible action.


What Your Backup Enables

Your backup directory is now a safety net. Here's what it enables for the rest of this chapter:

ScenarioRecovery
Script miscategorizes filesRestore from backup
Accidentally delete somethingCopy back from backup
Want to try different rulesReset and experiment
Organization goes wrongStart fresh

In Lesson 5, you'll deliberately make a mistake and practice recovery. The backup you created now makes that learning safe.


Try It Yourself

Exercise 1: Backup Your Desktop

Open Claude Code and try this conversation:

Create a backup of my Desktop folder. What would you backup?

Observe how the agent clarifies before acting. Does it ask about file types? Recent modifications? Size limits?

Exercise 2: Define "Important Documents"

Try asking Claude Code:

If I asked you to backup my "important documents," what would you include?

See how the agent thinks about this. What criteria does it suggest? Do its suggestions match what you would consider important?

Exercise 3: Verify an Existing Backup

If you have a backup folder already, ask:

Verify that my backup in [folder] contains complete copies of [source folder].
Compare file counts and tell me if anything is missing.

Practice the verification step. The habit of confirming completeness.


Try With AI: Extended Practice

Prompt 1: Selective Backup Strategy

I want to backup my Documents folder, but it's 50GB. Help me create
a smarter backup that only includes:
- Files modified in the last 90 days
- Any file larger than 10MB (probably important)
- All PDFs regardless of date

Show me what this would capture before creating the backup.

What you're practicing: Compound backup criteria. You're learning to combine multiple filters (date, size, type) to create targeted backups instead of copying everything.

Prompt 2: Backup Verification Deep Dive

I have a backup folder from last week. Help me verify it's still valid:
- Are all the source files still in the backup?
- Did any source files change since the backup?
- Are there files in the backup that no longer exist in the source?

Give me a complete integrity report.

What you're practicing: Backup auditing. Real backups can become stale. You're learning to direct the agent to perform comprehensive verification, not just count files.

Prompt 3: Recovery Rehearsal

Pretend I accidentally deleted an important file called "budget-2024.xlsx"
from my Documents folder. Walk me through exactly how I would recover it
from my backup. Show me the commands but don't actually run them yet.

What you're practicing: Recovery planning. The best time to learn recovery is before you need it. You're practicing the restore workflow in a safe, hypothetical scenario.


Key Takeaways

Safety enables action. The backup constraint doesn't limit you. It frees you to experiment without fear.

Agents should ask, not assume. A well-designed agent clarifies ambiguous requests before acting. "Important files" means different things to different people.

Verification is non-negotiable. A backup that might have failed is worse than no backup. Always confirm completeness.

This pattern is universal. Backup-before-change applies to files, code, databases, and any system where actions might be irreversible.

In the next lesson, you'll design categorization rules for your files. The backup you created ensures that no matter how you organize, you can always recover.