Repository navigation
Description
This issue is the result of a discussion at the monthly maintainer meeting. The goal is to collect ideas and practices from people who use AI tools to work on large projects like scikit-learn. I will call the collection of these ideas and practices "infrastructure" for this issue.
Once we have an overview of ideas and practices we will consider what to do next. One possibility is to create a separate repository that contains the "infrastructure" distilled from the ideas and practices in this issue. People can then checkout that repo "on top" of their scikit-learn checkout and benefit from the content for their AI workflows. Another option is that we add the "infrastructure" directly to the main repository. There are pros and cons to either of these options. There might even be more options, or a compromise.
Here are some of my inputs to the collection:
- https://jacobtomlinson.dev/posts/2026/guiding-your-contributors-agents-to-better-behaviours/ a blog post by @jacobtomlinson that talks about exactly this topic. It proposes adding skills to your repository the encode behaviour/limits that you want to be respected. For example, do not work on issues that are missing a "ready" label.
- "design documents" - When working with Cursor to convert an estimator to the array API I found that it got much better after spending some time creating "design documents" like these. I asked cursor to look at existing "array API'ified" estimators, the testing infra, etc and create documents that explain how things work. I then went over them quite carefully to see what it had found. Some of it was pretty good, some of it seemed made up (so I fixed it). In my
AGENTS..mdI refer toagents/designs/*.mdas a place where it can find relevant information that it should read. I remind myself to ask the agent to keep these up to date with new things it learnt. - I ask it to make plans and store these in
agents/plans/with acurrent.mdthat gives an overview of current and future work. This works semi well, Cursor seems to insist on storing plans somewhere in~/.cursor/instead. - AGENTS.md - I use a variation of https://gist.github.com/betatim/4b205de0b762f8c7865ea2e0ea5c65b4. I recently noticed that for a project the whole section on core principles was missing, but I was sure that it was present (aka I could not really tell the difference in behaviour compared to another project where it was present).
- https://agents.md/ - many examples of
AGENTS.mdfiles - https://www.humanlayer.dev/blog/writing-a-good-claude-md opinions on
AGENTS.mdfiles
My take away/thoughts: a fairly simple AGENTS.md seems to be good, it should not contain too much information because that means the fraction of it that is relevant to a task is lower, which "the internet says" reduces the chances of it being followed. Instead it should refer to other documents and state when to read them. While I haven't tried them skills seem to be a good way to help AI users to do the right thing in a repo (eg a "select an issue to work on" skill that encodes the label rules of the repo). There seems to be no need to explain how the scikit-learn build system works, it just works.
What do you think?
Activity
ogrisel commentedon Feb 26, 2026
When using agents on the scikit-learn code base, I noticed they have troubles in setting a working dev env on macOS (they tend to use my homebrew installed Python instead of discovering that I have working mambaforge install, they have problems using working compilers and so on): we should point them to our "setting a developer environment" contributor doc.
We could also provide official
maint_tools/dev-environment.yml/files in our repo and reference those from our contrib guide to be used both by humans and agents.maint_tools/dev-requirements.txtEDIT: Actually, rather than introducing a
dev-requirements.txtfile, we should rather use a more modern dev dependencies section in ourpyproject.tomlfile aspip,uvandpixishould be able to create a dev environment from it.condaandmambastill do not, however, so we might have to provide a conveniencemaint_tools/dev-environment.ymlfor the time being.ogrisel commentedon Feb 26, 2026
A "ready" label would be great indeed!
betatim commentedon Feb 26, 2026
Good idea. I tend to have a conda/mambda env that has "what I want to use now" (eg older numpy version, cutting edge everything, python 3.11, ...) in it. I want the agent to use that env. It struggles with that even though I tell it in
AGENTS.mdthat for "every command, anything, really always use conda envxyz." For example, I don't haveghinstalled globally, so it needs to use the env to get it. To make matters worse on different days I want to use different envs ;)I've not found a great way to make this a good workflow without repeating myself constantly "please use the env, always". Having a nice solution would be nice.
Someone pointed me at https://medium.com/@martia_es/progressive-disclosure-the-technique-that-helps-control-context-and-tokens-in-ai-agents-8d6108b09289 which is interesting. I think the concept "progressive disclosure" is useful. This idea is what made me have the
agents/designs/documents that are only referenced from theAGENTS.md.jacobtomlinson commentedon Feb 26, 2026
I feel like hooks would be helpful here. With hooks you can do pattern matching on the output from the LLM and trigger more context to be added. And it can match on tools.
As a concrete example you could have a hook that runs every time it tries to use bash to run
python,pytest, etc and the hook would just add "Don't forget to activate conda env xyz before running it". I usually activate my conda env before starting claude so that the path is already setup nicely andpythonis already the right Python, so you could even be fancy and check if it's already activated, and if it is then day "Use the already activated conda environment".Another option is you can add a script that gets sources before every bash command. See this thread for more info.
anthropics/claude-code#2509 (comment)
betatim commentedon Mar 2, 2026
pypa/pip-tools#2318 - I like the contib policy they came up with. In particular that it is short and clear. Not a lot of text to read, which imho increases the chances of people reading it. I've not looked at all ~75 comments on that PR
ogrisel commentedon Mar 2, 2026
It's interesting, but I think it might be counter-productive (confusing) to address the reader as "you" and expect it to be the human operator behind the contribution (if any). It is more and more likely that the readers of LLM contribution doc will be an LLM agent the majority of the time, especially if the contributors' doc is referenced from the
AGENTS.mdfile.For instance, instead of writing something like:
I would rather write:
We should therefore write that doc with a neutral stance which makes no assumption about the nature of the reader and can be productively interpreted by both LLM agents, their human operator (if any) or unassisted human contributors.
betatim commentedon Mar 17, 2026
Another idea: include a skill in scikit-learn that walks users through the process described in https://scikit-learn.org/stable/machine_learning_map.html. Though this is more in the direction of AI Infrastructure that helps users of scikit-learn
adrinjalali commentedon Mar 18, 2026
I had a similar idea here probabl-ai/skore#2358 and I'd be very happy with us having this.
I had also played around with the similar idea last year: https://github.com/adrinjalali/sklearn-mcp
Personally, I'd be in favor of us toying with more ideas and be flexible with them a bit. On my own system, I have a whole bunch of sklearn related LLM prompts / claude skills etc which I think would make sense to use more probably 🤷🏼
betatim commentedon Mar 19, 2026
What is a good way of sharing them? I have a subdirectory that I keep things in inside the scikit-learn repo which I
.gitignore. It somehow doesn't feel like committing the personal stuff to the main repo is the right thing, what about having a separate, personal repo? What are others doing?jacobtomlinson commentedon Mar 27, 2026
I approach this in two ways:
.agents/skillsin the repo~/.agents/skillsRight now my private skills I prefix the names with the project they are related to. I would love to find a better way to dynamically load private skills depending on which repo I'm in.
betatim commentedon Mar 30, 2026
One thing I learnt is that Cursor did not find what is inside this subdirectory because the tools it uses to "grep" respects the
.gitignorefile. So all the notes and instructions in that directory where "hidden" from it.Maybe a first skill we can add to this repository is a skill that helps users create a bug report that follows our template. From looking at issues it seems that a lot of people struggle to correctly fill out our template (either stuff missing, formatting broken, etc). Maybe even detecting that the problem they are having is actually caused by
cuml.accelor scikit-learn-intelx and redirecting the report.adrinjalali commentedon Apr 16, 2026
Concretely, I have a skill to review PRs, which goes as:
~/.claude/skills/review-pr.mdDetails
~/.claude/memory/reviewer-profile.mdDetails
Importantly, I didn't write anything in these files, they were generated by
claudeitself:celik-muhammed commentedon Jun 4, 2026
hi there,
can we think add "ai assistant" button to develop more ai compact interactivity. it provides to more future proof features like direct question doc pages etc, mcp integration, custom llm model integration chat panel.
source code submodule can be seperate package or anyway you like?
here sample demo just exploration... to showcase button logic demo ai button
betatim commentedon Jun 11, 2026
I use https://gist.github.com/betatim/30d59f548ef7772a33e2736d21207bc4 quite often when looking at PRs. It helps redirect your attention to read the change that is the "root cause" first and then changes that are "caused by" this change. And so on. I find it useful to avoid reading the diff from the top, as presented by GitHub. Especially for larger PRs this can send you down weird rabbit holes, hence this skill