Context Engineering Is Changing. Here’s What It Means for Data Scientists上下文工程正在变革:这对数据科学家意味着什么
How to apply the latest context engineering guidelines to your day-to-day data science work如何将最新的上下文工程指南应用于日常数据科学工作

There are so many positive sides that come with using systems like Claude; all the repetitive, routine coding gets automated, researching is quicker, and debugging becomes easier. In general, for people in software, productivity goes up and allows teams to ship more.使用 Claude 等系统带来了诸多益处:所有重复性的日常编码工作得以自动化,研究速度更快,调试也变得更轻松。总体而言,对于软件从业者来说,生产力得到了提升,使团队能够交付更多成果。
However, the slight drawback of using tools like Claude is that you have to stay on track with these agents.然而,使用 Claude 等工具的一个小缺点是,你必须时刻跟上这些智能体的变化。
This is not only to avoid being left behind and using outdated technology. This is also because new models are trained to work slightly differently than their predecessors.这不仅是为了避免落伍或使用过时的技术,还因为新模型的训练方式与其前代产品略有不同。
Ultimately, this means that you might find yourself asking, "What's wrong with Claude today? Why is it not working properly?" not realizing that you are not using Claude correctly according to the new expected procedures.归根结底,这意味着你可能会发现自己问:“Claude 今天怎么了?为什么它运行不正常?”却没意识到,你并没有按照新的预期流程来正确使用 Claude。
This is the reason why companies like Anthropic show not only that new models are objectively better than older ones according to some benchmarks, but they also communicate to users how they should change the way they interact with them.这就是为什么像 Anthropic 这样的公司不仅会通过基准测试证明新模型在客观上优于旧模型,还会告知用户应该如何改变与它们的交互方式。
Less than a month ago, Anthropic released "the new rules of Context Engineering for Claude 5 generation models".
The article explains in detail how the models are changing, and that prompt engineering is not the main character anymore, leaving space for context engineering, which is the collection of all the sources that LLMs use to answer your question/complete your ask.不到一个月前,Anthropic 发布了“Claude 5 代模型的上下文工程新规则”。这篇文章详细解释了模型正在发生的变化,并指出提示工程(Prompt Engineering)已不再是主角,取而代之的是上下文工程(Context Engineering)——即大语言模型用于回答你的问题或完成任务的所有来源的集合。
In particular, this article talks about us, Data Scientists, and tries to answer this question:具体来说,本文探讨了我们数据科学家的处境,并试图回答这个问题:
"How do context engineering's new rules change our day-to-day work?"“上下文工程的新规则如何改变我们的日常工作?”
But before we do that... what is even "context engineering"?但在我们开始之前……到底什么是“上下文工程”?
0. What is Context Engineering? 0. 什么是上下文工程?

You can think of two big ways to use Anthropic models: API Calls and Claude Code.你可以认为使用 Anthropic 模型主要有两种方式:API 调用和 Claude Code。
API calls are one-shot processing of the input. Your text (the input sequence string) gets processed by the LLM, which generates the output sequence string. Because you don't own the LLM, the processing happens online, and you pay for input and output tokens. That's it.API 调用是对输入的一次性处理。你的文本(输入序列字符串)由大语言模型处理,并生成输出序列字符串。由于你并不拥有该模型,处理过程是在线进行的,你需要为输入和输出的 token 付费。仅此而已。
Systems like Claude Code (or Codex) work agentically. This means that the model is still being used and called through API calls, but it is doing much more than just reading the input. A multitude of API calls are executed, and every API call is responsible for something different (e.g., reasoning, coding, generating the output etc). What you see at the end is the final result of all the processing that went on through different API calls.像 Claude Code(或 Codex)这样的系统则是以代理方式工作的。这意味着模型仍然通过 API 调用来使用,但它所做的远不止读取输入。系统会执行大量的 API 调用,每个调用负责不同的任务(例如推理、编码、生成输出等)。你最终看到的是通过不同 API 调用处理后的最终结果。
For cases where you need (1.), prompt engineering, which is the art of crafting the perfect input information, is extremely important: you are doing a specific task, all the information to execute the task is in the prompt, and you expect a reliable and verifiable answer.在需要(1.)的情况下,提示工程(即精心设计完美输入信息的艺术)至关重要:你在执行特定任务,所有执行任务所需的信息都在提示词中,并且你期望得到可靠且可验证的答案。
When you use an agent (2.), prompt engineering is much less the main character. This is because agents are meant to be intuitive, easy to use, and generally more powerful as they leverage massive internal systems.当你使用智能体(2.)时,提示工程就不再是主角了。这是因为智能体旨在直观、易用,并且由于利用了庞大的内部系统,它们通常更强大。
However, this doesn't mean that Claude can read your mind :) 然而,这并不意味着 Claude 能读懂你的心思 :)
All the information that is still necessary for Claude to do a good job should be in a set of documents, instruction files, and settings that are defined as "context." This context needs to be "engineered" in order to be used optimally by the agentic system. Anthropic gives us guidelines to do so.Claude 做好工作所需的所有信息,都应包含在一组文档、说明文件和设置中,这些统称为“上下文”。为了让代理系统能够最优地使用这些信息,需要对上下文进行“工程化”。Anthropic 为我们提供了相应的指导原则。
Now, let's review these guidelines using our Data Science detective hat.现在,让我们戴上数据科学侦探的帽子,回顾一下这些准则。
1. "Trust me, bro"1. “相信我,兄弟”

