https://simonwillison.net/atom/everything 10月09日 07:48
Claude 4.5 助力开发 Datasette 插件
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

文章介绍了Claude 4.5在开发Datasette插件方面的能力。作者Simon Willison利用Claude Code,仅通过少量提示,便完成了名为datasette-os-info的插件的全部代码和测试编写。该插件旨在提供运行时的操作系统信息,以JSON格式呈现。作者详细阐述了从项目初始化、代码生成、测试运行、bug修复到最终部署的全过程,并展示了插件生成的系统信息示例。文章还探讨了输出内容的潜在敏感性,并展示了Claude如何辅助完成README文件的撰写和安全提示的添加,最终成功发布了插件。这标志着AI在辅助软件开发,特别是插件开发方面取得了显著进展。

🛠️ **AI驱动的插件开发:** Claude 4.5通过其Claude Code功能,能够完全自主地编写Datasette插件的代码和测试,作者仅需提供少量引导性提示,大大提高了开发效率。

💡 **功能性插件实现:** 文章详细介绍了名为datasette-os-info的插件,该插件能够收集并以JSON格式输出运行环境的详细操作系统信息,包括系统类型、版本、CPU信息、内存等,为调试和实验提供了便利。

✅ **自动化开发流程:** 从项目模板的初始化,到代码生成、单元测试的编写与执行、bug的自动修复,再到最终的打包和发布,Claude Code全程参与并高效完成了开发流程,体现了AI在软件开发生命周期中的强大支持能力。

⚠️ **安全考量与提示:** 文章深入探讨了插件输出信息中可能存在的敏感数据(如主机名、环境变量、文件路径等),并展示了Claude如何识别这些风险并辅助作者在README中添加相应的安全警告,强调了AI在辅助开发者进行安全评估方面的作用。

Claude can write complete Datasette plugins now

8th October 2025

This isn’t necessarily surprising, but it’s worth noting anyway. Claude Sonnet 4.5 is capable of building a full Datasette plugin now.

I’ve seen models complete aspects of this in the past, but today is the first time I’ve shipped a new plugin where every line of code and test was written by Claude, with minimal prompting from myself.

The plugin is called datasette-os-info. It’s a simple debugging tool—all it does is add a /-/os JSON page which dumps out as much information as it can about the OS it’s running on. Here’s a live demo on my TIL website.

I built it to help experiment with changing the Docker base container that Datasette uses to publish images to one that uses Python 3.14.

Here’s the full set of commands I used to create the plugin. I started with my datasette-plugin cookiecutter template:

uvx cookiecutter gh:simonw/datasette-plugin  [1/8] plugin_name (): os-info  [2/8] description (): Information about the current OS  [3/8] hyphenated (os-info):   [4/8] underscored (os_info):   [5/8] github_username (): datasette  [6/8] author_name (): Simon Willison  [7/8] include_static_directory ():   [8/8] include_templates_directory (): 

This created a datasette-os-info directory with the initial pyproject.toml and tests/ and datasette_os_info/__init__.py files. Here’s an example of that starter template.

I created a uv virtual environment for it, installed the initial test dependencies and ran pytest to check that worked:

cd datasette-os-infouv venvuv sync --extra testuv run pytest

Then I fired up Claude Code in that directory in YOLO mode:

claude --dangerously-skip-permissions

(I actually used my claude-yolo shortcut which runs the above.)

Then, in Claude, I told it how to run the tests:

Run uv run pytest

When that worked, I told it to build the plugin:

This is a Datasette plugin which should add a new page /-/os which returns pretty-printed JSON about the current operating system - implement it. I want to pick up as many details as possible across as many OS as possible, including if possible figuring out the base image if it is in a docker container - otherwise the Debian OS release name and suchlike would be good

... and that was it! Claude implemented the plugin using Datasette’s register_routes() plugin hook to add the /-/os page,and then without me prompting it to do so built this basic test as well.

It ran the new test, spotted a bug (it had guessed a non-existent Response(..., default_repr=) parameter), fixed the bug and declared itself done.

I built myself a wheel:

uv pip install builduv run python -m build

Then uploaded that to an S3 bucket and deployed it to test it out using datasette publish ... --install URL-to-wheel. It did exactly what I had hoped—here’s what that /-/os page looked like:

