AI Engineering Handbook

Purpose

AI engineering is the practice of integrating AI assistants into the software development lifecycle to improve productivity, quality and decision-making.

This handbook defines the principles, patterns and practices for using AI effectively throughout the engineering lifecycle.

It builds upon the Engineering Fundamentals Handbook and Software Architecture Handbook, applying their principles to the AI context.

Scope

This handbook covers:

Capability-specific AI guidance is in the AI Workflow documents for each capability (e.g., AI Workflows for Rails).

Principles

AI Augments, Does Not Replace

AI accelerates engineering work but does not replace engineering judgement.

Human Responsibility is Final

Every engineering decision ultimately belongs to a human.

AI-generated code, designs, documentation or analysis must be reviewed by a human before acceptance. AI can assist, but it cannot be held accountable.

Context is the Primary Lever

The quality of AI output depends directly on the quality of context provided.

Investing in clear, well-structured context produces better results than optimizing prompts in isolation.

Verify Everything

AI systems make mistakes confidently.

Every AI output must be verified:

Prefer Structured Inputs

AI performs better with structured inputs than unstructured ones.

When providing context, prefer:

Context Engineering

Context engineering is the practice of providing AI systems with the information they need to produce useful output.

Context Categories

CategoryWhat to Include
ScopeWhat are we trying to accomplish? What are the
boundaries?
ConstraintsWhat limits apply? Time, technology, performance,
compliance.
StandardsWhat conventions, style guides or patterns should
be followed?
ExamplesWhat does good output look like? Provide samples.
ReferencesWhat documents, code or resources should the AI
reference?
QualityWhat criteria define success? How will the output
Criteriabe evaluated?

Context Sources in This Repository

The framework provides rich context for AI:

When using AI for engineering work, reference these documents in your prompts.

AI Workflow Patterns

Pattern 1: Draft and Refine

Start broad, then refine through iteration.

  1. Provide high-level context and ask for a draft.
  2. Review the draft and identify gaps or issues.
  3. Provide specific feedback and ask for revision.
  4. Repeat until the output meets quality criteria.

Best for: Documentation, design proposals, initial code generation.

Pattern 2: Constrain and Generate

Provide tight constraints and ask for a focused output.

  1. Define the exact scope, format and quality criteria.
  2. Provide reference examples and standards.
  3. Ask for the specific output.
  4. Verify against the constraints.

Best for: Code generation with specific requirements, test generation, configuration generation.

Pattern 3: Analyse and Advise

Ask AI to analyse existing work and provide recommendations.

  1. Provide the work to be analysed (code, design, text).
  2. Specify the analysis criteria.
  3. Ask for specific recommendations.
  4. Evaluate recommendations using engineering judgement.

Best for: Code review, design review, performance analysis, security review.

Pattern 4: Explore and Discover

Use AI to explore alternatives and identify blind spots.

  1. Describe the problem and your current approach.
  2. Ask for alternatives or considerations you might have missed.
  3. Evaluate each alternative against your criteria.
  4. Document the exploration for future reference.

Best for: Design exploration, architecture decisions, problem diagnosis.

Verification and Validation

Verification Checklist

Before accepting AI-generated output:

Common Failure Modes

Failure ModeDescriptionMitigation
HallucinationAI generates plausible but incorrectVerify facts against authoritative
information.sources.
Over-confidenceAI presents incorrect output with highAlways verify, especially when AI
certainty.seems confident.
Style driftAI output diverges from project conventionsProvide style references in
over multiple interactions.context.
Context lossAI loses track of earlier context in longPeriodically recap context in
conversations.long sessions.

Integrating AI into Team Practices

Code Review with AI

AI can assist human code review by:

AI should not replace human reviewers. AI is a first pass; human reviewers focus on design, trade-offs and context.

Architecture with AI

AI can assist architectural work by:

AI cannot evaluate organisational context or business strategy.

Testing with AI

AI can assist testing by:

AI-generated tests must be reviewed for correctness and completeness.

Related Documents