Building Project Constitutions
Introduction to the Project Constitution
In software development, consistency is key. If three different developers work on a project without rules, the code will quickly become a mess. The same is true when working with Claude Code.
In Lesson 1, you learned WHY specifications matter for AI-assisted development. Before you write your first feature spec, you need to establish your project's foundation. A Project Constitution is a Markdown file that serves as the "source of truth" for your project. It defines the tools, the coding style, and the workflow that Claude must follow. By setting these rules at the start, you prevent Claude from making guesses about your tech stack or using outdated coding patterns. This lesson will show you how to write a constitution that ensures Claude acts like a senior engineer on your team.
What is CLAUDE.md?
CLAUDE.md is a special file that Claude Code automatically reads at the start of every session. It acts as your project's persistent memory and governance layer.
What Goes in CLAUDE.md?
The first part of a Constitution is defining the Tech Stack. This tells Claude exactly which languages and libraries to use. We also define Architectural Principles, which act as the blueprint for how the code should be organized.
By listing specific versions (such as Python 3.11+ or PostgreSQL 15+), you ensure Claude doesn't use old features or incompatible libraries. In your CodeSignal environment, most of these tools, such as FastAPI and Pytest, are already pre-installed, so you can start using them immediately.
Next, we add the Architectural Principles:
These rules tell Claude how to write the code. For example, the Repository Pattern is a rule stating that all code dealing with the database must be kept in a specific place. This makes the code easier to test and change later.
