Skip to content

Commit 25e5ce3

Browse files
timsaucerclaude
andcommitted
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>
1 parent 3e50d86 commit 25e5ce3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.ai/skills/make-pythonic/SKILL.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ For each function being updated:
230230
3. **Update the docstring** examples to use the simpler calling convention
231231
4. **Preserve backward compatibility** — existing code using `Expr` must still work
232232

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.
236+
237+
### Step 4: Update Docstring Examples (primary functions only)
234238

235239
Per the project's CLAUDE.md rules:
236240
- Every function must have doctest-style examples
@@ -247,7 +251,7 @@ dfn.functions.left(dfn.col("a"), dfn.lit(3))
247251
dfn.functions.left(dfn.col("a"), 3)
248252
```
249253

250-
### Step 4: Run Tests
254+
### Step 5: Run Tests
251255

252256
After making changes, run the doctests to verify:
253257
```bash
@@ -270,7 +274,7 @@ Do NOT create a new helper function for this — the inline check is clear and e
270274
- **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.
271275
- **Do not change variadic `*args: Expr` parameters.** These represent multiple expressions and should stay as `Expr`.
272276
- **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.
274278
- **Do not change the Rust bindings.** All coercion happens in the Python layer. The Rust functions continue to accept `PyExpr`.
275279

276280
## Priority Order

0 commit comments

Comments
 (0)