Core Principles for Working with AI
These are the rules every Xebia engineer follows whenever they work with GenAI, whatever their role or tool. Each rule is short on purpose. The role playbooks show how to apply them in daily work, and this page is what they all build on.
Some rules may already be built into your tool (for example, GitHub Copilot or Claude Code). Know them anyway, and apply the ones that fit your situation.
| If you need… | Go to |
|---|---|
| The basics, explained step by step with beginner exercises | Foundation |
| Tools, model selection, cost, data handling by tool, MCP security | Common playbook |
| How to apply these rules in your role | Discovery · Development · Quality · Data |
Core Principles
- You are the author of record. AI is your assistant and accelerator, not your replacement. You remain the expert and the final authority, and you are fully accountable for what you deliver. "The AI wrote it" is never a defense.
- Keep a human in the loop. Verify and decide at every step that matters. AI output never goes unreviewed into code, documents, or decisions.
- Communicate with precision. Quality inputs drive quality outputs. State the goal, the constraints, and the expected result, and give examples.
- Protect sensitive information. Understand your boundaries. Follow your organization's policies on when GenAI can be used and what data can be shared with GenAI tools. Before including sensitive information, verify that such information is approved to be shared with GenAI tooling. When in doubt, consult your security team or data governance guidelines.
- Control data usage. Ensure your inputs aren't collected for training or other purposes. Understand your platform's data policies and use privacy-preserving options when available.
- Ground AI in reliable sources. Anchor AI's knowledge in verified documentation, established facts, and authoritative sources. Don't let it operate purely from training data when you can provide specific, current information.
Prompting and Working with AI
Give the AI the context it lacks
The AI knows nothing about your situation or environment. Without context it can only give generic advice. With context it can spot patterns, respect your constraints, and avoid approaches that won't work for you. State the goal, the stack and versions, the constraints, what you have already tried, and the relevant code, logs, or data.
- ❌ "My API is slow. How can I make it faster?"
- ✅ "Our Node.js/Express endpoint on AWS Lambda (512 MB, PostgreSQL RDS) returns 50–200 order records and averages 2.5 s at peak hours. Here is the code and a log sample: […]. Which optimizations should I prioritize?"
Keep the context focused
More context is not always better. The quality of the answers drops well before the context window is full. As a rule of thumb, act once the context passes 50–60% of the window. The decline is gradual, and these are the signs: the AI forgets earlier decisions, contradicts itself, or fails to connect information that should inform its answer.
- Keep one topic per session. Share only the files and data the task needs, not the whole codebase.
- Split large work into focused sessions (for example, review authentication, then payments, then exports).
- Before the context degrades, ask for a summary of the decisions so far, then continue in a fresh session from that summary.
- Hand self-contained subtasks to subagents, so they run in their own context.
Tool-specific commands and costs: Agentic session economics, Handle context window limits.
Specify audience, expertise level, and output format
Say who the answer is for and what shape it should take. That means length, tone, depth, and structure: prose, table, bullets, JSON, or code. The format also changes how the AI reasons. A table forces a systematic comparison, and numbered steps produce actionable guidance. Setting the expertise level prevents both oversimplification and needless complexity.
- ❌ "Compare AWS, Azure, and GCP for our migration."
- ✅ "Create a table comparing AWS, Azure, and GCP for our database migration: managed database services, pricing model, migration tools, compliance certifications, EU regions. Max 2–3 sentences per cell, then a one-paragraph recommendation."
- ✅ "Explain microservices to a junior developer who has only worked with monolithic applications. Use analogies and simple examples."
Use personas for focus and tone, not knowledge
An expert persona ("You are a senior database architect with 15 years of experience") does not reliably make modern models more accurate. The effect is unpredictable, and a mismatched persona can even make the output worse. In a study of 162 roles across four model families and 2,410 factual questions, adding a persona to the system prompt did not improve accuracy, its effect was largely random, and automatically choosing the "best" persona was often no better than random selection (Zheng et al., Findings of EMNLP 2024). Anthropic's own guidance likewise describes a role as a way to focus Claude's behavior and tone (Prompting best practices). Use a role to narrow the lens, set the scope, or shape tone and style. Write clear task instructions first, and add a persona only when it serves the output.
- ❌ "You are a world-class database architect with 15 years of experience. What is the difference between SQL and NoSQL databases?"
- ✅ "You are a security auditor reviewing this API design. Identify potential vulnerabilities and compliance risks. Do not comment on performance or feature design."
Choose the prompting technique for the task
| Technique | Use when | Example |
|---|---|---|
| Zero-shot | The task is simple and well known | "Translate this text to German: […]" |
| Few-shot | You need a consistent format or style | A few (3–5) varied input → output examples, then the new inputs |
| Chain-of-thought / step-by-step | The problem needs reasoning you want to see and check | "Think step by step: pain points, team, readiness, dependencies, cost-benefit. Then recommend." |
| Meta-prompting | You are unsure how to approach the problem | "What information do you need from me to give the most helpful guidance? How should we approach this?" |
Match the model to the task
Larger models are not always better. They are slower and more expensive, and for many tasks a lighter model performs just as well. Use light models for classification, translation, and simple generation, mid-tier models for everyday implementation, debugging, and code review, and frontier models for complex reasoning, architecture, and security review. Don't chase every new release. Instead:
- Test candidate models on representative samples of your common tasks.
- Measure quality, speed, and cost.
- Keep a short model selection guide for your team.
- Review it quarterly as new models emerge.
How to compare models: Model selection strategy. Current tiers by task phase: Agentic session economics.
Iterate in small steps, then dig deeper
Break complex work down: outline first, then sections, then details. Review each step before building on it. Issues are cheap to fix when only 10% of the work is done and expensive at 90%. For example, list the services first, then define one service's API, then its data model, then one endpoint's contract.
Treat the first answer as a draft. Follow up on what matters: trade-offs, concrete examples, edge cases, security implications, sources. If you answer "OK, thanks", you are left with generic advice. Notice which follow-ups improve answers, and fold them into your next first prompt.
Security Principles for GenAI Usage
Get approval first: for the tools and for the data
- Client work: use GenAI only where the client or project stakeholders have explicitly approved it, and only with tools on their approved list. The client's security, compliance, and IT governance rules take precedence. Individual judgment never overrides policy.
- Internal work (research, capability building, internal tools): you may evaluate emerging tools, still with security scrutiny, but never with client data.
- Check the data classification. A tool approved for the project is not automatically approved for every data type. Some tools are cleared for internal or public data only. Confirm that this data's classification allows AI processing in this tool.
- Record what you used. For client work, document the AI tool you used, the data you shared with it, who reviewed the output, and the date.
- No suitable approved tool? Raise an evaluation request with your direct manager. Don't use an unapproved tool in the meantime.
- When in doubt, ask the client's security or compliance team, or your manager. Never assume it's fine, and never plan to ask forgiveness later.
🚩 Red flags of an unsafe tool: no clear privacy policy or terms; unclear ownership or jurisdiction; inputs used for training; no way to delete submitted data; no enterprise tier or security certifications; excessive permissions (such as a browser extension that wants access to all websites); a very new tool with no independent security reviews. If you see these signs, don't use the tool.
How each approved tool currently handles data: Data handling by tool.
Share the minimum, sanitized
Apply the principle of minimum necessary context, even in approved tools. Inputs may be logged or retained under the tool's data handling practices. Before you submit anything, remove:
| Category | Remove |
|---|---|
| Credentials & secrets | Passwords, API keys, tokens, connection strings, private keys and certificates, OAuth and session secrets |
| Personal data | Names, addresses, emails, national IDs, financial and health data |
| Proprietary information | Trade secrets and algorithms, client and partner names, contracts, internal codenames, unreleased products, internal hostnames and IPs |
Replace real values with consistent placeholders, and use environment variable references in any code you paste:
api.acme-corp.com→[API_ENDPOINT]sk_live_a1b2c3...→[API_KEY]Jan Kowalski→[CUSTOMER_NAME]password: 'MyS3cur3P@ss'→password: process.env.DB_PASSWORD
Removing names is not anonymization. Combined quasi-identifiers can re-identify a person, for example birth date, ZIP code, condition, and treatment dates. Such data is still personal or health data. Use synthetic data where you can.
Role-specific guidance: Prompt anonymization (BA), What to share and what to withhold (Data).
Verify every output
GenAI is probabilistic. It produces errors that sound confident and look authoritative: invented facts, citations, statistics, and API methods, with true and false statements mixed together seamlessly. Verification is your last line of defense.
- Code: the methods exist in the documentation for your versions; the logic handles edge cases; there are no security issues; tests and scanners pass in an isolated environment; a peer reviews it before merge.
- Facts: the source exists; quotes are real; statistics match the original data; claims match the primary text (the regulation itself, not an AI summary of it).
Learning material: Critical thinking about AI outputs.
Check IP and licensing
AI models are trained on copyrighted and licensed material and can reproduce it in code, text, and images. That can expose you and the client to legal liability.
- Licenses of suggested code and libraries. Safe: MIT, Apache 2.0, BSD, ISC. Careful: GPL (it can force open-sourcing), LGPL. Avoid: no license, proprietary without permission, patented algorithms.
- Suspiciously specific or polished code: search for distinctive fragments of it in public repositories, run code similarity detection, and record where the code came from.
- Tool settings: where the tool offers a filter that blocks suggestions matching public code, enable it.
Apply least privilege to AI tools and agents
An overprivileged AI is an attack vector. A compromised or prompt-injected agent gets everything it can reach, and a hallucinated command can delete data. Give AI access only to the data and tools the task needs:
- Read-only by default. No admin or root credentials, and no standing write access to repositories or databases. No production access unless it is justified, and then only read-only, narrowly scoped, and time-limited.
- Narrowly scoped, short-lived tokens. Expose only pre-approved tables or files, and no PII.
- Sandboxing: containers, network isolation, resource limits.
- Human approval for destructive or high-risk operations (deletes, DDL, deployments, production writes).
- A log of every AI-initiated action.
Details: MCP security risks, Protecting production data.
Software Development Best Practices for AI Usage
The developer who merges the change is its author of record and is fully responsible for its security, performance, and legal compliance, however much of it an agent wrote. The end-to-end workflow is in the Development playbook, and test strategy is in the QA playbook.
Review, test, and understand every change
Never commit code you couldn't explain and defend in a code review. Code you don't understand is a liability: you can't debug, maintain, or extend it. Common hidden issues in plausible-looking AI code:
- Assumed defaults (currency, locale, time zone)
- Missing idempotency (duplicate charges or records)
- Swallowed errors and silent failures
- Unvalidated input and injection risks
- Case sensitivity, nulls, negative and boundary values
Give architecture, standards, and current documentation as context
- Architecture: patterns, service boundaries, the approved stack, and what not to suggest. Without this context, the AI proposes generic solutions that conflict with your design and add technical debt.
- Coding standards: naming, structure, error handling. Keep them in the repository's instruction and rules files, and enforce them with linters. See Project instruction files.
- Version-specific documentation: because of its training cutoff, a model may suggest deprecated APIs or miss newer features. Provide the documentation for the versions you actually use (for example, through a documentation MCP server). This matters most for LLM SDKs, which change often.
Commit small and atomic
Each commit covers one responsibility, can be reviewed in 5–10 minutes, can be reverted on its own, and has a message that explains why the change was made and what you verified. Never git add . a whole AI-generated feature. A history of small commits shows which change introduced a bug and lets you revert only that change.
Demand tests that can fail
AI-generated code should come with tests, and those tests need checking too. AI-generated tests often only look like tests: they verify that a mock was called, assert "not null", cover only the happy path, or mock everything. Ask for, and check for:
- Assertions on specific expected values, testing behavior rather than implementation
- Coverage of happy paths, edge cases (null, empty, boundaries), error cases, and business rules
- Independent tests with realistic data, and mocks only where they make sense
- Proof that tests fail when they should: break the code on purpose and watch them catch it
Details: Writing good tests with AI, Test review.
Validate every dependency
Every dependency adds vulnerabilities, maintenance work, and supply-chain risk. Before accepting a suggested package, check:
- Necessity: can the standard library, or fewer than 50 lines of your own code, do this?
- Legitimacy: is it the official package (check for typosquatting), and is the maintainer reputable?
- Health: active maintenance, recent releases, no known vulnerabilities (
npm audit, Snyk, advisories) - Fit: license compatibility, the approved technology list, size, and transitive dependencies
Record the decision (for example, in an ADR). Watch out for deprecated or maintenance-only packages (request, moment), trivial ones (is-odd, left-pad), and packages that were sabotaged or compromised (colors, event-stream).
Review performance and scalability
AI optimizes for code that works, not code that scales. Code that is fine with 100 test records can fail with 100,000 real ones. Put the performance requirements in the prompt: volumes, peak load, p95 target, pagination. Then review the result:
- Time complexity (O(n) or O(n²)?)
- N+1 queries and loading data that isn't needed
- Pagination of large results, async I/O, caching and parallel processing opportunities
- Behavior at 10× and 100× the current data
You've now covered the core principles for working with AI. Next, open the playbook for your work, where these rules turn into concrete practice: Common playbook for tools, models and cost, then Discovery, Development, Quality or Data.