In this final unit, you’ll explore how Codex can help you create entirely new files and populate them with useful content — just by describing what you want. This includes writing new Python files, generating code from scratch, and setting up files like unit tests.
This hands-on unit focuses on expanding your workflow to include file generation and scaffolding, making Codex a powerful tool not just for editing — but also for building.
Once you’ve launched Codex inside your project directory, try a natural prompt like:
Codex will:
- Create the new file
- Read the functions from
math_utils.py - Generate appropriate test cases using a testing framework like
unittestorpytest - Show you a preview before applying the change
You’ll have the chance to review the proposed content and approve it — or edit the suggestion before it’s applied.
Imagine your file math_utils.py contains this function:
Now you run Codex and type:
Codex might suggest creating a new file with this content:
You can then review and approve the file creation and content.
This technique is useful for:
- Generating boilerplate code
- Writing tests or config files
- Creating documentation stubs
- Starting new scripts or tools
You’ll save time by letting Codex scaffold the structure, while you focus on the logic.
In this unit, you learned how to use Codex to create new files and populate them with relevant code using natural language. This helps automate setup tasks and streamline the start of new files or components in your projects.
