Skip to content

MacHu-GWU/sqlalchemy_upsert_kit-project / .claude/skills/pywf-oss-base

pywf-oss-base

Flagged

Shared conventions, references, and scripts of the pywf-oss skills for pywf open-source Python libraries: setup, layout, code style, tests, user docs and the agent skills that hold API and maintenance knowledge, CI and hosting, release, dependencies, and secrets. Load it before ad-hoc work on modules, tests, or docs in such a repo, for a question about these conventions, or when unsure which pywf-oss skill fits a job.

FileKindSize
SKILL.mdskill md6.5 KB
assets/community-skills.tomlconfig2.4 KB
assets/notebook-page-template.ipynbother1.1 KB
assets/raw-rst-cell.jsonconfig255 B
references/00-authoring-references.mdmarkdown6.3 KB
references/01-secrets.mdmarkdown3.0 KB
references/02-machine-setup.mdmarkdown3.2 KB
references/03-mise.mdmarkdown2.1 KB
references/04-python-versions.mdmarkdown1.8 KB
references/05-uv-dependencies.mdmarkdown2.0 KB
references/06-ruff.mdmarkdown1.9 KB
references/07-repo-layout.mdmarkdown2.3 KB
references/08-package-files.mdmarkdown3.9 KB
references/09-code-style.mdmarkdown5.6 KB
references/10-test-layout.mdmarkdown4.1 KB
references/11-test-writing.mdmarkdown2.1 KB
references/12-coverage.mdmarkdown1.1 KB
references/13-sphinx.mdmarkdown5.6 KB
references/14-docfly.mdmarkdown2.2 KB
references/15-furo.mdmarkdown1.4 KB
references/16-sphinx-design.mdmarkdown5.8 KB
references/17-nbsphinx.mdmarkdown5.0 KB
references/18-knowledge-channels.mdmarkdown3.8 KB
references/19-github-actions.mdmarkdown3.7 KB
references/20-codecov.mdmarkdown1.3 KB
references/21-readthedocs.mdmarkdown1.7 KB
references/22-versioning-and-changelog.mdmarkdown3.0 KB
references/23-release.mdmarkdown1.3 KB
references/24-dependency-upgrades.mdmarkdown3.2 KB
references/25-python-release-cycle.mdmarkdown1.4 KB
references/26-community-skills.mdmarkdown5.0 KB
references/27-skill-family-workflow.mdmarkdown6.5 KB
scripts/check_doc_xrefs.pyscript3.4 KB
scripts/check_one_import_per_line.pyscript4.2 KB
scripts/check_skill_family.pyscript6.5 KB
scripts/check_test_layout.pyscript6.2 KB
scripts/install_community_skill.pyscript8.6 KB
scripts/update_skill_index.pyscript4.1 KB

references/16-sphinx-design.md

View on GitHub
---
description: "The widgets (grid, card, tabs, code tabs, dropdown, badge, button, icon) with a copy-ready example each, the syntax rules that break them silently, and which widget fits which page. Read when a docs page needs more than plain text, such as a landing page, install tabs, or an FAQ."
---

# sphinx-design

