Free lesson

Give context and a bounded request

Give context and a bounded request — Coding agents: small changes you can verify. Write repository guidance; Ask for a concrete behavior; Confirm the proposed scope. Practical assignment: Lab evidence.

Demo edition. The materials are undergoing editorial review.

Topics covered

  • Write repository guidance
  • Ask for a concrete behavior
  • Confirm the proposed scope

Write repository guidance

AGENTS.md should name the test command, permitted files and external-action boundary. It supplies context; it does not override actual tool permissions or user authorization.

The fictional repository calculates workshop reservation totals. Its small size lets you inspect every changed line and reproduce every test yourself. An assistant proposal is evidence of a suggested change, not proof that the code ran or that an external action was authorized. Keep secrets and unrelated repositories out of context. Check the tool’s actual permission settings rather than assuming a prompt creates a sandbox.

# AGENTS.md
Training repository only.
Change total.mjs and total.test.mjs only.
Use node --test. No new dependencies.
Do not deploy, publish, send data, or change billing.

Ask for a concrete behavior

Ask the assistant to reject negative, fractional and nonnumeric seats while preserving valid totals. Include example inputs and acceptance checks; avoid a vague improve-the-code request.

The prompt preserves price behavior deliberately to keep the repair inspectable. That is a teaching boundary, not a claim that arbitrary prices are safe in production. If review reveals price validation is needed, record a separate task with its own contract and tests.

Work on a dedicated branch in a clean training repository. Save files exactly as named and run the given commands from its root. Before asking for an edit, capture the current failing behavior and the intended passing behavior. Keep the allowed files and dependency policy explicit. Review any generated shell command before execution, especially if it installs software, contacts a service or discards working files.

Inspect total.mjs first. Change only seat validation.
Accept total(3,20) = 60 and total(0,20) = 0.
Reject seats -1, 1.5 and "3" with RangeError.
Keep price behavior unchanged in this exercise.
Add meaningful tests and report actual results.

Confirm the proposed scope

Read the plan for unrelated refactors, new dependencies and hidden network actions. Request a narrower patch when those changes do not serve the stated behavior.

A useful completion report names the behavior changed, the exact checks executed and any remaining uncertainty. A test command shown in prose is not a passed test; preserve its actual exit result. Review both the patch and the test quality before committing. A successful unit test does not authorize deployment, billing changes or sending repository data to another service. Those are separate actions with their own scope.

Practical assignment

Lab evidence

Continue to learning

Course outline

  1. Create a reviewable repository
  2. Give context and a bounded request
  3. Make the smallest justified edit
  4. Test the defect and the boundaries
  5. Handle approvals and suspicious instructions
  6. Review, commit and roll back safely