HOW-TO · DEV
How to delegate specific file tasks to an AI pair programmer while you focus on architecture
Target environment
Ubuntu 24.04 · Ollama 0.4.x
PREREQUISITES
AI pair programming setup in editor (Claude extension or similar), project with multiple source files
What this does
This guide describes a workflow for assigning targeted, bounded tasks to an AI pair programming tool—such as implementing a specific function, refactoring a single module, or adding error handling to a file—while the developer continues working on higher-level architectural decisions. Delegation reduces idle time and keeps the AI focused on well-scoped deliverables.
Steps
- Identify a task with a clear boundary: one file, one function, one refactoring, or one set of tests. Avoid broad tasks like "improve this module."
- Open the target file in the editor and position the cursor where the AI should focus its attention.
- Use the editor's AI chat input to issue a precise instruction: for example, "Add input validation and error logging to the
parseConfigfunction in this file." - Wait for the AI to propose a diff or inline edit. Review the proposed changes in the editor's diff view.
- Accept or modify the proposed changes based on project style and architecture alignment.
- Mark the task complete in the project tracking tool (e.g., GitHub issue, kanban board).
- Document the decision in a comment above the changed code if the rationale is non-obvious.
- Continue with architectural work while the AI handles the next queued file-level task.
Verification
# Check that the file was modified and lint passes
npx eslint src/utils/parser.js && echo "Lint passed"
# Expected output: Lint passed
Common failures
- Vague task scope: Asking the AI to "improve this module" produces inconsistent, scattered changes. Solution: decompose the request into one atomic change per instruction: one function, one import, one test file.
- AI modifies unintended files: The extension picks up context from other open tabs and changes files outside the target scope. Solution: close all unrelated files before issuing a delegation command, or explicitly name the file in the instruction: "in
src/parser.js, add validation." - Accepted changes introduce test failures: AI-proposed edits pass the linter but break existing tests. Solution: always run the test suite immediately after accepting AI edits. If tests fail, revert with
git checkout HEAD -- <file>and rephrase the task. - Context lost between tasks: The AI forgets the architectural constraints set in a prior session. Solution: maintain a
CONTRIBUTING.mdor project-specific instructions file that the AI extension can read as system context for each session.