@robhowley/py-pit-skills 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,310 @@
1
+ ---
2
+ name: uv
3
+ description: Expert guidance for correct uv usage in Python projects. Handles dependency management, environments, command execution, migration from pip/poetry/pip-tools, lockfile correctness, and uv anti-patterns.
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ # uv
8
+
9
+ Use this skill when working with Python projects that use or should use **uv**.
10
+
11
+ This skill ensures instructions follow **uv-native workflows** and avoids common mistakes when mixing Python packaging tools.
12
+
13
+ Apply this skill when the user:
14
+ - mentions `uv`
15
+ - asks about Python dependency management
16
+ - asks about environment setup
17
+ - asks how to run Python commands or tests
18
+ - wants to migrate from pip / poetry / pip-tools
19
+ - needs help debugging a broken Python environment
20
+ - wants correct Python CLI tool usage
21
+
22
+ Do not apply when:
23
+ - the task is unrelated to Python tooling
24
+ - the user explicitly wants a different ecosystem (conda, poetry, pip) without discussing uv
25
+ - the question is purely about application design rather than tooling workflow
26
+
27
+ # Invocation heuristics
28
+
29
+ Prefer this skill when the user:
30
+ - mentions `uv`
31
+ - asks about Python dependency or environment management
32
+ - shows `pyproject.toml`, `uv.lock`, or `requirements.txt`
33
+ - asks how to run tests, scripts, or tools in a uv-managed repo
34
+ - is migrating from pip, poetry, or pip-tools to uv
35
+
36
+ Do not prefer this skill when:
37
+ - the user explicitly wants conda, poetry, or raw pip workflows
38
+ - the task is about app architecture rather than Python tooling
39
+
40
+ # Hard constraints
41
+
42
+ In a uv-managed workflow, never default to:
43
+ - `pip install ...`
44
+ - `python -m venv ...`
45
+ - `source .venv/bin/activate`
46
+ - `poetry add ...`
47
+ - `poetry run ...`
48
+ - `uv pip install ...` as the standard dependency workflow
49
+
50
+ Only use or mention those when the user explicitly asks for them, or when explaining migration/interoperability constraints.
51
+
52
+ If the repository already mixes workflows, call that out explicitly and recommend a single consistent path.
53
+
54
+ # Mission
55
+
56
+ Provide **correct, minimal uv-native workflows**.
57
+
58
+ The skill should:
59
+ 1. enforce uv workflow invariants
60
+ 2. detect mixed-tool anti-patterns
61
+ 3. give minimal copy-pasteable commands
62
+ 4. preserve repo structure unless migration is explicitly requested
63
+ 5. prefer correctness over verbosity
64
+
65
+ Do not recommend unrelated packages, frameworks, or project architecture.
66
+
67
+ # Core uv mental model
68
+
69
+ uv is **project-centric**.
70
+
71
+ Projects are defined by:
72
+ - `pyproject.toml`
73
+ - `uv.lock`
74
+
75
+ Workflows revolve around:
76
+ - dependency resolution
77
+ - environment synchronization
78
+ - command execution within the project
79
+
80
+ uv manages environments automatically.
81
+
82
+ Manual environment management should **not be the default workflow**.
83
+
84
+ # The 5 uv invariants
85
+
86
+ Always follow these rules.
87
+
88
+ ## 1. Dependency changes use uv commands
89
+
90
+ Correct:
91
+
92
+ uv add <package>
93
+ uv remove <package>
94
+
95
+ Avoid:
96
+
97
+ pip install <package>
98
+ uv pip install <package>
99
+
100
+ unless the user explicitly asks for pip compatibility.
101
+
102
+ ## 2. Commands run through uv
103
+
104
+ Correct:
105
+
106
+ uv run pytest
107
+ uv run python script.py
108
+ uv run python -m module
109
+
110
+ Avoid defaulting to:
111
+
112
+ pytest
113
+ python script.py
114
+
115
+ when the project is uv-managed.
116
+
117
+ ## 3. Environments are managed automatically
118
+
119
+ Do **not** center workflows around:
120
+
121
+ python -m venv
122
+ source .venv/bin/activate
123
+
124
+ Activation may exist but is **not required** for normal workflows.
125
+
126
+ Prefer execution through `uv run`.
127
+
128
+ ## 4. Tools use uv tool or uvx
129
+
130
+ Ephemeral execution:
131
+
132
+ uvx <tool>
133
+
134
+ Persistent installation:
135
+
136
+ uv tool install <tool>
137
+
138
+ Avoid recommending:
139
+
140
+ pip install <tool>
141
+
142
+ for global CLI usage.
143
+
144
+ ## 5. Do not mix packaging systems
145
+
146
+ Avoid mixing uv with:
147
+ - poetry commands
148
+ - pip install workflows
149
+ - manual dependency lists as the primary source of truth
150
+ - pip-tools compilation as the primary workflow
151
+
152
+ If a repo mixes systems, identify it and recommend one consistent workflow.
153
+
154
+ # Standard operating procedure
155
+
156
+ ## Step 1 — Inspect project state
157
+
158
+ Check for:
159
+ - `pyproject.toml`
160
+ - `uv.lock`
161
+ - existing uv commands in documentation
162
+ - `requirements.txt`
163
+ - poetry or pip-tools configuration
164
+
165
+ Detect if the project is:
166
+ - uv-native
167
+ - mixed workflow
168
+ - legacy pip workflow
169
+ - poetry/pdm workflow
170
+
171
+ ## Step 2 — Classify the request
172
+
173
+ Identify the task category:
174
+ - initialize uv
175
+ - manage dependencies
176
+ - run commands
177
+ - manage tools
178
+ - manage Python versions
179
+ - migration to uv
180
+ - fix broken workflow
181
+ - explain uv concepts
182
+
183
+ ## Step 3 — Provide uv-native solution
184
+
185
+ Return:
186
+ - minimal commands
187
+ - short explanation when needed
188
+ - warnings if anti-patterns exist
189
+
190
+ Do not redesign the repository unless requested.
191
+
192
+ # Dependency management
193
+
194
+ Add dependencies:
195
+
196
+ uv add <package>
197
+
198
+ Remove dependencies:
199
+
200
+ uv remove <package>
201
+
202
+ Import existing dependency lists:
203
+
204
+ uv add -r requirements.txt
205
+
206
+ Do not recommend manual editing of dependency lists unless explicitly requested.
207
+
208
+ # Lockfile and environment synchronization
209
+
210
+ Generate/update lockfile:
211
+
212
+ uv lock
213
+
214
+ Synchronize environment:
215
+
216
+ uv sync
217
+
218
+ Most normal workflows do **not require manual sync commands**.
219
+
220
+ # Command execution
221
+
222
+ Run commands inside the project environment using:
223
+
224
+ uv run <command>
225
+
226
+ Examples:
227
+
228
+ uv run pytest
229
+ uv run python script.py
230
+ uv run python -m module
231
+
232
+ # Python version management
233
+
234
+ Install Python:
235
+
236
+ uv python install <version>
237
+
238
+ Pin project Python version:
239
+
240
+ uv python pin <version>
241
+
242
+ # Tool execution
243
+
244
+ Temporary execution:
245
+
246
+ uvx <tool>
247
+
248
+ Persistent installation:
249
+
250
+ uv tool install <tool>
251
+
252
+ # Migration guidelines
253
+
254
+ 1. Identify existing dependency source (`requirements.txt`, poetry config, pip workflows).
255
+ 2. Establish `pyproject.toml` as the canonical project definition.
256
+ 3. Import dependencies:
257
+
258
+ uv add -r requirements.txt
259
+
260
+ 4. Replace execution commands:
261
+
262
+ pytest -> uv run pytest
263
+ python script.py -> uv run python script.py
264
+
265
+ 5. Remove conflicting documentation.
266
+
267
+ # Anti-pattern detection
268
+
269
+ Mixed installers (bad):
270
+
271
+ uv add fastapi
272
+ pip install sqlalchemy
273
+
274
+ pip-first workflow in uv project (bad):
275
+
276
+ pip install requests
277
+
278
+ Correct:
279
+
280
+ uv add requests
281
+
282
+ Manual venv workflow (bad):
283
+
284
+ python -m venv .venv
285
+ source .venv/bin/activate
286
+ pip install -r requirements.txt
287
+
288
+ Preferred:
289
+
290
+ uv run <command>
291
+
292
+ pip compatibility misuse:
293
+
294
+ `uv pip` exists but should not be the default dependency workflow.
295
+
296
+ # Response style
297
+
298
+ - minimal commands
299
+ - concise explanations
300
+ - explicit anti-pattern detection
301
+ - no package or framework recommendations
302
+
303
+ # Completion checklist
304
+
305
+ Before finishing an answer verify:
306
+ - commands are uv-native
307
+ - no accidental pip workflow slipped in
308
+ - commands are minimal and copy-pasteable
309
+ - migration advice preserves project structure
310
+ - no unrelated packages or frameworks were introduced