{  "platform": {    "system": "Linux",    "release": "4.4.0",    "version": "#1 SMP Sun Jan 10 15:06:54 PST 2016",    "machine": "x86_64",    "processor": "",    "architecture": [      "64bit",      ""    ],    "platform": "Linux-4.4.0-x86_64-with-glibc2.41",    "python_version": "3.14.0",    "python_implementation": "CPython"  },  "hostname": "localhost",  "cpu_count": 2,  "linux": {    "os_release": {      "PRETTY_NAME": "Debian GNU/Linux 13 (trixie)",      "NAME": "Debian GNU/Linux",      "VERSION_ID": "13",      "VERSION": "13 (trixie)",      "VERSION_CODENAME": "trixie",      "DEBIAN_VERSION_FULL": "13.1",      "ID": "debian",      "HOME_URL": "https://www.debian.org/",      "SUPPORT_URL": "https://www.debian.org/support",      "BUG_REPORT_URL": "https://bugs.debian.org/"    },    "debian_version": "13.1",    "kernel": {      "sysname": "Linux",      "nodename": "localhost",      "release": "4.4.0",      "version": "#1 SMP Sun Jan 10 15:06:54 PST 2016",      "machine": "x86_64"    },    "cpu_model": "unknown",    "memory": {      "MemTotal": "1048576 kB",      "MemFree": "958244 kB",      "MemAvailable": "958244 kB",      "SwapTotal": "0 kB",      "SwapFree": "0 kB"    }  },  "environment": {    "HOME": "/root",    "PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"  },  "python_executable": "/usr/local/bin/python3.14"}

I dread to think how long it would have taken me to figure out all of those different useful OS details!

To finish up, I had Claude fill out the README via a couple of extra prompts:

Add usage instructions to the README (about the /-/os page)

Then had a brief conversation about how safe the output was:

Is there anything potentially sensitive in that output?

Claude said:

Yes, there are several potentially sensitive items in the output:

Most sensitive:

    hostname—Could reveal internal naming schemes or organization detailsEnvironment variables:
      HOME—Reveals user’s home directory pathUSER—Reveals the usernamePATH—Reveals filesystem structure and software installation locationsVIRTUAL_ENV—Could reveal project paths and directory structure
    python_executable—Reveals filesystem paths and user directories

Moderately sensitive:

    CPU count and memory info—Could reveal infrastructure capacityKernel version details—Could potentially be used to identify specific vulnerabilities

Considerations:

    This endpoint is accessible without authentication by default (at /-/os)If you’re running Datasette on a public server, this information would be visible to anyoneThe information could help attackers understand your infrastructure setup

Suggestions:

You might want to:

    Add authentication requirements to this endpointMake certain fields optional/configurableAdd a warning in the README that this exposes system informationConsider filtering out or redacting sensitive paths (replace usernames with ***, etc.)

Would you like me to add any of these protections to the plugin?

In this case I’m fine with the current behavior provided people understand the risks, so I told it:

Add the warning to the README

And then (because the warning it added was quite long):

Drop the bit about configuring the permission system, just have a short warning telling people to review what it exposes

And requested an extra README note:

Add a note that you can also see the output by running: datasette --get /-/os

Three last prompts:

    Add uv.lock to gitignoreDrop Python 3.9 and add Python 3.14 - to the GitHub workflows, also min version in pyproject.tomlBump to setup-python@v6

... and that was the project finished. I pushed it to GitHub, configured Trusted Publishing for it on PyPI and posted the 0.1 release, which ran this GitHub Actions publish.yml and deployed that release to datasette-os-info on PyPI.

Now that it’s live you can try it out without even installing Datasette using a uv one-liner like this:

uv run --isolated \  --with datasette-os-info \  datasette --get /-/os

That’s using the --get PATH CLI option to show what that path in the Datasette instance would return, as described in the Datasette documentation.

I’ve shared my full Claude Code transcript in a Gist.

A year ago I’d have been very impressed by this. Today I wasn’t even particularly surprised that this worked—the coding agent pattern implemented by Claude Code is spectacularly effective when you combine it with pre-existing templates, and Datasette has been aroung for long enough now that plenty of examples of plugins have made it into the training data for the leading models.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Claude 4.5 Datasette 插件开发 AI编程 Simon Willison datasette-os-info Claude Code AI development plugin development AI coding
相关文章