How a code project is laid out
Recognise the usual parts of a project: source folders, entry point, config files, README, test folder and ignored files. Know where to look first in an unfamiliar repo.
Builds on: Terminal basics: where you are and running things
A new project: where is anything?
A colleague shares a project folder. You `cd` into it, run `ls -a`, and see names like `README.md`, `pyproject.toml`, `src`, `tests`, `.gitignore` and `.venv`.
You want to know three things. What does this program do? Which file runs first? Which folders are the real code, and which can you ignore? Opening files at random will take an hour. Is there a faster way?
Projects reuse the same few roles
Most projects follow **conventions**: habits shared by programmers, so newcomers know where to look. The names change with the language, but the same roles repeat:
- a description for humans
- a settings file for the tools
- a folder of real code
- one starting file
- code that checks the code
- generated clutter
Once you can spot these roles, any project becomes readable. An AI coding agent is a tool that reads, runs and edits the files in a folder for you. When you start one in a project, it uses the same conventions to find its way.
The parts checklist
- **README** (`README.md`): what the project is and how to run it.
- **Config file** in the project root: `pyproject.toml`, `package.json`, `Cargo.toml`, `go.mod`. It holds the project name, the libraries it uses and often the commands to run it.
- **Source folder**: `src/`, `app/`, `lib/`.
- **Entry point**: the file that runs first, e.g. `main.py`, `index.js`, `cli.py`.
- **Test folder**: `tests/`, `test/`.
- **Ignored files**: listed in `.gitignore`. These are downloaded libraries (`.venv/`, `node_modules/`), caches (`__pycache__/`) and generated output (`dist/`). Output is rebuilt from the source, so edits made there are lost.
Reading a real project root
Names starting with `.` are hidden, so plain `ls` skips them and `ls -a` shows them. `.` and `..` stand for this folder and the folder above it. `.git` is git's own data (git is the tool that records versions of your files), so leave it alone.
`.gitignore` lists what git should not track. Here that is:
- `.venv/`: downloaded libraries
- `__pycache__/`: Python's cache files
- `output/`: generated output
The last two aren't in the listing yet. They appear only once the code has run.
$ ls -a
. .. .git .gitignore .venv README.md
pyproject.toml src tests
$ ls src
invoicer
$ ls src/invoicer
__init__.py cli.py pdf.py totals.py
$ ls tests
test_pdf.py test_totals.py
$ cat .gitignore
.venv/
__pycache__/
output/
Where to look first, in order
1. **README**: its usage section shows `invoicer <file.csv>`.
2. **Config file**: the scripts section of `pyproject.toml` has `invoicer = "invoicer.cli:main"`. This means the command `invoicer` runs the function `main` in `invoicer.cli`, which is the file `src/invoicer/cli.py`. The command exists once the project is installed. That file is the entry point.
3. **Entry point**: read `main`, then follow its `import` lines into `totals.py` and `pdf.py`.
4. **Skip** `.venv/`, and also `__pycache__/` and `output/` once they appear. They are not this project's code.
`tests/` mirrors the source folder: `test_totals.py` checks `totals.py`.
Remember
Read the README first, then the config file in the root, then the entry point. Follow its imports into the source folder. Skip anything listed in `.gitignore` when reading: downloaded libraries, caches and generated output are not the code you work on. Never fix things in generated output, because it is rebuilt from the source.
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.