技能图谱SKILLSGROVE
技能图谱/视频制作/Amet13/overfull/add-figure

add-figure

安装

$npx skills add https://github.com/Amet13/overfull --skill add-figure
$git clone --depth 1 https://github.com/Amet13/overfull.git /tmp/overfull && mkdir -p ~/.claude/skills && cp -r /tmp/overfull/skills/add-figure ~/.claude/skills/add-figure
请帮我安装这个 Agent Skill:https://github.com/Amet13/overfull/tree/c5540f4b1f4d9d2d539a068ea7bc04821f993a83/skills/add-figure ,先阅读它的 SKILL.md 和脚本,确认安全后再安装到我的技能目录。

简介

原文描述 · MIT-0Add a reproducible figure to the document, either a data-driven pgfplots plot from figures/data or an image file, with meaningful alt text, sensible float placement, a caption, a label and a \cref reference. Use when the author asks for a plot, chart, diagram or image, or when check reports a figure without alt text.
以下 SKILL.md 内容转载自 Amet13/overfull(提交 c5540f4),依据 MIT-0 许可证转载正文(文字未改动;仅省略文件头元数据、将图片显示为链接,超长内容会截断);版权归 2016-2026 Amet Umierov 所有。许可证:skills/LICENSE。仅展示说明文件,附带脚本请在原仓库查看。

Add a figure

Before you start

  • The data or image must come from the author: a file in figures/data/, figures/, or numbers in notes/. Never invent or "illustrate" data.
  • Look at an existing figure in the template and copy its pattern, including how it sets alt text.

Plot from data (preferred)

  1. Put the data in figures/data/<name>.csv (or confirm it is there). Keep the author's numbers exactly.

  2. Write the plot with pgfplots reading that file:

    \begin{figure}[tbp]
      \centering
      \begin{tikzpicture}[alt={Line chart: validation loss falls from 2.1 at epoch 1 to 0.4 at epoch 20.}]
        \begin{axis}[xlabel={Epoch}, ylabel={Validation loss}, width=\linewidth]
          \addplot table[x=epoch, y=loss, col sep=comma] {figures/data/loss.csv};
        \end{axis}
      \end{tikzpicture}
      \caption{Validation loss per epoch.}
      \label{fig:loss}
    \end{figure}
    
  3. Write the alt text from the data: what kind of chart, what it shows, and the main trend or values. overfull check reports a tikzpicture or \includegraphics without alt= as figure-missing-alt.

  4. Label the axes with units. Use a legend only for more than one series.

If the plot is made by a script (Python, R), keep the script next to the data, write the output to figures/, and include it as an image (below). Tell the author the command that regenerates it.

Image file

\begin{figure}[tbp]
  \centering
  \includegraphics[width=\linewidth, alt={Bar chart: method A reaches 81\% accuracy, method B 74\%, baseline 60\%.}]{figures/accuracy.pdf}
  \caption{Accuracy on the test set.}
  \label{fig:accuracy}
\end{figure}

Prefer PDF or PNG. Avoid .eps (it breaks pdfLaTeX builds on arXiv).

Alt text

Say what the reader should learn from the figure, in one to three sentences.

  • Good: "Line chart: loss falls from 2.1 to 0.4 over 50 epochs and flattens after epoch 30."
  • Bad: "Figure 3", "A chart", "loss.pdf", or a copy of the caption.

Only state values that are in the data. A purely decorative image gets empty alt text only if the author agrees it adds nothing.

Placement and references

  • Use [tbp]. Do not force [H] or [h!] everywhere.
  • Place the figure environment right after the paragraph that first mentions it.
  • Refer to it with \cref{fig:loss} in the text. Every figure must be referenced at least once.

Verify

overfull build
overfull check --json --checks build,output,accessibility
overfull pages <page>      # look at it, if you can read images

Done

  • The figure builds, has a caption, a fig: label, a \cref, and alt text.
  • The accessibility check reports no figure-missing-alt.
  • The data or script that produces it is committed.
查看许可证全文(MIT-0)
MIT No Attribution

Copyright 2016-2026 Amet Umierov

Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.