Aulafy
Courses/Claude Code + Local AI/Debug and protect your work

Debug and protect your work

Sooner or later something will fail: a startup error, an installation that gets stuck, Claude Code doing something unexpected. It's not a disaster—it's part of building. This chapter gives you a calm method to fix it and, above all, to never lose your work or expose your data.

  • Read an error without panicking and fix it with Claude Code.
  • A step-by-step debugging method that works for everything.
  • Protect your keys, your personal data, and your backups.

Errors are messages, not punishments

Five-step debugging method

When something doesn't work, go in order. Don't skip steps:

  • Read the message. The last line usually says what's essential.
  • Isolate what changed. Did it work before? What did you do right before it failed?
  • Check the basics. Is Ollama running? Did you run npm install? Are you in the correct folder (pwd)?
  • Pass it to Claude Code with the full error and what you were doing.
  • One change at a time. Apply one fix, test, and only if it doesn't work, try the next.

The safety net: Git and backups

If you're afraid of "breaking something," the solution is being able to go back. You already saw this in the projects chapter, but this is where it really saves you:

TerminalCode
Algo se ha estropeado y no sé qué. Vuelve al último commit que funcionaba y explícame qué has revertido.

Protect your data and your keys

When your projects handle real information—invoices, client documents, API keys—security stops being optional.

  • Keys and passwords never in the code. They go in a .env file that doesn't get uploaded to the internet. Ask Claude Code: "make sure my keys are in .env and that .env is in .gitignore".
  • Don't upload personal data to GitHub. Before publishing, check that there are no client documents or real databases inside.
  • Be careful when building with sensitive data. The app runs locally, but Claude Code reasons in the cloud. Don't paste real confidential data in the chat while building; use fictional examples.
  • Real backups. A backup you've never tried restoring isn't a backup. Check from time to time that you can recover your data.
  • Git commit when something works.
  • Keys in .env, never in the code or on GitHub.
  • Copy the folder (and the database) off the computer from time to time.
  • Test from time to time that you know how to restore that backup.

Practice challenge

Trigger an error on purpose in a test project (for example, delete a line of code), observe the message, paste it to Claude Code, and fix it. Losing your fear of errors is what makes you truly autonomous.