The AI-Assisted Engineering Workflow: Feed Context, Use Skills, and Rethink Code Review
Today I'm writing to share how I use AI to assist development. After many iterations, I think this AI development workflow is fairly complete. If you have different opinions after reading, feel free to comment.
In the past, when developers did development, the main focus was on learning how to write good code and how to make code more elegant; now it's more about studying how to make AI write good code.
AI is like a top-notch programming expert, but it just arrived and isn't familiar with your business, your project background, or your code preferences. So if you want it to do a good job, you have to tell it as clearly as possible about these backgrounds and rules.
Let me share my insights on using AI to assist development. I think for AI to complete tasks with high quality, it depends mainly on two points:
- Provide correct and sufficient context
- Give clear instructions
When both conditions are met, AI can basically complete tasks well. On the other hand, if context is missing or instructions are vague, AI will guess and make decisions on its own where it doesn't understand, resulting in uneven quality, hallucinations, and deviation. It's like a leader giving a vague command to a subordinate. Some subordinates will proactively come back to ask for clarification before doing anything, while others don't ask and just work based on their own understanding, eventually leading to problems.
Let me give two negative examples:
One is when requesting a feature, you only say "help me build an order placement function like Taobao" or "add a coupon system to the system." How coupons are obtained, whether they can stack, how they're calculated during refunds, when inventory is deducted, these rules are all unspecified. AI can only invent a table structure and business logic on its own, and the code it writes is basically unusable.
The other is when fixing a bug. A user reports "the order list page occasionally loses an item when paging" and you just throw the symptom to AI and say "fix it." If AI can't see production logs or access the database, it can only speculate against the code, possibly adding a frontend filter or de-duplication to mask the superficial problem. The real cause is that the backend pagination query only sorts by creation time, so when two orders are generated in the same second, the page order goes wrong.
If we provide AI with sufficient context and instructions, the process is completely different: with the same pagination-loses-data ticket, AI first queries the log system for the request parameters at that time, then connects to the production read-only database to see those records generated in the same second, pinpointing the root cause. Then it traces through the code repository to check other interfaces using the same sorting pattern, and produces a fix plan—add a unique primary key sorting fallback and corresponding integration tests. We only need to review the plan, and after confirming it's fine, the subsequent code changes, test runs, and PR descriptions are all done automatically by AI.
To make daily development follow this latter process, it's unrealistic to manually type a long prompt every time. You need to first build the supporting infrastructure and workflow. Here's an overall workflow diagram; below I'll break down how each part is done:
How to Provide Correct and Sufficient Context
Now when building infrastructure, you need to revolve more around AI, thinking about how to make AI work better, not just around humans. Actually, a lot of things were already built around R&D, but previously only humans could see them; now you need to open access to AI.
Specifically, the context AI needs includes: logs, data, ticketing systems, code repository, business knowledge, engineering knowledge, and historical project decisions. Roughly it can be divided into two parts: "what's accumulated in the code repository" and "integration with external systems."
1. Maintain Business Knowledge and Engineering Knowledge in the Code Repository
The code repository is the easiest place for AI to read at any time. Engineering knowledge includes the project's tech stack, directory structure, server and CI configurations, local check commands, etc. You can put common rules in a description file at the repo root (e.g., AGENTS.md), and if the frontend/backend or specific modules have special requirements, put them in corresponding subdirectory description files. AI reads the rules for the code it's modifying.
Business knowledge and general knowledge are also best maintained directly in the code repository for AI to find anytime. Two habits keep documentation from going stale: first, when submitting a PR that changes code or fixes a bug, require syncing updates to the corresponding docs; second, do a weekly knowledge cleanup where AI updates the repository's business knowledge, general knowledge, architecture diagrams, and business flow diagrams based on the latest code, production data, and logs.
2. Open External System Permissions via MCP and Environment Variable Tools
Just looking at static code and documentation in the repository isn't enough to locate complex production issues. For systems like monitoring, databases, ticketing, and office software, you can open read-only permissions to AI via read-only API keys or MCP (an interface that lets AI directly connect to external tools and data). When problems arise, you don't need to manually look them up and copy them over; AI can call what it needs on demand.
When configuring these read-only keys, you don't need to manually write them in local .env files either. There are many tools for managing environment variables and secrets (e.g., Infisical, Doppler, 1Password CLI, etc.) that can pull and inject credentials at runtime, so you don't have to leave plaintext config files everywhere locally, making management much easier.
Usually, you mainly need to connect these blocks to AI:
- Log and monitoring systems (e.g., Grafana, Datadog, Sentry, PostHog, etc.): The frontend and backend business processes and important nodes should be instrumented. In a phase that heavily relies on AI writing code, these logs are not written for humans but for AI. With complete tracing and logs, any production incident allows AI to trace from the problem point back to the source step by step, knowing how the fault reproduces, and then combined with business context from the repo, give a reliable fix.
- Production read-only database: After opening read-only query access, AI can directly see how the data behind a problem changes, making analysis much more accurate than just reading code.
- Ticketing systems (e.g., Linear, Jira, ZenTao, etc.): Tickets record the initial symptom, investigation reasons, and discussion process. A complex ticket often spans a long period, possibly involving multiple code changes and multiple PRs. Letting AI read the ticketing system lets it know at any time what was previously done.
- Office chat software and Git history (e.g., Feishu, Slack, MS Teams, and historical Commits): Many business details and historical project decisions are scattered in work group messages and old commit records. Allowing AI to read relevant chat records, tickets, and historical commits via MCP helps it understand the project's background and not break existing logic due to lack of historical context.
With these foundations in place, AI has sufficient context every time it works on a requirement or fixes a bug.
How to Give Clear Instructions
Once you have context, you also need to give AI clear instructions.
What does a clear instruction mean? For example, when assigning a task, say clearly: what exactly to do, what the requirements and restrictions are, which file in the repo to reference, what verification conditions must be met after completion, and that at the end you should remember to update the ticket and add necessary logs.
Taking a more specific bug-fixing scenario: when you ask AI to analyze a production bug, a complete instruction usually looks like this: first read the production read-only database and logs, find out the problem from real evidence, don't just look at the surface and change directly; after finding the direct cause, don't just patch locally, continue to investigate the related upstream and downstream chain, confirm the real root cause and impact scope, to avoid fixing locally but causing other problems globally (e.g., fixing problem A but introducing problem B); if the module uses prompts, first distinguish whether it's missing context data or a model misjudgment.
The problem is that this long list of requirements cannot be manually typed and sent to AI every time you fix a bug; that's too troublesome. So a better approach is to distill this whole set of investigation requirements into a Skill (an instruction file placed directly in the project repository). In the future, when encountering a bug, just let AI call this "find root cause" Skill to investigate.
Following this idea, based on my own practice, you can also organize many other Skills for different development stages:
- Skill for writing implementation plans: Before starting a new requirement or complex change, first sort out the involved modules, data flow, and boundary conditions, produce a plan, and first spin up an Agent with an independent context to review the plan for loopholes, then a human confirms before starting.
- Skill for implementing code: Write in coding conventions and testing requirements. A very practical trick here: if your team doesn't have conditions to configure automatic Agent Review in CI, you can add an independent Review instruction at the end of the "implement code" Skill—requiring that after code is written and self-tested, a sub-Agent with independent context is spun up to review the change, catching obvious problems before submission.
- Skill for committing code and writing PR descriptions: Restrict commit from skipping local check hooks (like
--no-verify), and generate PR descriptions according to a fixed template—describing the problem symptom, relevant evidence from logs and database queries, root cause, fix plan, and linking the ticket number. - Skill for automatically handling CI and following up on comments: After committing, if CI checks fail or there are clear review change requests, have AI automatically read the error and fix it and push again, rather than waiting for a human to notice CI failure and then communicate with AI, which is too inefficient.
As Skills in the repository accumulate, you can do a simple usage statistic and clean up Skills that haven't been used for a long time to keep them lean. Another experience when setting business rules: structured data works better than modifying prompt text—rules that can be constrained through configuration fields, status tables, or code logic should not be piled into natural language prompts.
Changes in Testing and Code Review
When context and clear instructions are in place, AI writes code very fast and in large quantity. If you still use old methods of testing and manual line-by-line review, you'll end up being blocked in the acceptance and review stage.
1. Write tests for business behavior, use deterministic scripts to save tokens and prevent hallucinations
Write test cases directly targeting business behavior—how the business should behave, that's how the test should be. Writing unit tests for specific internal small functions isn't very necessary. For non-UI changes, write more integration tests; for web changes, use Playwright (or similar) to write E2E tests.
For example, after AI fixes a certain web issue, the first time you can let AI control the browser to run the real page for verification, and at the same time have it write corresponding Playwright E2E test cases, comparing the actual browser results with the E2E cases one by one to ensure the script is accurate. Once the cases are stable, later code changes can just run E2E tests, without having AI control the browser every time for the full flow—letting AI control the browser is not only token-intensive but can also occasionally cause hallucinations; using code to write E2E tests makes the behavior and results deterministic.
If the system has features that depend on business prompts, it's best to configure a Replay (回放) system; in normal times, collect real production cases and fixed edge cases (or clone production data and desensitize it locally for verification and replay). During CI, you don't need to run the full test suite on every commit—you can identify the scope of changes on CI and only automatically trigger the corresponding test cases to run replay when a PR modifies relevant prompts or their supporting config, preventing a prompt change that fixes the current problem from reintroducing old problems that were fixed earlier.
2. Say goodbye to line-by-line code review, shift to reviewing plans, evidence, and behavior
If you still carefully review the entire PR line by line like before, efficiency still hasn't improved. You've done so much work feeding context to AI and validating functionality through various automated tests, but then you get stuck in Code Review for dozens of minutes or even hours, which undoes the efficiency gains.
Since you're using AI, you don't need to force its code to be as extremely clean, low-coupling, and high-cohesion as human-written code. It's fine if it's passable, because ordinary business code isn't closely examined anyway. The focus should shift to verifying AI's behavior: as long as business behavior is correct and performance and stability meet standards, you don't need to be too picky about code style details.
If conditions allow, you can configure one or two AI automated PR Reviews in CI to help catch code-level issues first. When it comes to human review, don't read the entire code; mainly check two things:
- AI's PR description and summary (whether the symptom, log/database query process and evidence, root cause analysis, and fix plan hold up);
- A few key code files (like SQL change files, core permission configurations, etc.).
Control a limited number of review rounds. If these two points are fine, you can let it pass; don't let review become the bottleneck for efficiency.
Two Development Modes and Daily Inspections
Under this workflow, humans mainly do decision-making and validation, and the most time-consuming part is the fix plan review after the initial root cause investigation. As long as you hold the gate at the plan step, everything after that basically runs automatically.
But from my personal experience, even with sufficient context and clear instructions, AI's plans can still feel wrong or deviate, because AI does hallucinate. Faced with this problem, there are generally two schools of thought for implementation, each suited to different product types:
One is the cautious school, suitable for formal production core business or ToB products. Spend time carefully reviewing plans upfront (let several Agents review, then a human makes the final call). Afterwards, coding, local cloned data replay, running unit and E2E tests, controlling browser tests—all done by AI itself; if it finds issues during testing, it fixes them on its own. Finally, after submitting the PR, a human manually verifies the effect (if not confident, open the browser yourself and click through once), briefly checks the PR summary and key files, and if fine, merges.
The other is the aggressive school: humans only file tickets and pick up requirements and problems, letting AI fully automate and merge quickly to deploy, with humans directly looking at the production effect. If it's fine, continue observing; if there's a problem, fix quickly. Full automation can indeed cause pitfalls in complex large systems, but if it's internal tools, personal products, or early validation projects, adopting the aggressive approach is completely fine; the core is fast release, fast feedback, fast fix.
Regardless of the school, because AI inevitably lets some hallucinations slip through, it's best to finally set up a daily scheduled check as a safety net.
Every day, run a scheduled task to analyze whether core production data has anomalies, or specifically pick recently deployed PRs and check whether data and business behavior in the corresponding time period are normal, automatically generating a daily inspection report. If anomalies are found, send alerts to work software like Feishu or Slack. Many communication software now allow direct integration with AI. Upon seeing an alert, you can let AI fix it directly under the alert message—for example, have it create a ticket first, then query logs to locate the root cause, and submit a PR to fix it.
Finally, on Requirements for Engineers
The whole set described above is essentially an AI-native development workflow. Once infrastructure is in place, development automation is very high, and the human is left mainly to do decision-making and acceptance.
This also means R&D must understand the business very deeply—that's also why I think future R&D will basically become product engineers; those who don't understand product or business can easily be eliminated.
Incidentally, here's another insight: when discussing plans with AI, senior engineers still have an advantage. Because of a solid foundation, they can see at a glance which plan is better and which has hidden risks. When the foundation is weak, you might not be able to tell the difference between several plans and can only rely on AI's judgment.
So frontend and backend fundamentals still need to be mastered, and it's best to learn in a full-stack direction. Each area doesn't need to be extremely deep, because you can always ask AI for specific details you don't know; but breadth is a must. Only if you have a wide knowledge base, knowing what concepts and stages exist, will you know how to ask AI questions when problems arise. The more you know, the better questions you can ask; the better the questions, the higher the quality of AI's answers.
Top 2 of 4 from juejin.cn, machine-translated. The original thread is authoritative.
That example about missing an item when flipping pages hits the point—sorting only by creation time and having two orders in the same second causes pagination misalignment. This root cause can't be guessed from the code alone. Without logs and a read-only database, AI can only add front-end filtering to cover the surface. I accept this "evidence first, then act" order. But I don't fully agree with "code style just needs to be roughly acceptable." It works for small projects, but in a larger codebase, the "roughly acceptable" code AI accumulates becomes the next spaghetti mountain in three months. Review still needs a human to keep an eye on critical files. Is your team's "root cause" Skill written in the repository for everyone to share, or does each person maintain their own copy?
They're all shared in the repository; important skills go in the repo.
Actually, we reviewed code at first, but later we couldn't keep up. Now we only set repository directory conventions—for example, which frontend directories, what goes into `components` and `ui` directories, what each backend module directory holds. We don't manage the detailed code inside.
Like.