[sphinx-design](https://sphinx-design.readthedocs.io/) (enabled in `conf.py`) adds responsive layout and UI widgets to reStructuredText (`13-sphinx.md`), including a notebook's raw reStructuredText cells. The sample page `docs/source/03-Sample-Sphinx-Design-Gallery/index.rst` of a template repo renders every example below; check your result against it.

---

## 1. Rules that break widgets silently

- **Indent child directives 4 spaces under their parent.** One wrong indent ends the parent early and renders the rest as plain text, often with no warning.
- **Options go directly under the directive line, then one blank line, then the content.** A blank line before an option turns it into body text.
- **Colors** are semantic names: `primary`, `secondary`, `success`, `info`, `warning`, `danger`, `muted`, `light`, `dark`. Avoid `light`, `dark`, `white`, and `black` for text: they vanish in one of the two modes (`15-furo.md`).
- **Icons:** `:octicon:` or `:material-regular:` (bundled). Never the FontAwesome roles (`:fas:`, ...): the template does not load FontAwesome, so they render as nothing.
- **Links inside widgets:** `:link:` takes a label with `:link-type: ref`, a document path without extension with `:link-type: doc`, or a URL (the default). Prefer `ref`, which survives renames. A `doc` path is relative to the current page, or to `docs/source/` when it starts with `/` (`/api/<package_name>/__init__`).
- **Do not decorate for its own sake.** Use a widget only when the reader gains something: a choice (tabs), optional detail (dropdown), a map of pages (cards), or status (badges).

---

## 2. Widgets

### Grid of cards: overviews and landing pages

```rst
.. grid:: 1 2 2 3
    :gutter: 3

    .. grid-item-card:: :octicon:`rocket;1.5em;sd-text-primary` Quick Start
        :link: sample-rst-document
        :link-type: ref

        Install and run your first example in two minutes.

    .. grid-item-card:: :octicon:`book;1.5em;sd-text-info` API Reference
        :link: /api/<package_name>/__init__
        :link-type: doc

        Every public class and function.
```

- `1 2 2 3` is the column count at the xs / sm / md / lg widths; a single number applies to all.
- A card with `:link:` is clickable as a whole, so put no other links inside it.

### Card with header and footer

```rst
.. card:: ClassName
    :shadow: md

    Header text
    ^^^
    Body: what ``ClassName`` does, in one sentence.
    +++
    Footer: see :class:`~<package_name>.module_name.ClassName`.
```

`^^^` ends the optional header and `+++` starts the optional footer. The directive argument is the card title.

### Tabs: alternatives the reader chooses between

```rst
.. tab-set::

    .. tab-item:: pip
        :sync: pip

        .. code-block:: bash

            pip install <package_name>

    .. tab-item:: uv
        :sync: uv

        .. code-block:: bash

            uv add <package_name>
```

Tab items with the same `:sync:` key switch together across every tab-set on the page: use it for an OS or package-manager choice that repeats.

### Code tabs: the same thing in several languages

```rst
.. tab-set-code::

    .. code-block:: python

        func_name("Alice")

    .. code-block:: bash

        python -c 'from <package_name>.api import func_name; print(func_name("Alice"))'
```

Each tab is labeled with its code block's language. `literalinclude` works inside, too.

### Dropdown: optional detail, FAQ, long output

```rst
.. dropdown:: Why does the test file name repeat the folder path?
    :icon: question
    :color: info

    pytest needs unique test module basenames.
```

Add `:open:` to start expanded. `:icon:` takes an octicon name.

### Badges: status and labels inline

```rst
:bdg-success:`stable` :bdg-warning:`beta` :bdg-secondary-line:`optional`
:bdg-link-primary:`PyPI <https://pypi.org/project/<package_name>/>`
:bdg-ref-info:`see the sample <sample-rst-document>`
```

Roles: `:bdg-<color>:` (filled), `:bdg-<color>-line:` (outlined), `:bdg-link-<color>:` (URL), `:bdg-ref-<color>:` (label). Badges work in table cells and headings.

### Buttons: one clear call to action

```rst
.. button-ref:: sample-rst-document
    :ref-type: ref
    :color: primary
    :shadow:

    Get Started

.. button-link:: https://github.com/<owner>/<repo>
    :color: secondary
    :outline:

    :octicon:`mark-github` Source
```

At most one or two per page.

### Icons

```rst
:octicon:`check-circle;1em;sd-text-success` done
:material-regular:`warning;1.2em;sd-text-warning` careful
```

Syntax: `name;size;classes`. Names: <https://primer.style/octicons/>, <https://fonts.google.com/icons>.

---

## 3. Styling hooks

- Card options: `:shadow: none|sm|md|lg`, `:text-align: center`, `:img-top: path`, `:class-card: sd-border-primary`.
- Grid options: `:gutter: 0-5`, `:margin:`, `:padding:`, `:outline:`.
- CSS utility classes, usable in any `:class*:` option or in `.. div:: <classes>`: `sd-text-<color>`, `sd-bg-<color>`, `sd-border-<color>`, `sd-font-weight-bold`, `sd-shadow-md`, `sd-rounded-3`, `sd-p-3`, `sd-m-3`.

---

## 4. Which widget for which page

| Page need | Widget |
| :--- | :--- |
| Landing page, or "what's in this section" | `grid` of `grid-item-card` with `:link:` and an icon in each title |
| Install or usage that differs by tool or OS | `tab-set` with `:sync:` keys |
| The same example in Python and in the shell | `tab-set-code` |
| FAQ, troubleshooting, long or optional detail | `dropdown`, one per question |
| Feature or support matrix | `list-table` with badges in the cells |
| "Next step" at the end of a guide | one `button-ref` |
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall