
What Claude Code provides for multi-file projects
Claude Code can:- Inspect the current working directory and list files and folders.
- Produce a project-level summary (entry points, route structure, DB layer, where business logic lives).
- Identify which files need changing for a cross-file task (for example, migrating a database driver).
- Execute or propose targeted refactors while respecting file-level constraints.
- Verify that intended changes were applied to the correct files.
Launching Claude Code from a project directory
Example of starting Claude Code in a local repo:Show the file structure
Ask Claude Code to show the repository layout. Example output:Project-level summary (condensed)
Claude Code can turn a file listing into an actionable summary. The following table captures the information from the example project:| Path | Role / Purpose | Notes |
|---|---|---|
| server.js | Main Express entry point | Mounts routers and configures middleware |
| config/database.js | DB connection pool | Uses pg for PostgreSQL pooling |
| routes/auth.js | Authentication routes | Contains /login endpoint and inline controller logic |
| schema.sql | Database schema | Users table, indexes, and timestamps |
- Route-controller pattern: server.js mounts auth routes at /api/auth; auth router contains inline controllers (no separate controller layer).
- Database: PostgreSQL with the pg client, connection pooling, bcrypt for password hashing, and JWT for tokens.
- How are routes connected to controllers?
- What database driver and pooling strategy are in use?
Example workflow: migrating PostgreSQL → MariaDB
When planning a migration (for example PostgreSQL → MariaDB), Claude Code lists affected files and the exact types of changes required. Files likely to need direct modification:| File | Change Required |
|---|---|
| package.json | Replace pg with mysql2 or mariadb dependency |
| config/database.js | Reimplement connection pooling using the chosen MariaDB client |
| routes/auth.js | Update parameter placeholder syntax (Postgres $1 → ?) and any client-specific query handling |
| schema.sql | Convert Postgres-specific SQL to MariaDB/MySQL equivalents |
- SERIAL PRIMARY KEY → AUTO_INCREMENT PRIMARY KEY
- Remove or replace
\cdatabase commands (useUSE dbnameor omit) - Review timestamp defaults, UUID usage, and any Postgres-specific data types
- .env: change default port (MariaDB usually 3306 vs Postgres 5432) and driver-specific connection variables.
Existing PostgreSQL connection pool (example)
Here is the typical pattern you might find in config/database.js when using Postgres. This is the code you would replace when migrating to MariaDB:Parameterized queries separate values from SQL, improving safety. Placeholder syntax differs between drivers — Postgres uses 2, …; many MySQL/MariaDB clients use
? or named placeholders. Update your query placeholders and any client-specific methods when switching drivers.File-level instructions and safety controls
Claude Code accepts precise file-level instructions:- Tell it exactly which files it may modify (e.g., only auth-related files).
- Or explicitly list files that must not be changed; Claude will warn if a requested modification would require touching those files.
- Provide contextual information about how files relate (for example: “server.js mounts the routers; auth logic lives in routes/auth.js”).
- Limit the list of files you paste — Claude Code already knows the repository layout and can focus on the relevant files.
Verifying refactors
After a refactor, ask Claude Code to:- Confirm which files were modified.
- Show diffs or summarize the applied changes.
- Run static checks (lint/test) or provide commands to run tests locally.
Do’s and don’ts
| Do | Don’t |
|---|---|
| Provide relationships between files for context | Paste huge unstructured file lists and expect manual sorting |
| Specify which files can or cannot be modified | Mix incompatible contexts without clear adaptation instructions |
| Ask for verification after changes | Assume a large refactor is safe without testing or review |
Summary
Claude Code helps you navigate multi-file projects by:- Mapping file structure and relationships,
- Summarizing architecture and responsibilities,
- Proposing and implementing targeted cross-file refactors (like DB migrations),
- Respecting file-level constraints, and
- Verifying the results.