The first point of the article talks about "CLAUDE.md" which is the file that gets created by Claude Code when you initialize a folder. [If you are lost, you should probably check this out before you keep reading]文章的第一点谈到了“CLAUDE.md”,这是当你初始化文件夹时由 Claude Code 创建的文件。[如果你感到困惑,建议在继续阅读前先查看此内容]
About "CLAUDE.md", Anthropic team basically says: stop patronizing Claude and giving it too many instructions; you are only confusing it. The point that they make is that new models can fill the gap, and by adding an excessive amount of info, you are just adding the probability of this info being incompatible with each other.关于“CLAUDE.md”,Anthropic 团队基本上是在说:别再对 Claude 指手画脚,提供过多的指令了;你只会让它感到困惑。他们的观点是,新模型能够填补空白,而添加过量的信息只会增加这些信息彼此冲突的可能性。
This means you can write in "CLAUDE.md" whether the folder is an EDA folder, a research folder, or a "code to be delivered in production" folder.这意味着你可以在“CLAUDE.md”中写明该文件夹是 EDA 文件夹、研究文件夹,还是“待交付生产的代码”文件夹。
Then, Claude will be able to understand that it needs to be extra careful when implementing a feature if it is to be delivered in production, and you will probably use .py files rather than notebooks, while the opposite will be true in an EDA folder.这样,Claude 就能理解:如果是交付生产的功能,它需要格外小心,并且你可能会倾向于使用 .py 文件而非笔记本;反之,在 EDA 文件夹中则会有不同的处理方式。
We'll come back to this concept. Let's keep going. 我们稍后会回到这个概念。先继续往下看。
2. "No spoilers!"2. “别剧透!”

Claude is designed to use skills. You can think of a skill as something that saves you time: when you are doing the same thing over and over again, you set this information in a given file, and you redirect your conversation to that file rather than explaining from scratch and repeating yourself.Claude 被设计为能够使用技能(skills)。你可以把技能看作一种节省时间的方式:当你反复做同一件事时,将相关信息设置在特定文件中,并在对话中指向该文件,而不是从头解释并重复自己。
For example, you might have a notebook.md skill where you instruct Claude on how to work with your notebooks, what colors you prefer for the plots, what libraries to use to compute the statistics, etc.例如,你可以有一个 notebook.md 技能,指导 Claude 如何处理你的笔记本、你偏好的绘图颜色、用于计算统计数据的库等。
Anthropic is basically telling us: "If you put everything in one long skill, Claude will not know what is actually relevant in your ask." In other words, they are asking us to be specific.Anthropic 基本上是在告诉我们:“如果你把所有东西都塞进一个长技能里,Claude 就不知道你的请求中什么才是真正相关的。”换句话说,他们要求我们保持具体。
Let's watch this from a Data Science perspective. We have many different tasks to take care of, and they are different from each other. Sometimes we load the data, sometimes we just explore it, sometimes we set up Databricks and spin up a cluster, sometimes we train a model. Each microtask should create a skill, which is ultimately wrapped in another macro skill. At the end of our design, we will build a taxonomy, i.e., a tree of skills. For example:让我们从数据科学的角度来看。我们需要处理许多不同的任务,它们各不相同。有时我们要加载数据,有时只是探索数据,有时要设置 Databricks 并启动集群,有时要训练模型。每个微任务都应该创建一个技能,最终将其封装在另一个宏观技能中。在设计结束时,我们将构建一个分类法,即一个技能树。例如:

You are not building a data.md skill that loads data, checks the quality, and transforms it. Actually, data.md will be short and sweet, and it will direct you to the right subskill for a specific smaller ask. For example, if you ask Claude to load the data, Claude will read the data.md file and then refer to loading.md你不需要构建一个负责加载数据、检查质量并进行转换的 data.md 技能。实际上,data.md 应该简洁明了,它会将你引导至特定小任务的正确子技能。例如,如果你要求 Claude 加载数据,Claude 会读取 data.md 文件,然后参考 loading.md。
3. "Thanks for the memories!"3. “感谢那些记忆!”

