Lesson 3.1: Implement with Quality

Module: 3 — Build
Time: ~45 minutes
Format: I Do — Concepts


What is ce-work?

ce-work is the execution phase of the Compound Engineering loop. It wraps the full implementation cycle — reading the plan, running the build, running quality gates, verifying against acceptance commands — so you finish a feature in one focused run.

Use it when:

  • You have a clear plan and are ready to implement.
  • You’re mid-implementation and need to stay focused and verify as you go.
  • You want to hand off a partially completed feature to yourself (resuming later).

The execution loop

ce-work runs this loop:

1. Read the plan → confirm scope, blockers, acceptance commands.
2. Implement phase-by-phase → one phase at a time.
3. After each phase:
   a. Run quality gates (lint, types, tests).
   b. Verify against acceptance commands.
   c. If a gate fails → fix before moving to the next phase.
4. When all phases pass → proceed to commit.

The key discipline is not moving to the next phase until the current one passes its gates. This prevents late-stage surprises and keeps the review surface small.


Quality gates

Every phase should run through these before declaring done:

GateCommandThreshold
Lintnpm run lint (platform) / ruff check . (Python)Zero errors
Typesnpm run types (platform) / mypy . (Python)Zero errors
Testsnpm run test:unit (platform) / pytest (Python)All pass
Buildnpm run build (platform only — do not run during sessions)Pass

In a real work session, you run what applies. During this learning exercise, run the relevant ones for your project.


Phase execution in practice

Using the Dagster example from the Plan module:

Phase 1 — Slack client setup

  1. op read item brainforge/slack-webhook to get the URL.
  2. Add the webhook URL to your local .env (never commit it).
  3. Write a small test script that calls the Slack client and verifies a message appears in #pipeline-alerts.
  4. Run lint and type checks.

Phase 2 — Error handler integration

  1. Edit notification_handler.py to add the Slack call in notify_run_failure().
  2. Trigger a deliberate failure in the local Dagster dev instance.
  3. Watch #pipeline-alerts — confirm the message arrives within 60 seconds.
  4. Run tests.

Phase 3 — Unit test

  1. Write test_notify_failure_slack with mocking.
  2. Run pytest pipelines_tests/test_notification_handler.py -v.
  3. Confirm all tests pass and coverage meets threshold.

Invoking the skill

/ce-work

Describe your current plan phase and where you are in the loop. The skill will help you stay disciplined about gates and verification.


Check your understanding

  1. Why should you run quality gates after each phase, not just at the end?
  2. Name the four quality gates for a platform (Next.js) project and a Python (Dagster) project.
  3. A phase’s acceptance command says “message appears in pipeline-alerts within 60 seconds.” You trigger the failure and nothing appears after 90 seconds. What do you do?