Skip to content

Commit 7a67a1c

Browse files
nhortonclaude
andauthored
Add deepwork rule for uv.lock updates (#84)
* Add uv-lock-sync rule to auto-update uv.lock Automatically runs `uv sync` when pyproject.toml is modified to keep the lock file in sync with dependency changes. * Clarify that rules fire at Stop hook in job.yml description Updated deepwork_rules job.yml description to make clear that: - Rules evaluate at the Stop hook when agents finish their turn - This includes when sub-agents complete their work - Command actions run at this time, prompt actions block - Added uv sync example use case for command actions --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9416df7 commit 7a67a1c

7 files changed

Lines changed: 63 additions & 0 deletions

File tree

.claude/skills/deepwork_rules.define/SKILL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,25 @@ Manages rules that automatically trigger when certain files change during an AI
272272
Rules help ensure that code changes follow team guidelines, documentation is updated,
273273
and architectural decisions are respected.
274274

275+
IMPORTANT: Rules are evaluated at the "Stop" hook, which fires when an agent finishes its turn.
276+
This includes when sub-agents complete their work. Rules are NOT evaluated immediately after
277+
each file edit - they batch up and run once at the end of the agent's response cycle.
278+
- Command action rules: Execute their command (e.g., `uv sync`) when the agent stops
279+
- Prompt action rules: Display instructions to the agent, blocking until addressed
280+
275281
Rules are stored as individual markdown files with YAML frontmatter in the `.deepwork/rules/`
276282
directory. Each rule file specifies:
277283
- Detection mode: trigger/safety, set (bidirectional), or pair (directional)
278284
- Patterns: Glob patterns for matching files, with optional variable capture
285+
- Action type: prompt (default) to show instructions, or command to run a shell command
279286
- Instructions: Markdown content describing what the agent should do
280287

281288
Example use cases:
282289
- Update installation docs when configuration files change
283290
- Require security review when authentication code is modified
284291
- Ensure API documentation stays in sync with API code
285292
- Enforce source/test file pairing
293+
- Auto-run `uv sync` when pyproject.toml changes (command action)
286294

287295

288296
## Required Inputs

.claude/skills/deepwork_rules/SKILL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,25 @@ Manages rules that automatically trigger when certain files change during an AI
1313
Rules help ensure that code changes follow team guidelines, documentation is updated,
1414
and architectural decisions are respected.
1515

16+
IMPORTANT: Rules are evaluated at the "Stop" hook, which fires when an agent finishes its turn.
17+
This includes when sub-agents complete their work. Rules are NOT evaluated immediately after
18+
each file edit - they batch up and run once at the end of the agent's response cycle.
19+
- Command action rules: Execute their command (e.g., `uv sync`) when the agent stops
20+
- Prompt action rules: Display instructions to the agent, blocking until addressed
21+
1622
Rules are stored as individual markdown files with YAML frontmatter in the `.deepwork/rules/`
1723
directory. Each rule file specifies:
1824
- Detection mode: trigger/safety, set (bidirectional), or pair (directional)
1925
- Patterns: Glob patterns for matching files, with optional variable capture
26+
- Action type: prompt (default) to show instructions, or command to run a shell command
2027
- Instructions: Markdown content describing what the agent should do
2128

2229
Example use cases:
2330
- Update installation docs when configuration files change
2431
- Require security review when authentication code is modified
2532
- Ensure API documentation stays in sync with API code
2633
- Enforce source/test file pairing
34+
- Auto-run `uv sync` when pyproject.toml changes (command action)
2735

2836

2937
## Available Steps

.deepwork/jobs/deepwork_rules/job.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@ description: |
66
Rules help ensure that code changes follow team guidelines, documentation is updated,
77
and architectural decisions are respected.
88
9+
IMPORTANT: Rules are evaluated at the "Stop" hook, which fires when an agent finishes its turn.
10+
This includes when sub-agents complete their work. Rules are NOT evaluated immediately after
11+
each file edit - they batch up and run once at the end of the agent's response cycle.
12+
- Command action rules: Execute their command (e.g., `uv sync`) when the agent stops
13+
- Prompt action rules: Display instructions to the agent, blocking until addressed
14+
915
Rules are stored as individual markdown files with YAML frontmatter in the `.deepwork/rules/`
1016
directory. Each rule file specifies:
1117
- Detection mode: trigger/safety, set (bidirectional), or pair (directional)
1218
- Patterns: Glob patterns for matching files, with optional variable capture
19+
- Action type: prompt (default) to show instructions, or command to run a shell command
1320
- Instructions: Markdown content describing what the agent should do
1421
1522
Example use cases:
1623
- Update installation docs when configuration files change
1724
- Require security review when authentication code is modified
1825
- Ensure API documentation stays in sync with API code
1926
- Enforce source/test file pairing
27+
- Auto-run `uv sync` when pyproject.toml changes (command action)
2028
2129
changelog:
2230
- version: "0.1.0"

.deepwork/rules/uv-lock-sync.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: UV Lock Sync
3+
trigger: pyproject.toml
4+
action:
5+
command: uv sync
6+
compare_to: prompt
7+
---
8+
9+
# UV Lock Sync
10+
11+
Automatically runs `uv sync` when `pyproject.toml` is modified to keep
12+
`uv.lock` in sync with dependency changes.
13+
14+
This ensures the lock file is always up-to-date when dependencies are
15+
added, removed, or updated in pyproject.toml.

.gemini/skills/deepwork_rules/define.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,25 @@ Manages rules that automatically trigger when certain files change during an AI
275275
Rules help ensure that code changes follow team guidelines, documentation is updated,
276276
and architectural decisions are respected.
277277
278+
IMPORTANT: Rules are evaluated at the "Stop" hook, which fires when an agent finishes its turn.
279+
This includes when sub-agents complete their work. Rules are NOT evaluated immediately after
280+
each file edit - they batch up and run once at the end of the agent's response cycle.
281+
- Command action rules: Execute their command (e.g., `uv sync`) when the agent stops
282+
- Prompt action rules: Display instructions to the agent, blocking until addressed
283+
278284
Rules are stored as individual markdown files with YAML frontmatter in the `.deepwork/rules/`
279285
directory. Each rule file specifies:
280286
- Detection mode: trigger/safety, set (bidirectional), or pair (directional)
281287
- Patterns: Glob patterns for matching files, with optional variable capture
288+
- Action type: prompt (default) to show instructions, or command to run a shell command
282289
- Instructions: Markdown content describing what the agent should do
283290
284291
Example use cases:
285292
- Update installation docs when configuration files change
286293
- Require security review when authentication code is modified
287294
- Ensure API documentation stays in sync with API code
288295
- Enforce source/test file pairing
296+
- Auto-run `uv sync` when pyproject.toml changes (command action)
289297
290298
291299
## Required Inputs

.gemini/skills/deepwork_rules/index.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,25 @@ Manages rules that automatically trigger when certain files change during an AI
1717
Rules help ensure that code changes follow team guidelines, documentation is updated,
1818
and architectural decisions are respected.
1919
20+
IMPORTANT: Rules are evaluated at the "Stop" hook, which fires when an agent finishes its turn.
21+
This includes when sub-agents complete their work. Rules are NOT evaluated immediately after
22+
each file edit - they batch up and run once at the end of the agent's response cycle.
23+
- Command action rules: Execute their command (e.g., `uv sync`) when the agent stops
24+
- Prompt action rules: Display instructions to the agent, blocking until addressed
25+
2026
Rules are stored as individual markdown files with YAML frontmatter in the `.deepwork/rules/`
2127
directory. Each rule file specifies:
2228
- Detection mode: trigger/safety, set (bidirectional), or pair (directional)
2329
- Patterns: Glob patterns for matching files, with optional variable capture
30+
- Action type: prompt (default) to show instructions, or command to run a shell command
2431
- Instructions: Markdown content describing what the agent should do
2532
2633
Example use cases:
2734
- Update installation docs when configuration files change
2835
- Require security review when authentication code is modified
2936
- Ensure API documentation stays in sync with API code
3037
- Enforce source/test file pairing
38+
- Auto-run `uv sync` when pyproject.toml changes (command action)
3139
3240
3341
## Available Steps

src/deepwork/standard_jobs/deepwork_rules/job.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@ description: |
66
Rules help ensure that code changes follow team guidelines, documentation is updated,
77
and architectural decisions are respected.
88
9+
IMPORTANT: Rules are evaluated at the "Stop" hook, which fires when an agent finishes its turn.
10+
This includes when sub-agents complete their work. Rules are NOT evaluated immediately after
11+
each file edit - they batch up and run once at the end of the agent's response cycle.
12+
- Command action rules: Execute their command (e.g., `uv sync`) when the agent stops
13+
- Prompt action rules: Display instructions to the agent, blocking until addressed
14+
915
Rules are stored as individual markdown files with YAML frontmatter in the `.deepwork/rules/`
1016
directory. Each rule file specifies:
1117
- Detection mode: trigger/safety, set (bidirectional), or pair (directional)
1218
- Patterns: Glob patterns for matching files, with optional variable capture
19+
- Action type: prompt (default) to show instructions, or command to run a shell command
1320
- Instructions: Markdown content describing what the agent should do
1421
1522
Example use cases:
1623
- Update installation docs when configuration files change
1724
- Require security review when authentication code is modified
1825
- Ensure API documentation stays in sync with API code
1926
- Enforce source/test file pairing
27+
- Auto-run `uv sync` when pyproject.toml changes (command action)
2028
2129
changelog:
2230
- version: "0.1.0"

0 commit comments

Comments
 (0)