Breaking Down Task Comments

From Plan to Action

In our previous lessons, we learned how to create a high-level technical plan. This plan acts as our map. Now, we are ready to move from planning to building. Our goal is to add a comments feature to our task management app. This feature allows users to add comments to tasks, see a list of comments, and delete their own comments.

If we ask an AI like Codex to "Build the whole comment system," it might get overwhelmed and make mistakes. Instead, we take our technical plan and break it into small, executable steps. This ensures that the code is high-quality and easy to test.

In the CodeSignal IDE, you will find that the libraries we use, like SQLAlchemy for databases and Pytest for testing, are already installed. You can focus entirely on the logic of building your feature.

Decomposing the Comments Feature

To build a feature successfully, we group our work into logical phases. We call these atomic tasks. A task is atomic if it focuses on one thing, affects only a few files, and can be finished in one sitting — usually in under 2 hours.

For our comments feature, we split the work like this:

PhaseTask IDFocusDependencies
FoundationT001, T002database model and repositoryNone
Business LogicT003, T004services and validation schemasT001, T002
API LayerT005, T006endpoints and authorizationT003, T004
IntegrationT007Final end-to-end testsAll previous

By following this order, we ensure that we never build a "roof" (the API) before we have a "foundation" (the database).

Defining Task Requirements (The Template)

Every task needs a clear set of instructions so that Codex knows exactly what "done" looks like. We use a standard template for this. Let's look at the requirements for our first task, T001.

Task Template: [T001] Create Comment Model

  • Files Modified: src/models/comment.py, tests/unit/test_comment_model.py.
  • acceptance criteria:
    • Model defined as a SQLAlchemy declarative model with proper Python type hints.
    • Fields: id (Integer, primary key), task_id (Integer, Foreign Key), author_id (Integer, Foreign Key), content (String), created_at (DateTime).
    • Relationships: task (to Task model), author (to User model).
    • All foreign key columns explicitly marked as nullable=False.
    • unit tests verify field types, relationships, and timestamp handling.
  • Dependencies: None.
  • Estimated Time: 45 minutes.

Notice the checkboxes. These are called acceptance criteria. They act as a checklist for both you and Codex. If every box is not checked, the task is not finished.

Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal