跪拜 Guibai
← All articles
Frontend · Backend · AI Programming

The AI-Assisted Engineering Workflow: Feed Context, Use Skills, and Rethink Code Review

By 谭sir ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Teams that keep treating AI as an intern who guesses at missing requirements waste tokens and ship hallucinated fixes. This workflow shows the infrastructure and process changes needed to make AI autonomous enough to inherit full tasks, with humans reviewing only plans and evidence.

Summary

Making AI write dependable code in production starts with two conditions: enough correct context and explicit instructions. Context comes from opening up the codebase and external systems to the AI—maintaining AGENTS.md files with engineering rules, wiring read-only access to logging, monitoring, production databases, ticketing, chat history, and Git commits via MCP or API keys. Instructions get codified as Skills, instruction files in the repo that turn a vague "fix this bug" into a defined root-cause investigation: pull real evidence from logs and the DB, check the upstream and downstream chain, and only then propose a change.

Testing and review then shift shape. Tests target business behavior, not internal function signatures, with integration tests for non-UI code and Playwright E2E for web. A Replay system guards prompt-dependent features by only running related tests when a prompt changes. Code review stops being line-by-line; reviewers check the AI's PR description for solid evidence and inspect only high-risk files like SQL migrations or permission config. Teams then pick a mode: the cautious one, where humans approve the plan before AI executes the rest, suits core business and ToB products; the aggressive one, where AI merges and ships directly, works for internal tools and personal projects. Both need a daily automated scan that flags anomalies and alerts to Slack or Feishu, with AI handling the fix from there.

The payoff: the human becomes a decision-maker and validator, not a code writer. That demands deep business knowledge and a broad technical foundation, because the value of the engineer moves to asking the right questions and judging AI's plans.

Takeaways
— AI completes tasks well only when it receives correct, sufficient context and explicit instructions; missing either leads to hallucinated, off-target code.
— Vague requirements like "build an order feature like Taobao" without business rules force AI to invent table structures and logic that are basically unusable.
— A pagination bug caused by sorting only on created_at gets masked by frontend filtering if AI lacks production logs and DB access; the real fix is adding a unique primary key sort fallback plus integration tests.
— Store engineering and business knowledge in the code repository (e.g., AGENTS.md at the root, per-module notes in subdirectories) so AI can read it while modifying code.
— Keep docs fresh by requiring doc updates in every PR and doing a weekly AI-driven knowledge refresh based on current code, prod data, and logs.
— Expose read-only access to external systems—logs/monitoring (Grafana, Datadog, Sentry, PostHog), production read-only DB, ticketing (Linear, Jira, ZenTao), chat and Git history—via MCP or read-only API keys.
— Use secret management tools (Infisical, Doppler, 1Password CLI) to inject credentials at runtime instead of storing plaintext .env files.
— Codify repetitive instructions as Skills in the repo: root-cause investigation, implementation planning, code writing with an independent review sub-agent, PR description generation with evidence, and automated CI fix-and-repush.
— Write tests for business behavior, not internal functions: use integration tests for non-UI and Playwright E2E for web; have AI write E2E from a real browser session, then run deterministic scripts to save tokens.
— For prompt-dependent features, set up a Replay system that collects real and edge cases; in CI, trigger replay tests only when a PR changes the prompt or its config.
— Human code review should drop line-by-line reading; instead verify the AI's PR description (symptom, log/database evidence, root cause, fix) and inspect only key files like SQL migrations and permission config.
— Two operating modes: cautious (human approves the plan, AI executes the rest) for core/ToB products; aggressive (AI merges and ships directly) for internal tools and early validation projects.
— Add a daily automated inspection that analyzes production data and recently deployed PRs, alerts via chat, and lets AI create tickets, query logs, and submit fixes on demand.
— Engineers should become product engineers with deep business understanding and broad full-stack knowledge; the ability to ask good questions determines AI output quality.
— Senior engineers retain an edge because they can quickly judge which of several AI-proposed plans is better and which hides risks.
Conclusions

The bottleneck in AI-assisted development is not model capability but the quality of context and instructions, making it an infrastructure and documentation problem rather than a coding problem.

Shifting code review from line-by-line to evidence-based checking redefines the reviewer's job: the real check is whether the AI's root-cause reasoning and plan hold up, not whether the code is aesthetically clean.

The cautious/aggressive split is a risk-appetite tradeoff; the aggressive mode only works when the cost of a bad merge is low, which is why it's reserved for internal tools and personal projects.

Calling for engineers to become product engineers and to maintain broad full-stack knowledge reinforces that the differentiator in an AI-assisted world is the ability to ask good questions and judge AI's output, not to write tricky code.

Concepts & terms
MCP (Model Context Protocol)
An interface protocol that lets AI assistants directly connect to external tools and data sources (like databases, ticketing systems, chat logs) in a standardized way, allowing the model to pull information on demand.
Skill (in AI development)
An instruction file placed inside a code repository that codifies a repeatable workflow (e.g., root-cause investigation, PR description generation) so the AI follows a consistent procedure every time instead of needing a freshly typed long prompt.
Replay system
A testing setup for prompt-dependent features that collects real production cases and fixed edge cases, then runs them as regression tests whenever the prompt or its configuration changes, ensuring fixes don't reintroduce past issues.
From the discussion
Featured comments
组合搭配函数

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?

谭sir

They're all shared in the repository; important skills go in the repo.

谭sir

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.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