Another short but important update that the Anthropic team is sharing with us is the following: Claude models are very good at remembering your habits. This means that across our work, the CLAUDE.md will be updated regularly with meaningful information about our preferences.Anthropic 团队与我们分享的另一个简短但重要的更新是:Claude 模型非常擅长记住你的习惯。这意味着在我们的工作中,CLAUDE.md 会定期更新,包含有关我们偏好的有意义信息。
I want to add my personal take to this. When I find that my skill is not working exactly like I want it to, I ask Claude to update it so that it will work better next time.我想补充一点个人看法。当我发现我的技能运行效果不如预期时,我会让 Claude 更新它,以便下次运行得更好。
For example, if the preprocessing in preprocessing.md is done in a way that is too extreme (e.g., completely filtering out NaNs without exploring them first), I ask Claude to modify certain parts of the skill.例如,如果 preprocessing.md 中的预处理方式过于激进(例如在探索之前就直接过滤掉所有 NaN),我会要求 Claude 修改该技能的某些部分。
4. "You underestimate my power!"4. “你低估了我的力量!”

Lastly, the Anthropic team reminds us that Claude can work with many different files and formats.最后,Anthropic 团队提醒我们,Claude 可以处理许多不同的文件和格式。
If you have .py and .json files that are meaningful, for example, a hyperparameter.json with the set of parameters for your training, you can let the training.md skill know, and the file will be analyzed and explored when necessary.如果你有有意义的 .py 和 .json 文件,例如包含训练参数集的 hyperparameter.json,你可以让 training.md 技能知晓,这样在必要时该文件就会被分析和探索。
Not only that, you can use rich HTML files, which are called artifacts. 不仅如此,你还可以使用丰富的 HTML 文件,即所谓的“工件”(artifacts)。
These files are great for presenting results, reviewing the output internally, testing different parts of the pipelines, and exploring the data. [Take a look at the official documentation here]这些文件非常适合展示结果、内部审查输出、测试流水线的不同部分以及探索数据。[点击此处查看官方文档]
5. Long Story Short...5. 长话短说……
The moral of the story is the following: 故事的寓意如下:
When the model fails, it is because it is looking at the wrong information and doesn't have enough context.当模型失败时,是因为它查看了错误的信息,且缺乏足够的上下文。
The way to avoid this kind of failure and use the most amount of power is through "context engineering".避免这种失败并发挥最大效能的方法就是通过“上下文工程”。
In practice, we need to:在实践中,我们需要:
Trust Claude to navigate through the asks. We must give general direction but avoid overspecificity to prevent contradictory info.信任 Claude 来引导请求。我们必须给出总体方向,但要避免过度具体,以防信息相互矛盾。
Modularize our skills into a set of small but specific routines. This keeps Claude's context modular and efficient.将我们的技能模块化为一组小而具体的例程。这能保持 Claude 上下文的模块化和高效。
Use Claude's self-updating memory and correct skills as we go at the end of our sessions.利用 Claude 的自更新记忆,并在会话结束时根据需要修正技能。
Adopt artifacts to enrich our visualization and exploratory power.采用工件来丰富我们的可视化和探索能力。
While this is Claude-specific, the trend goes in the same direction for other providers: models keep getting smarter, and context engineering is the main character to unlock their full potential.虽然这是 Claude 特有的,但其他提供商的趋势也是如此:模型越来越聪明,而上下文工程是释放其全部潜力的主角。
This means that tools like Codex will probably need a translation of this guide, but they won't be that far off in terms of "spirit". 这意味着像 Codex 这样的工具可能需要这份指南的“翻译版”,但在“精神”层面上它们相差不会太远。
Before you head out!在离开之前!
Thank you again for your time. It means a lot. My name is Piero Paialunga, and I’m this guy here:再次感谢你的时间,这对我很重要。我叫 Piero Paialunga,就是下面图片里这个人:

I’m originally from Italy, hold a Ph.D. from the University of Cincinnati, and work as a Data Scientist at The Trade Desk in New York City. I write about AI, Machine Learning, and the evolving role of data scientists both here on TDS and on LinkedIn. If you liked the article and want to know more about machine learning and follow my studies, you can:我来自意大利,拥有辛辛那提大学的博士学位,目前在纽约市的 The Trade Desk 担任数据科学家。我会在 TDS 和 LinkedIn 上撰写关于 AI、机器学习以及数据科学家不断演变的角色等方面的文章。如果你喜欢这篇文章,想了解更多关于机器学习的内容并关注我的研究,你可以:
A. Follow me on Linkedin, where I publish all my stories
B. Follow me on GitHub, where you can see all my code
C. For questions, you can send me an email at piero.paialunga@hotmailA. 在 Linkedin 上关注我,我会在那里发布我所有的故事;B. 在 GitHub 上关注我,你可以查看我所有的代码;C. 如有问题,可以发送电子邮件至 piero.paialunga@hotmail








