0Pricing
AI Prompt Engineering · Lesson

Providing Background Information

When and how to include domain knowledge, constraints, and project details.

Providing Background Information is a free AI Prompt Engineering lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AI Prompt Engineering learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Background Information Matters

Background information gives the model the facts it cannot know on its own: your specific project details, your team's constraints, your existing work, and your stakeholders' expectations.

Without background, the model generates for an imaginary generic situation. With background, it generates for your situation.

When to Include Domain Knowledge

Include domain knowledge in your prompt when:

  • The topic has multiple interpretations across industries
  • You are working with specialized terminology
  • The correct answer depends on domain-specific norms or regulations
  • The model might give a general answer when you need a field-specific one

Do not paste entire textbooks — summarize the 2-3 domain facts most relevant to your specific question.

import anthropic

client = anthropic.Anthropic(api_key='sk-ant-your-key-here')

domain_knowledge = (
    'Domain: algorithmic trading at a regulated broker-dealer in the US. '
    'Relevant rules: SEC Rule 15c3-5 (Market Access Rule) requires pre-trade risk checks. '
    'Latency budget: all risk checks must complete in under 100 microseconds. '
    'Stack: C++ for the matching engine, Python for strategy logic.'
)

response = client.messages.create(
    model='claude-opus-4-5',
    max_tokens=300,
    messages=[{
        'role': 'user',
        'content': (
            f'{domain_knowledge}\n\n'
            f'Question: How should we implement position limit checks for our order router?'
        )
    }]
)
print(response.content[0].text)

Including Project Details

Project details tell the model the specific context of your work. Essential project details include:

  • What the project is and its current stage (MVP / scaling / mature)
  • The technology stack and architecture
  • Team size and skill levels
  • Timeline and deadline pressures
  • Recent changes or events that affect the question
import openai

client = openai.OpenAI(api_key='sk-your-key-here')

project_context = (
    'Project: a mobile recipe app (React Native, Node.js backend, MongoDB). '
    'Stage: pre-launch, 2 weeks to go live. '
    'Team: 2 frontend devs, 1 backend dev, no dedicated QA. '
    'Current issue: app search is slow (3-5 seconds) with 50,000 recipes in the DB. '
    'Constraint: no time for a full re-architecture before launch.'
)

response = client.chat.completions.create(
    model='gpt-4o',
    messages=[{
        'role': 'user',
        'content': (
            f'{project_context}\n\n'
            f'Suggest 3 quick wins to improve search speed before launch. '
            f'Each suggestion: what to do (1 sentence), estimated effort (hours), '
            f'expected improvement.'
        )
    }]
)
print(response.choices[0].message.content)

Sharing Existing Work

Sharing your existing work lets the model build on what you have already done instead of starting from scratch. Include existing work when you want:

  • Continuation or extension of a document or code
  • Critique and improvement suggestions
  • Style matching (match the tone and format of what exists)
  • Consistency checking (does this new piece fit the existing structure?)
import anthropic

client = anthropic.Anthropic(api_key='sk-ant-your-key-here')

existing_intro = (
    'At Northlight Labs, we build AI tools that work the way humans think — '
    'not the other way around. Founded in 2022 by two ex-Google researchers, '
    'we have helped 500 companies ship smarter products without hiring ML teams.'
)

response = client.messages.create(
    model='claude-opus-4-5',
    max_tokens=200,
    messages=[{
        'role': 'user',
        'content': (
            'Here is our existing company intro paragraph:\n\n'
            f'{existing_intro}\n\n'
            'Write a second paragraph (matching this exact tone and style) '
            'that describes our flagship product: an API that lets developers '
            'add natural language search to any database with 3 lines of code. '
            'Keep it under 60 words.'
        )
    }]
)
print(response.content[0].text)

Describing Constraints Upfront

Constraints are the rules the model must work within. Stating them upfront prevents the model from suggesting perfectly valid ideas that happen to be impossible in your situation.

Types of constraints to include:

  • Technical: 'Python 3.11, no third-party libraries'
  • Budget: '$0 — open-source only'
  • Time: 'Must be done in a 2-hour sprint'
  • Regulatory: 'No personally identifiable information in logs'
  • Organizational: 'Cannot change the database schema'
import openai

client = openai.OpenAI(api_key='sk-your-key-here')

