You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Learn-compatible docstring rules to SDK dev SKILL files
Add 'Docstring Type Annotations (Microsoft Learn Compatibility)' section
to both SKILL.md copies with rules, correct/wrong examples to prevent
the ':class:\X\ of :class:\Y\' anti-pattern from being reintroduced.
Copy file name to clipboardExpand all lines: .claude/skills/dataverse-sdk-dev/SKILL.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,3 +54,35 @@ Navigation property names are case-sensitive and must match the entity's `$metad
54
54
9.**Document public APIs** - Add Sphinx-style docstrings with examples for public methods
55
55
10.**Define __all__ in module files** - Each module declares its own exports via `__all__` (e.g., `errors.py` defines `__all__ = ["HttpError", ...]`). Package `__init__.py` files should not re-export or redefine another module's `__all__`; they use `__all__ = []` to indicate no star-import exports.
56
56
11.**Run black before committing** - Always run `python -m black <changed files>` before committing. CI will reject unformatted code. Config is in `pyproject.toml` under `[tool.black]`.
57
+
58
+
### Docstring Type Annotations (Microsoft Learn Compatibility)
59
+
60
+
This SDK's API reference is published on Microsoft Learn. The Learn doc pipeline parses `:type:` and `:rtype:` directives differently from standard Sphinx -- every word between `:class:` references is treated as a separate cross-reference (`<xref:word>`). Using Sphinx-style `:class:\`list\` of :class:\`str\`` produces broken `<xref:of>` links on Learn.
61
+
62
+
**Rules for `:type:` and `:rtype:` directives:**
63
+
64
+
- Use Python bracket notation for generic types: `list[str]`, `dict[str, Any]`, `list[dict]`
65
+
- Use `or` (without `:class:`) for union types: `str or None`, `dict or list[dict]`
66
+
- Use bracket nesting for complex types: `collections.abc.Iterable[list[dict]]`
67
+
- Use `~` prefix for SDK types to show short name: `list[~PowerPlatform.Dataverse.models.record.Record]`
68
+
-`:class:` is fine for single standalone types: `:class:\`str\``, `:class:\`bool\``
69
+
70
+
**Never** use `:class:\`X\` of :class:\`Y\`` or `:class:\`X\` mapping :class:\`Y\` to :class:\`Z\`` -- the words `of`, `mapping`, `to` become broken `<xref:>` links.
Copy file name to clipboardExpand all lines: src/PowerPlatform/Dataverse/claude_skill/dataverse-sdk-dev/SKILL.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,3 +28,35 @@ This skill provides guidance for developers working on the PowerPlatform Dataver
28
28
9.**Document public APIs** - Add Sphinx-style docstrings with examples for public methods
29
29
10.**Define __all__ in module files** - Each module declares its own exports via `__all__` (e.g., `errors.py` defines `__all__ = ["HttpError", ...]`). Package `__init__.py` files should not re-export or redefine another module's `__all__`; they use `__all__ = []` to indicate no star-import exports.
30
30
11.**Run black before committing** - Always run `python -m black <changed files>` before committing. CI will reject unformatted code. Config is in `pyproject.toml` under `[tool.black]`.
31
+
32
+
### Docstring Type Annotations (Microsoft Learn Compatibility)
33
+
34
+
This SDK's API reference is published on Microsoft Learn. The Learn doc pipeline parses `:type:` and `:rtype:` directives differently from standard Sphinx -- every word between `:class:` references is treated as a separate cross-reference (`<xref:word>`). Using Sphinx-style `:class:\`list\` of :class:\`str\`` produces broken `<xref:of>` links on Learn.
35
+
36
+
**Rules for `:type:` and `:rtype:` directives:**
37
+
38
+
- Use Python bracket notation for generic types: `list[str]`, `dict[str, Any]`, `list[dict]`
39
+
- Use `or` (without `:class:`) for union types: `str or None`, `dict or list[dict]`
40
+
- Use bracket nesting for complex types: `collections.abc.Iterable[list[dict]]`
41
+
- Use `~` prefix for SDK types to show short name: `list[~PowerPlatform.Dataverse.models.record.Record]`
42
+
-`:class:` is fine for single standalone types: `:class:\`str\``, `:class:\`bool\``
43
+
44
+
**Never** use `:class:\`X\` of :class:\`Y\`` or `:class:\`X\` mapping :class:\`Y\` to :class:\`Z\`` -- the words `of`, `mapping`, `to` become broken `<xref:>` links.
0 commit comments