
Inspecting a repository
Claude can list the repository contents and return a concise file tree so you can quickly understand the app layout:Example: Files affected by a database migration
Here’s an example list of files and the typical changes required when migrating from PostgreSQL to MariaDB/MySQL:
Notes:
- Using parameterized queries and a query builder/ORM improves portability.
- Placeholder syntax and pool configuration are the main code-level differences.
Example file: current PostgreSQL pool (before migration)
This is an exampleconfig/database.js using the pg client:
mysql2, you’d replace the pg Pool implementation with mysql2’s pool API and update query parameter placeholders and execution calls.
How Claude performs multi-file edits safely
Claude supports file-level operations and constraints. Examples of common workflows:- Inspect: Ask Claude to summarize the project structure and identify key components to target.
- Plan: Request a list of files and specific changes required for a migration or refactor.
- Restrict: Specify which files may be changed and which must remain unchanged.
- Apply & Verify: Have Claude perform the changes and then verify that the specified files were refactored.
When requesting modifications, specify the files that may be changed and which files must not be modified. This avoids accidental edits to unrelated parts of the codebase.
Practical dos and don’ts for multi-file work with Claude
- Do provide contextual groupings (for example, “the auth system consists of these three files”) instead of pasting every file.
- Do ask Claude to analyze relationships between files (routes → controllers → database) before making large changes.
- Don’t paste a massive, unrelated list of files without context; Claude already knows the repo structure and will reprocess unnecessarily.
- Don’t copy code from an unrelated stack (for example, React components) and expect it to work unmodified in a Node/Express application.
Why multi-file awareness matters
Multi-file analysis is especially valuable for:- Refactors where business logic moves between layers (routes → controllers → services).
- Migrations (databases, auth providers) that touch configuration, schema, and queries.
- Understanding legacy codebases where relationships span several files.