response = client.chat.completions.create(
    model='gpt-4o',
    messages=[{
        'role': 'user',
        'content': (
            'We need to add rate limiting to our REST API.\n\n'
            'Constraints:\n'
            '- Python 3.11 FastAPI application\n'
            '- No external dependencies beyond what is already installed (requests, pydantic, uvicorn)\n'
            '- Must work as a single process (no Redis, no shared state between workers)\n'
            '- Rate limit: 100 requests per minute per IP address\n'
            '- If limit exceeded, return HTTP 429 with Retry-After header\n\n'
            'Show me a complete implementation.'
        )
    }]
)
print(response.choices[0].message.content)

Stakeholder Information

Stakeholder information tells the model who else matters in your situation. Stakeholders shape what risks to highlight, what objections to address, and what success looks like.

  • 'My audience includes the CFO who is skeptical of AI investments'
  • 'This will be reviewed by our legal team before publication'
  • 'The end user has accessibility needs — screen reader compatible'
  • 'Our CTO prefers simple solutions over clever ones'
import anthropic

client = anthropic.Anthropic(api_key='sk-ant-your-key-here')

stakeholder_context = (
    'This proposal will be reviewed by:\n'
    '1. CTO: cares about technical risk and maintainability, skeptical of microservices\n'
    '2. CFO: cares about cost, wants to see clear ROI numbers\n'
    '3. VP Engineering: cares about developer experience and team morale\n'
    'The CTO has veto power.'
)

response = client.messages.create(
    model='claude-opus-4-5',
    max_tokens=400,
    messages=[{
        'role': 'user',
        'content': (
            f'{stakeholder_context}\n\n'
            f'Write a 3-paragraph executive summary for a proposal to migrate '
            f'our monolith to a modular monolith (not microservices). '
            f'Address each stakeholder\'s top concern in a separate paragraph.'
        )
    }]
)
print(response.content[0].text)

The Chronological Method

For complex situations, the chronological method structures background information as a timeline of events. This helps the model understand causality and current state.

Format:

  • What the situation was before
  • What changed or happened
  • What the current state is
  • What you need help with given this sequence
import openai

client = openai.OpenAI(api_key='sk-your-key-here')

chronological_background = (
    'Timeline:\n'
    '- 6 months ago: We launched v1 of our API with a flat pricing model ($99/month).\n'
    '- 3 months ago: Power users (top 10%) started consuming 80% of compute.\n'
    '- 1 month ago: We introduced usage-based pricing — power users complained loudly.\n'
    '- Current: 12% of power users have churned; new signups are up 15%.\n'
    '- Goal: Keep power users without losing the new-signup growth.\n'
)

response = client.chat.completions.create(
    model='gpt-4o',
    messages=[{
        'role': 'user',
        'content': (
            f'{chronological_background}\n\n'
            f'Suggest 3 pricing model adjustments that could address both groups. '
            f'For each: describe the change, who it benefits, and the revenue risk.'
        )
    }]
)
print(response.choices[0].message.content)

Using Your Own Data as Background

One of the most powerful uses of background information is injecting your own data — metrics, logs, outputs, or research — directly into the prompt so the model can reason about your specific numbers.

Always paste the data in a clean, readable format. Tables and structured lists work best. Raw text dumps are harder for the model to parse.

import anthropic

client = anthropic.Anthropic(api_key='sk-ant-your-key-here')

metrics_data = (
    'Weekly active users (WAU) last 8 weeks:\n'
    'Week 1: 1,200  |  Week 2: 1,350  |  Week 3: 1,290  |  Week 4: 1,400\n'
    'Week 5: 1,380  |  Week 6: 1,220  |  Week 7: 1,100  |  Week 8: 980\n'
    'Note: We launched a pricing change in Week 5.'
)

response = client.messages.create(
    model='claude-opus-4-5',
    max_tokens=300,
    messages=[{
        'role': 'user',
        'content': (
            f'{metrics_data}\n\n'
            f'Analyze the trend, identify where decline began, '
            f'and suggest 2 hypotheses for the cause. '
            f'Be specific — reference the exact weeks in your analysis.'
        )
    }]
)
print(response.content[0].text)

What NOT to Include as Background

Background information has a cost: token usage. Include only what directly affects the answer.

Typically unnecessary background:

  • Company founding story (unless brand voice matters)
  • Team org chart (unless decision authority matters)
  • Historical context older than the decision window
  • Technology you are NOT using
  • Problems already solved that are unrelated to the current question

When in doubt: include it once, see if the output improves, then trim on subsequent runs.

