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
docs: update make-pythonic skill to require alias type hint updates
Alias functions that delegate to a primary function must have their type
hints updated to match, even though coercion logic is only added to the
primary. Added a new Step 3 to the implementation workflow for this.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .ai/skills/make-pythonic/SKILL.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,7 +230,11 @@ For each function being updated:
230
230
3.**Update the docstring** examples to use the simpler calling convention
231
231
4.**Preserve backward compatibility** — existing code using `Expr` must still work
232
232
233
-
### Step 3: Update Docstring Examples
233
+
### Step 3: Update Alias Type Hints
234
+
235
+
After updating a primary function, find all alias functions that delegate to it (e.g., `instr` and `position` delegate to `strpos`). Update each alias's **parameter type hints** to match the primary function's new signature. Do not add coercion logic to aliases — the primary function handles that.
@@ -270,7 +274,7 @@ Do NOT create a new helper function for this — the inline check is clear and e
270
274
-**Do not change arguments that represent data columns.** If an argument is the primary data being operated on (e.g., the `string` in `left(string, n)` or the `array` in `array_sort(array)`), it should remain `Expr` only. Users should use `col()` for column references.
271
275
-**Do not change variadic `*args: Expr` parameters.** These represent multiple expressions and should stay as `Expr`.
272
276
-**Do not change arguments where the coercion is ambiguous.** If it is unclear whether a string should be a column name or a literal, leave it as `Expr` and let the user be explicit.
273
-
-**Do not change functions that are simple aliases.** If a function is just `return other_function(...)`, update the primary function only.
277
+
-**Do not add coercion logic to simple aliases.** If a function is just `return other_function(...)`, the primary function handles coercion. However, you **must update the alias's type hints** to match the primary function's signature so that type checkers and documentation accurately reflect what the alias accepts.
274
278
-**Do not change the Rust bindings.** All coercion happens in the Python layer. The Rust functions continue to accept `PyExpr`.
0 commit comments