跳到正文
Simon Willison·· 8 天前精选

Willison分享接口试用方法:让Claude写插件,再修设计问题

AI 导读

Simon Willison让Claude Opus 5.5试写Datasette图表扩展,借此发现此前未实际使用过的插件接口存在设计问题,并在0.4a0中修正。他同时发布插件作者教程及可交互图表示例,供开发者参考。

推荐理由

提供用AI试写扩展、检查接口易用性的可迁移做法。原文正文+原站 RSS 时间核验;效果属作者自述,未独立复测。

正文 · AI 翻译

新的 datasette-charts 插件有自己的插件钩子,允许其他插件定义新的图表类型,但我此前还没有真正用它做过什么。我让 Claude Opus 5.5 构建了一个实验性插件,只是想试试这个钩子,结果它发现了设计中不少使用起来不顺手的地方。这次发布解决了这些问题,应该能让开发更多图表插件变得顺手得多。

我还为这个插件新增了一个网站,地址是 charts.datasette.io。新网站包含一份面向插件作者的教程,以及一个图表库,展示了所有内置图表和标注,每一项都链接到 Datasette Lite 上的交互式演示。

Screenshot of a documentation page section showing a two-by-two grid of cards, each with a chart screenshot, a heading, a description, a link and a collapsed disclosure. Heading: "Annotations". Intro text: "Notes drawn on a chart: lines, shaded ranges, callouts and text. They are part of the chart's spec, so they are kept in the link to the chart. Documentation for annotations." where "Documentation for annotations" is a link. Card 1: an area line chart titled "Rows per quarter of published_at", y-axis labelled "↑ Rows" with ticks 0, 20, 40, 60, 80, 100, 120, 140, 160 and x-axis ticks 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, with a vertical dashed line just before 2023 labelled "Datasette 1.0a0"; the line peaks near 150 in mid 2020 and near 138 in early 2023. Caption "SCREENSHOT". Heading "A line at an x value". Text "A dashed line across the chart at a date, here the day of a release." Link "Try this demo yourself". Disclosure "▶ Chart spec". Card 2: a stacked bar chart titled "Rows per year of upload_time by packagetype", legend "bdist_wheel" (blue) and "sdist" (orange), y-axis labelled "↑ Rows" with ticks 0, 100, 200, 300, 400, 500, 600 and x-axis ticks 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, with a solid red horizontal line at 500 labelled "500 uploads a year"; the bars for 2020, 2021 and 2023 rise above the line. Caption "SCREENSHOT". Heading "A line at a y value". Text "A reference line at a value, drawn solid and in red." Link "Try this demo yourself". Disclosure "▶ Chart spec". Card 3: a blue histogram titled "Distribution of latitude", y-axis labelled "↑ Rows" with ticks 0, 1,000, 2,000, 3,000, 4,000, 5,000, 6,000, 7,000, 8,000 and x-axis labelled "latitude →" with ticks −80, −60, −40, −20, 0, 20, 40, 60, with a grey shaded band from roughly −23 to 23 labelled "The tropics"; the tallest bar is just above 7,000 at around 40. Caption "SCREENSHOT". Heading "A shaded range". Text "A band between two x values, on a histogram." Link "Try this demo yourself". Disclosure "▶ Chart spec". Card 4: a scatter plot of blue dots titled "generation_gwh_2017 against capacity_mw", y-axis labelled "↑ generation_gwh_2017" with ticks 0, 5,000, 10,000, 15,000, 20,000, 25,000, 30,000, 35,000, 40,000 and x-axis labelled "capacity_mw →" with ticks 0, 1,000, 2,000, 3,000, 4,000, 5,000, showing an upward trend, with one black dot at the far right near 5,400 capacity and 31,000 generation joined by a short line to the label "Gravelines, France". Caption "SCREENSHOT". Heading "A callout on a point". Text "A dot on one data point with a line to its label. On a scatter plot the callout gives both x and y." Link "Try this demo yourself". Disclosure "▶ Chart spec".

来源:Simon Willison · simonwillison.net