# Contrast: bloated vs lean background
bloated_background = (
    'Our company was founded in 2018 by Alice and Bob. '
    'We have 45 employees across 3 offices. We use Jira for project management. '
    'We had a product refresh in 2020. Our CTO came from Amazon. '
    'We use Slack, Notion, and Linear. '
    'We once tried Kubernetes but moved back to Docker Compose. '
    'Question: How should we handle database connection pooling in FastAPI?'
)

lean_background = (
    'Stack: FastAPI, PostgreSQL, deployed on a single 8-core server. '
    'Load: ~200 concurrent users peak. '
    'Current issue: seeing "too many connections" errors under load. '
    'Question: How should we handle database connection pooling?'
)

print('Bloated background:', len(bloated_background.split()), 'words')
print('Lean background:', len(lean_background.split()), 'words')
print('Reduction:', round((1 - len(lean_background.split())/len(bloated_background.split()))*100), '%')

Formatting Background for Readability

How you format background information affects how well the model processes it. Best practices:

  • Use labeled sections: Stack:, Constraints:, Goal:
  • Use bullet lists for parallel items
  • Put the most important information first
  • Separate background from the task with a blank line or clear marker
  • Use consistent terminology — do not call the same thing by two names
import openai

client = openai.OpenAI(api_key='sk-your-key-here')

# Well-formatted background
formatted_background = (
    '=== BACKGROUND ===\n'
    'Project: real-time chat API\n'
    'Stack: Python FastAPI, WebSockets, Redis pub/sub, PostgreSQL\n'
    'Scale: 10,000 concurrent connections target\n'
    'Constraints: single server for now, no Kubernetes\n'
    'Current problem: messages are occasionally delivered out of order\n'
    '=== TASK ===\n'
    'Explain the root cause of out-of-order message delivery in WebSocket pub/sub '
    'and suggest the simplest fix for our stack.'
)

response = client.chat.completions.create(
    model='gpt-4o',
    messages=[{'role': 'user', 'content': formatted_background}]
)
print(response.choices[0].message.content)

Reusable Background in the System Message

If you are building an AI-powered application and the same background applies to all conversations, put it in the system message rather than repeating it in every user turn.

This is more efficient and ensures consistent context across all interactions without the user having to re-state it.

import anthropic

client = anthropic.Anthropic(api_key='sk-ant-your-key-here')

# System message carries reusable background for every user turn
system_background = (
    'You are an AI assistant embedded in Northlight Labs\' internal developer portal. '
    'Background: our stack is Python 3.11, FastAPI, PostgreSQL 15, Redis 7, Docker. '
    'We follow Google Python style guide. All code examples must include type hints. '
    'We do not use ORM — raw SQL with psycopg3. '
    'Our API follows REST conventions with snake_case JSON fields.'
)

# Now every user turn gets this background automatically
response = client.messages.create(
    model='claude-opus-4-5',
    max_tokens=300,
    system=system_background,
    messages=[
        {'role': 'user', 'content': 'Show me how to insert a row into the users table.'}
    ]
)
print(response.content[0].text)

Knowledge Check

A product manager wants AI help writing a feature announcement email. They include: company founding year, number of employees, office locations, and then their task. What type of background is missing that would most improve the output?

Providing Background Information — Recap

Good background information is the difference between generic advice and advice that actually fits your situation. Key principles:

  • Include domain knowledge that affects the correct answer for your field
  • Share project details: stack, stage, team size, recent changes
  • Include existing work when you need continuation or style matching
  • State constraints upfront to prevent useless suggestions
  • Include stakeholder information so the model addresses the right concerns
  • Use the chronological method for complex situational context
  • Keep background lean — include only what affects the answer

Frequently asked questions

Is the “Providing Background Information” lesson free?

Yes — the full text of “Providing Background Information” is free to read here on the web, and the AI Prompt Engineering course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AI Prompt Engineering course, upgrade to CoddyKit PRO.

What will I learn in “Providing Background Information”?

When and how to include domain knowledge, constraints, and project details. You practise AI Prompt Engineering with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start AI Prompt Engineering?

No prior experience is required. AI Prompt Engineering on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Providing Background Information” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this AI Prompt Engineering lesson?

Yes. Every AI Prompt Engineering lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Context Means in AI Prompting
  2. Providing Background Information
  3. Setting the Scene Effectively
  4. Context Length and Relevance
← Back to AI Prompt Engineering