claude-dev-env 1.20.1 → 1.21.0
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.
- package/CLAUDE.md +37 -10
- package/docs/CODE_RULES.md +208 -1
- package/package.json +1 -1
- package/rules/agent-spawn-protocol.md +47 -1
- package/rules/cleanup-temp-files.md +27 -1
- package/rules/code-reviews.md +11 -1
- package/rules/code-standards.md +43 -1
- package/rules/conservative-action.md +20 -1
- package/rules/context7.md +12 -1
- package/rules/explore-thoroughly.md +27 -1
- package/rules/git-workflow.md +42 -1
- package/rules/parallel-tools.md +23 -1
- package/rules/research-mode.md +23 -1
- package/rules/right-sized-engineering.md +28 -1
- package/rules/self-contained-docs.md +17 -1
- package/rules/tdd.md +7 -0
- package/rules/testing.md +1 -1
- package/rules/vault-context.md +34 -1
- package/rules/verify-before-asking.md +42 -1
package/CLAUDE.md
CHANGED
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
# Claude Development Assistant
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Code Rules (NON-NEGOTIABLE)
|
|
4
|
+
@~/.claude/docs/CODE_RULES.md
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Core Philosophy
|
|
6
7
|
|
|
7
|
-
-
|
|
8
|
-
- Git workflow: `~/.claude/rules/git-workflow.md` (pointer to `<git_workflow>`)
|
|
9
|
-
- Development protocol: `<behavior_protocol>` in the system prompt; lean rule `~/.claude/rules/bdd.md`; on-demand `bdd-protocol` skill
|
|
10
|
-
- Tool usage and workflow: `<tool_usage>` and `<agent_workflow>` in the system prompt
|
|
8
|
+
**TDD IS NON-NEGOTIABLE.** Build it right, build it simple. Maintainable > Clever.
|
|
11
9
|
|
|
12
|
-
##
|
|
10
|
+
## Working with Claude
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
### Expectations
|
|
13
|
+
|
|
14
|
+
1. **ALWAYS FOLLOW TDD** - No production code without failing test
|
|
15
|
+
2. **MANDATORY SELF-CHECK before proposing** - See protocol below
|
|
16
|
+
3. Assess refactoring after every green
|
|
17
|
+
|
|
18
|
+
### Mandatory Self-Check Protocol
|
|
19
|
+
|
|
20
|
+
**BEFORE proposing plans/implementation:**
|
|
21
|
+
|
|
22
|
+
☐ Project rules review (e.g. Tasklings `tasklings-preferences` when in that repo path)
|
|
23
|
+
☐ "Is this KISS?" (simplest? unnecessary complexity?)
|
|
24
|
+
☐ "Over-engineering?" (multiple files? premature abstractions?)
|
|
25
|
+
☐ Test infrastructure? (ONE file, functions, YAGNI)
|
|
26
|
+
☐ Tests add value? (no existence checks, no constant tests)
|
|
27
|
+
|
|
28
|
+
## Pre-PR Submission Checklist
|
|
29
|
+
|
|
30
|
+
**Run `/check-pr` OR verify:**
|
|
31
|
+
- ☐ KISS / preferences (multiple requirements.txt? over-engineered?)
|
|
32
|
+
- ☐ KISS (simplest? one file? functions not classes?)
|
|
33
|
+
- ☐ Files (proper modules, correct dirs, no empty __init__.py)
|
|
34
|
+
- ☐ Quality (no dupes, types complete, no Any/any)
|
|
35
|
+
- ☐ Tests (no existence checks, no constant value tests)
|
|
36
|
+
- ☐ Self-checked before proposing?
|
|
37
|
+
|
|
38
|
+
## Compaction
|
|
39
|
+
When compacting, always preserve:
|
|
40
|
+
- Active task and current goal
|
|
41
|
+
- Full list of modified files
|
|
42
|
+
- Any failing test names or error messages
|
|
43
|
+
- Current git branch and PR state
|
package/docs/CODE_RULES.md
CHANGED
|
@@ -1 +1,208 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Code Rules Reference
|
|
2
|
+
|
|
3
|
+
Compact reference for agents. Hook-enforced rules marked with ⚡.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## COMMENT PRESERVATION (ABSOLUTE RULE)
|
|
8
|
+
|
|
9
|
+
**NEVER remove existing comments.** If you are not adding or removing code on a line, do not touch its comments.
|
|
10
|
+
|
|
11
|
+
- Existing comments are SACRED — never delete, rewrite, or "clean up" existing comments
|
|
12
|
+
- New inline comments are not needed — write self-documenting code instead
|
|
13
|
+
- Docstrings for new files/methods/classes are allowed
|
|
14
|
+
- The hook enforces BOTH directions: blocks new inline comments AND blocks deletion of existing comments
|
|
15
|
+
|
|
16
|
+
**Scope:** Only evaluate comments on lines YOU are actively changing. If code is untouched, its comments are untouched.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## CORE PRINCIPLES
|
|
21
|
+
|
|
22
|
+
### Self-Documenting Code
|
|
23
|
+
New code explains itself through naming. Do not add new inline comments — use descriptive names instead. Docstrings on functions/methods/classes are allowed.
|
|
24
|
+
|
|
25
|
+
> **Full readability standard:** `~/.claude/skills/readability-review/SKILL.md` — 8-dimension rubric (naming, SRP, abstraction, control flow, domain language, call sites, state clarity, visual rhythm). Run `/check` for parallel team review or `/readability-review` standalone.
|
|
26
|
+
|
|
27
|
+
### Centralized Configuration
|
|
28
|
+
One source of truth. Every constant lives in ONE place (`config/`).
|
|
29
|
+
|
|
30
|
+
### Reuse Before Create
|
|
31
|
+
Search first. Import second. Create last.
|
|
32
|
+
|
|
33
|
+
### Encapsulation Enables Cleaner Naming
|
|
34
|
+
Expose constants via helper functions: `isMaxLevel(level)` > `level >= MAXIMUM_LEVEL`
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## ⚡ HOOK-ENFORCED RULES
|
|
39
|
+
|
|
40
|
+
These rules are automatically enforced by `code-rules-enforcer.py`. Violations block Write/Edit.
|
|
41
|
+
|
|
42
|
+
| Rule | What's Checked |
|
|
43
|
+
|------|----------------|
|
|
44
|
+
| No NEW comments | `#` / `//` in new code only (existing comments NEVER removed; shebangs, type:, noqa, eslint, docstrings exempt) |
|
|
45
|
+
| Imports at top | No `import` inside function bodies |
|
|
46
|
+
| Logging format args | No `log_*(f"...")` - use `log_*("...", arg)` |
|
|
47
|
+
| File line count | Advisory only — see [File length guidance](#65-file-length-guidance) |
|
|
48
|
+
| Magic values | No literals in function bodies (0, 1, -1 exempt). Includes string templates — if you strip the interpolations from an f-string and the remaining literal text is structural (paths, URLs, patterns), those fragments are magic values that belong in config |
|
|
49
|
+
| Constants location | No `UPPER_SNAKE =` outside `config/` |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 3. REUSE CONSTANTS (DRY CONFIG)
|
|
54
|
+
|
|
55
|
+
**Before writing ANY constant:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Find config files
|
|
59
|
+
# Search your project for existing config files before creating new ones
|
|
60
|
+
|
|
61
|
+
# Search for value
|
|
62
|
+
grep -r "VALUE" config/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Decision tree:**
|
|
66
|
+
1. Search exact value → Found? → IMPORT IT
|
|
67
|
+
2. Search semantic match → Found? → USE EXISTING NAME
|
|
68
|
+
3. Config file exists? → ADD TO EXISTING
|
|
69
|
+
4. Create new (rare)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 4. CONFIG LOCATIONS
|
|
74
|
+
|
|
75
|
+
| Constant Type | Location |
|
|
76
|
+
|---------------|----------|
|
|
77
|
+
| Timeouts, delays, retries | `config/timing.py` |
|
|
78
|
+
| Ports, URLs, thresholds | `config/constants.py` |
|
|
79
|
+
| CSS selectors | `config/selectors.py` |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 5. NO ABBREVIATIONS
|
|
84
|
+
|
|
85
|
+
Full words only. No mental translation.
|
|
86
|
+
|
|
87
|
+
| Bad | Good |
|
|
88
|
+
|-----|------|
|
|
89
|
+
| `ctx`, `cfg`, `msg` | `context`, `configuration`, `message` |
|
|
90
|
+
| `btn`, `idx`, `cnt` | `button`, `index`, `count` |
|
|
91
|
+
| `tmp`, `elem`, `val` | `temporary_value`, `element`, `value` |
|
|
92
|
+
|
|
93
|
+
**Exception:** `i`, `j`, `k` in loops; `e` for exception.
|
|
94
|
+
|
|
95
|
+
**Extended naming rules** (from readability-review rubric):
|
|
96
|
+
- Loop vars: `each_order`, `each_user` (prefix `each_`)
|
|
97
|
+
- Booleans: `is_valid`, `has_permission`, `should_retry` (prefix `is_`/`has_`/`should_`/`can_`)
|
|
98
|
+
- Collections: `all_orders`, `all_users` (prefix `all_`)
|
|
99
|
+
- Maps: `price_by_product`, `user_by_id` (pattern `X_by_Y`)
|
|
100
|
+
- Preposition params: `from_path=`, `to=`, `into=`
|
|
101
|
+
- **Banned names:** `result`, `data`, `output`, `response`, `value`, `item`, `temp`
|
|
102
|
+
- **Banned prefixes:** `handle`, `process`, `manage`, `do`
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 6. COMPLETE TYPE HINTS
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
def function_name(
|
|
110
|
+
parameter: str,
|
|
111
|
+
optional: Optional[str] = None,
|
|
112
|
+
) -> ReturnType:
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- ALL parameters typed
|
|
116
|
+
- ALL returns typed
|
|
117
|
+
- No `Any` type
|
|
118
|
+
- No `# type: ignore`
|
|
119
|
+
|
|
120
|
+
*(Also enforced by mypy_validator.py hook)*
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 6.5 FILE LENGTH GUIDANCE
|
|
125
|
+
|
|
126
|
+
File length is a **smell signal, not a hard threshold**. Long files often hide multiple responsibilities, but legitimately long files exist (migrations, generated code, registries, fixtures). The hook surfaces advisories instead of blocking.
|
|
127
|
+
|
|
128
|
+
**Two advisory thresholds (non-blocking, stderr only):**
|
|
129
|
+
|
|
130
|
+
| Threshold | Source basis | Hook behavior |
|
|
131
|
+
|-----------|--------------|---------------|
|
|
132
|
+
| `>= 400` lines | Robert C. Martin, *Clean Code* (2008), Ch. 5 "Formatting" — small files preferred; Martin Fowler, *Refactoring* — "Large Class" code smell | Soft advisory: "consider splitting" |
|
|
133
|
+
| `>= 1000` lines | pylint default `max-module-lines=1000`; SonarQube rule S104 default `1000` | Strong nudge: "exceeds widely-used static-analysis defaults" |
|
|
134
|
+
|
|
135
|
+
**What we deliberately reject:**
|
|
136
|
+
|
|
137
|
+
- **Hard numeric blocks** — Google's Python Style Guide imposes no file-length cap (only a ~40-line function review hint at https://google.github.io/styleguide/pyguide.html). A blocking rule produces false positives on legitimate cases.
|
|
138
|
+
- **A single magic number** — Different sources land at 200 (*Clean Code* preference), 750 (some SonarQube language profiles), or 1000 (pylint, Sonar Java). No source justifies a single universal cap.
|
|
139
|
+
|
|
140
|
+
**When to actually split:**
|
|
141
|
+
|
|
142
|
+
The size signal matters *because* of what it usually indicates: multiple responsibilities (Single Responsibility Principle — Robert C. Martin, *Agile Software Development*, 2002), poor cohesion (Steve McConnell, *Code Complete 2e*, 2004, Ch. 5–6), or the "Large Class" / "Long Function" smells (Fowler). Use the readability rubric (`~/.claude/skills/readability-review/SKILL.md`) when an advisory fires — split based on cohesion, not line count.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 7. RIGHT-SIZED ENGINEERING
|
|
147
|
+
|
|
148
|
+
**Simple > Clever. Functions > Classes. Concrete > Abstract.**
|
|
149
|
+
|
|
150
|
+
Never: ABC for single impl, DI frameworks, factory for single type
|
|
151
|
+
Always: Functions when no state, concrete classes, simple imports
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 8. TDD PROCESS
|
|
156
|
+
|
|
157
|
+
1. **RED** - Failing test first
|
|
158
|
+
2. **GREEN** - Minimum code to pass
|
|
159
|
+
3. **REFACTOR** - Only if valuable
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 9. SELF-CONTAINED COMPONENTS
|
|
164
|
+
|
|
165
|
+
Components own their complete feature. Parents just render `<Child />`.
|
|
166
|
+
|
|
167
|
+
Child handles: state, modals, overlays, toasts
|
|
168
|
+
Parent knows: nothing about child's internals
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 10. NO REDUNDANT DATA FETCHES
|
|
173
|
+
|
|
174
|
+
If you already have data, don't fetch again.
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
// BAD
|
|
178
|
+
const profile = await getProfile();
|
|
179
|
+
const localProfile = await db.profile.first(); // same data!
|
|
180
|
+
|
|
181
|
+
// GOOD
|
|
182
|
+
const profile = await db.profile.first();
|
|
183
|
+
// ... use profile throughout ...
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## QUICK CHECKLIST
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
Before ANY code:
|
|
192
|
+
[ ] Searched existing configs?
|
|
193
|
+
[ ] Importing from centralized config?
|
|
194
|
+
|
|
195
|
+
Hook will enforce:
|
|
196
|
+
[⚡] No NEW comments (existing comments NEVER removed)
|
|
197
|
+
[⚡] No magic values
|
|
198
|
+
[⚡] Imports at top
|
|
199
|
+
[⚡] Logging format args
|
|
200
|
+
[ ] File length reasonable (advisory at 400, strong nudge at 1000 — see §6.5)
|
|
201
|
+
[⚡] Constants in config/
|
|
202
|
+
|
|
203
|
+
Manual check:
|
|
204
|
+
[ ] No abbreviations?
|
|
205
|
+
[ ] Complete type hints?
|
|
206
|
+
[ ] Self-contained components?
|
|
207
|
+
[ ] Readability: /check or /readability-review
|
|
208
|
+
```
|
package/package.json
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
# Agent
|
|
1
|
+
# Agent Spawn Protocol (Mandatory)
|
|
2
|
+
|
|
3
|
+
**When this applies:** Before any Agent or Task tool invocation (Explore, implementation, research, or team subagents).
|
|
4
|
+
|
|
5
|
+
<agent_spawn_protocol>
|
|
6
|
+
|
|
7
|
+
## Before spawning ANY agent — no exceptions
|
|
8
|
+
|
|
9
|
+
Every Agent and Task tool call must follow this protocol. This includes Explore agents, research agents, execution agents, and team members.
|
|
10
|
+
|
|
11
|
+
### Step 1: Context sufficiency check
|
|
12
|
+
|
|
13
|
+
Before writing any agent prompt, verify you can answer all of these:
|
|
14
|
+
- [ ] What specific files, directories, or areas of the codebase are involved?
|
|
15
|
+
- [ ] What constraints apply? (patterns to follow, things NOT to change, boundaries)
|
|
16
|
+
- [ ] What does success look like? (expected output, acceptance criteria)
|
|
17
|
+
- [ ] Is the task unambiguous enough to delegate?
|
|
18
|
+
|
|
19
|
+
If ANY answer is "I don't know" -- investigate first (read files, search code) or ask the user. Do NOT spawn with incomplete context.
|
|
20
|
+
|
|
21
|
+
### Step 2: Craft the prompt with /prompt-generator
|
|
22
|
+
|
|
23
|
+
Run the `/prompt-generator` skill to produce a structured prompt. Feed it:
|
|
24
|
+
- The task description and goal
|
|
25
|
+
- Target files/directories discovered in Step 1
|
|
26
|
+
- Constraints and boundaries
|
|
27
|
+
- Expected output format
|
|
28
|
+
- Acceptance criteria
|
|
29
|
+
|
|
30
|
+
The skill will ask 1-3 clarifying questions if information is missing -- this is the built-in context verification.
|
|
31
|
+
|
|
32
|
+
Use the skill's output as the agent's `prompt` parameter.
|
|
33
|
+
|
|
34
|
+
### Step 3: Spawn the agent
|
|
35
|
+
|
|
36
|
+
Pass the structured prompt from Step 2 to the Agent/Task tool.
|
|
37
|
+
|
|
38
|
+
</agent_spawn_protocol>
|
|
39
|
+
|
|
40
|
+
## Why
|
|
41
|
+
|
|
42
|
+
Agents receiving vague prompts waste tokens exploring in circles, produce code that misses constraints, and require expensive rework. A 30-second investment in prompt quality via /prompt-generator saves 5-minute agent failures. This applies equally to Explore agents (which waste context on unfocused searches) and execution agents (which write wrong code).
|
|
43
|
+
|
|
44
|
+
## Relationship to other rules
|
|
45
|
+
|
|
46
|
+
- **conservative-action.md** gates acting when ambiguous. This extends that: do not delegate when the task is ambiguous—investigate or ask the user first.
|
|
47
|
+
- Project-specific rules or `~/.claude/CLAUDE.md` may define *whether* to use subagents or teams; this rule governs *how* to craft prompts when you do delegate.
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Clean Up Temporary Files
|
|
2
|
+
|
|
3
|
+
**When this applies:** After tasks that created scratch files, debug dumps, or one-off scripts the user did not ask to keep.
|
|
4
|
+
|
|
5
|
+
Source: [Anthropic — Reduce file creation in agentic coding](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#reduce-file-creation-in-agentic-coding)
|
|
6
|
+
|
|
7
|
+
## During a task
|
|
8
|
+
|
|
9
|
+
- Prefer working in memory over creating scratchpad files. Use variables and tool results instead of writing intermediate data to disk.
|
|
10
|
+
- When a temporary file is genuinely needed (e.g., a helper script, a test fixture, a debug output), track it mentally for cleanup.
|
|
11
|
+
|
|
12
|
+
## When a task is complete
|
|
13
|
+
|
|
14
|
+
- Remove every temporary file, script, or helper file you created during the task.
|
|
15
|
+
- Leave the working directory cleaner than you found it.
|
|
16
|
+
- If a file was created at the user's explicit request (not as a byproduct of your process), leave it in place.
|
|
17
|
+
|
|
18
|
+
## What counts as temporary
|
|
19
|
+
|
|
20
|
+
- Scripts written to test a hypothesis or run a one-off check
|
|
21
|
+
- Debug output files, log dumps, or intermediate data exports
|
|
22
|
+
- Helper files created to work around tool limitations
|
|
23
|
+
- Any file the user did not ask for and would not expect to find after the task
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
|
|
27
|
+
Temporary files accumulate across sessions and clutter the project root. Latest models sometimes use files as scratchpads during iteration, and these leftovers confuse both the user and future sessions if not cleaned up.
|
package/rules/code-reviews.md
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Responding to Code Reviews
|
|
2
|
+
|
|
3
|
+
**When this applies:** GitHub PR review feedback on a branch you are fixing.
|
|
4
|
+
|
|
5
|
+
**MANDATORY PROTOCOL (use pr-review-responder skill):**
|
|
6
|
+
|
|
7
|
+
1. Fetch ALL reviewer comments BEFORE any fixes
|
|
8
|
+
2. Create TodoWrite checklist - One item per comment
|
|
9
|
+
3. Fix systematically - Mark each todo complete
|
|
10
|
+
4. Reply to EACH comment inline
|
|
11
|
+
5. Create ONE review fix commit - DO NOT squash with original
|
package/rules/code-standards.md
CHANGED
|
@@ -1 +1,43 @@
|
|
|
1
|
-
# Code
|
|
1
|
+
# Code Standards
|
|
2
|
+
|
|
3
|
+
> **MANDATORY REFERENCE:** CODE_RULES.md - Load for ALL code generation.
|
|
4
|
+
> This is the single source of truth for code standards. Non-negotiable.
|
|
5
|
+
|
|
6
|
+
@~/.claude/docs/CODE_RULES.md
|
|
7
|
+
|
|
8
|
+
**Key principles (see CODE_RULES.md for complete reference):**
|
|
9
|
+
- Self-documenting code (no comments)
|
|
10
|
+
- Centralized configuration (one source of truth)
|
|
11
|
+
- Reuse constants (search before creating)
|
|
12
|
+
- No magic values (everything named)
|
|
13
|
+
- No abbreviations (full words)
|
|
14
|
+
- Complete type hints
|
|
15
|
+
- TDD (test first)
|
|
16
|
+
|
|
17
|
+
## Function Parameters - Required vs Optional
|
|
18
|
+
|
|
19
|
+
**Use required parameters when no valid use case exists for optional.**
|
|
20
|
+
**Remove unused parameters.**
|
|
21
|
+
|
|
22
|
+
## Encapsulation - Logic Belongs in Models
|
|
23
|
+
|
|
24
|
+
**NEVER scatter construction logic in calling code.**
|
|
25
|
+
|
|
26
|
+
Path/URL building, formatting, transformations -> Put in model methods.
|
|
27
|
+
If you find yourself building the same string pattern in multiple places, it belongs in the model.
|
|
28
|
+
|
|
29
|
+
## Document Temporary Code
|
|
30
|
+
|
|
31
|
+
**Scaffolding/placeholder code MUST have TODO comments.**
|
|
32
|
+
|
|
33
|
+
When code exists only to enable testing before full implementation:
|
|
34
|
+
- Add `// TODO: Replace with...` explaining what will replace it
|
|
35
|
+
- Explain WHY it's temporary, not just WHAT it does
|
|
36
|
+
|
|
37
|
+
## Naming Reflects Behavior
|
|
38
|
+
|
|
39
|
+
**Name components after what they ARE, not abstract concepts.**
|
|
40
|
+
|
|
41
|
+
If it overlays the viewport -> "Overlay" not "Screen"
|
|
42
|
+
If it validates input -> "Validator" not "Handler"
|
|
43
|
+
Names should describe observable behavior or visual appearance.
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
# Conservative
|
|
1
|
+
# Conservative Action
|
|
2
|
+
|
|
3
|
+
Source: [Anthropic - Tool Usage](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#tool-usage)
|
|
4
|
+
|
|
5
|
+
<do_not_act_before_instructions>
|
|
6
|
+
When the user's intent is ambiguous, default to research and recommendations rather than taking action. Provide information, explain options, and surface tradeoffs — then let the user decide before making changes.
|
|
7
|
+
|
|
8
|
+
Proceed with edits, file modifications, or implementations only when the user explicitly requests them.
|
|
9
|
+
</do_not_act_before_instructions>
|
|
10
|
+
|
|
11
|
+
## Deciding whether to act
|
|
12
|
+
|
|
13
|
+
- If the user asks a question, answer the question. Do not also fix the thing they asked about.
|
|
14
|
+
- If the user describes a problem, investigate and recommend. Do not jump to implementation.
|
|
15
|
+
- If the user says "do it", "go ahead", "make the change", or similarly explicit language, proceed with action.
|
|
16
|
+
- When in doubt, ask: "Would you like me to make this change, or just show you the approach?"
|
|
17
|
+
|
|
18
|
+
## Why
|
|
19
|
+
|
|
20
|
+
Acting prematurely wastes effort and round-trips when the user wanted a different approach. Exploring first produces better outcomes than committing early. This is especially important with models that have a strong action bias.
|
package/rules/context7.md
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
When working with libraries, frameworks, or APIs — use Context7 MCP to fetch current documentation instead of relying on training data. This includes setup questions, code generation, API references, and anything involving specific packages.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Call `resolve-library-id` with the library name and the user's question
|
|
10
|
+
2. Pick the best match — prefer exact names and version-specific IDs when a version is mentioned
|
|
11
|
+
3. Call `query-docs` with the selected library ID and the user's question
|
|
12
|
+
4. Answer using the fetched docs — include code examples and cite the version
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
# Explore
|
|
1
|
+
# Explore Thoroughly
|
|
2
|
+
|
|
3
|
+
Source: [Anthropic - Overthinking and Excessive Thoroughness](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#overthinking-and-excessive-thoroughness)
|
|
4
|
+
|
|
5
|
+
Note: This deliberately chooses exploration depth over the "commit and execute quickly" pattern from the same source. Thorough upfront exploration is preferred for the intended workflow.
|
|
6
|
+
|
|
7
|
+
## Before committing to an approach
|
|
8
|
+
|
|
9
|
+
- Read the relevant files. Understand what exists before proposing what to change.
|
|
10
|
+
- Map the existing patterns: naming conventions, file organization, architectural decisions.
|
|
11
|
+
- Identify constraints that could invalidate an approach before investing effort in it.
|
|
12
|
+
- For unfamiliar codebases or high-stakes changes, invest more time exploring than feels necessary.
|
|
13
|
+
|
|
14
|
+
## Exploration scales with risk
|
|
15
|
+
|
|
16
|
+
- Small change to a familiar file: a quick read of the file and its immediate neighbors is sufficient.
|
|
17
|
+
- New feature or cross-cutting change: read broadly across the codebase to understand how similar things are done.
|
|
18
|
+
- Architectural decision: explore the full landscape before recommending a direction.
|
|
19
|
+
|
|
20
|
+
## Relationship to other rules
|
|
21
|
+
|
|
22
|
+
- **conservative-action.md** gates *whether* to act. This rule governs *how deeply* to investigate.
|
|
23
|
+
- **research-mode.md** ensures factual claims are grounded. This rule ensures implementation plans are grounded in the actual codebase.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
|
|
27
|
+
Premature commitment leads to wasted effort when the chosen approach conflicts with existing patterns or misses important context. Thorough exploration surfaces constraints early and produces better-informed solutions.
|
package/rules/git-workflow.md
CHANGED
|
@@ -1 +1,42 @@
|
|
|
1
|
-
# Git
|
|
1
|
+
# Git Workflow
|
|
2
|
+
|
|
3
|
+
User-level rule: applies to **every** git repo that uses GitHub with `gh` (no exceptions for “small” or non-primary repos unless the user says otherwise in the session).
|
|
4
|
+
|
|
5
|
+
## Workflow Decision Tree
|
|
6
|
+
|
|
7
|
+
**When to use stacked PRs:** Feature B depends on Feature A's implementation
|
|
8
|
+
|
|
9
|
+
**When to extract shared infrastructure first:** Multiple features need same utilities/helpers
|
|
10
|
+
|
|
11
|
+
**Extract Shared Infrastructure Pattern:**
|
|
12
|
+
1. Create infrastructure PR with only shared code
|
|
13
|
+
2. Get reviewed and MERGE infrastructure first
|
|
14
|
+
3. Launch parallel feature PRs that use merged infrastructure
|
|
15
|
+
|
|
16
|
+
## PR Submission Rules
|
|
17
|
+
|
|
18
|
+
**ALWAYS create PRs as DRAFT:** Use `gh pr create --draft` for ALL PRs
|
|
19
|
+
|
|
20
|
+
## Git Golden Rules (NON-NEGOTIABLE)
|
|
21
|
+
|
|
22
|
+
1. **DRAFT BEFORE PUSH**: When pushing ANYTHING to a PR, it MUST be in draft state first
|
|
23
|
+
- Before push: `gh pr ready --undo`
|
|
24
|
+
- After review approved: `gh pr ready`
|
|
25
|
+
|
|
26
|
+
2. **ONE COMMIT PER REVIEW STAGE**: Each review round gets exactly ONE commit
|
|
27
|
+
- Initial feature: 1 commit
|
|
28
|
+
- After review #1: 2 commits (initial + review #1 fixes)
|
|
29
|
+
- After review #2: 3 commits (initial + review #1 fixes + review #2 fixes)
|
|
30
|
+
- NEVER squash multiple review stages into one commit
|
|
31
|
+
- NEVER have multiple commits for the same review stage
|
|
32
|
+
|
|
33
|
+
## Never Commit Working Documents or Images
|
|
34
|
+
|
|
35
|
+
**NEVER commit these files to the repo:**
|
|
36
|
+
|
|
37
|
+
| Pattern | Reason |
|
|
38
|
+
|---------|--------|
|
|
39
|
+
| `docs/plans/*.md` | Working documents for planning, not repo content |
|
|
40
|
+
| `*.plan.md` | Temporary planning files |
|
|
41
|
+
| `SESSION_STATE.md` | Local session state |
|
|
42
|
+
| `*.png *.jpg *.jpeg *.gif *.webp *.avif *.svg *.ico` | Images go to external storage, not GitHub |
|
package/rules/parallel-tools.md
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
# Parallel
|
|
1
|
+
# Parallel Tool Calls
|
|
2
|
+
|
|
3
|
+
Source: [Anthropic - Parallel Tool Calling](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#optimize-parallel-tool-calling)
|
|
4
|
+
|
|
5
|
+
<use_parallel_tool_calls>
|
|
6
|
+
When multiple tool calls have no dependencies between them, make all independent calls in a single response. Only sequence calls when a later call needs an earlier call's result.
|
|
7
|
+
</use_parallel_tool_calls>
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
- Reading 3 files: call all 3 Read operations at once.
|
|
12
|
+
- Running independent searches: launch all Grep/Glob calls simultaneously.
|
|
13
|
+
- Checking git status + reading a config file: both in one response.
|
|
14
|
+
- Reading a file, then editing based on its content: sequential (edit depends on read result).
|
|
15
|
+
|
|
16
|
+
## Guard rails
|
|
17
|
+
|
|
18
|
+
- Use real parameter values only. Do not guess or use placeholders to force parallelism.
|
|
19
|
+
- If you are unsure whether calls are independent, run them sequentially.
|
|
20
|
+
|
|
21
|
+
## Why
|
|
22
|
+
|
|
23
|
+
Explicit reinforcement of parallel calling boosts compliance to near 100%. Sequential calls for independent operations waste time and round-trips for the user.
|
package/rules/research-mode.md
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
# Research
|
|
1
|
+
# Research Mode (Global)
|
|
2
|
+
|
|
3
|
+
Three anti-hallucination constraints are ALWAYS active.
|
|
4
|
+
|
|
5
|
+
Source: [Anthropic - Reduce Hallucinations](https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/reduce-hallucinations)
|
|
6
|
+
|
|
7
|
+
## 1. Say "I don't know"
|
|
8
|
+
If you don't have a credible source for a claim, say so. Don't guess. Don't infer. "I don't have data on this" is always a valid answer.
|
|
9
|
+
|
|
10
|
+
## 2. Verify with citations
|
|
11
|
+
Every recommendation, claim, or piece of advice must cite a specific source:
|
|
12
|
+
- A file in the current project
|
|
13
|
+
- An external source found via web search (with URL)
|
|
14
|
+
- A named expert, paper, or researcher
|
|
15
|
+
- Official documentation
|
|
16
|
+
|
|
17
|
+
If you generate a claim and cannot find a supporting source, retract it. Do not present it.
|
|
18
|
+
|
|
19
|
+
## 3. Direct quotes for factual grounding
|
|
20
|
+
When working from documents, extract the actual text first before analyzing. Ground your response in word-for-word quotes, not paraphrased summaries. Reference the quote when making your point.
|
|
21
|
+
|
|
22
|
+
## Exceptions
|
|
23
|
+
Creative thinking, brainstorming, and novel ideas don't require citation. You can synthesize across sources to reach new conclusions, but the inputs must be grounded.
|
|
@@ -1 +1,28 @@
|
|
|
1
|
-
# Right-
|
|
1
|
+
# Right-Sized Engineering
|
|
2
|
+
|
|
3
|
+
**Build it right, but build it simple.** Good engineering principles at the appropriate scale.
|
|
4
|
+
|
|
5
|
+
## Always Do
|
|
6
|
+
- Extract constants and configuration (no hardcoding)
|
|
7
|
+
- Create reusable functions (no copy-paste)
|
|
8
|
+
- Use proper error handling
|
|
9
|
+
- Follow DRY from the start
|
|
10
|
+
- Single responsibility per function
|
|
11
|
+
|
|
12
|
+
## Never Do (Solo Scale)
|
|
13
|
+
- Abstract base classes for single implementations
|
|
14
|
+
- Dependency injection frameworks
|
|
15
|
+
- Complex patterns (CQRS, microservices)
|
|
16
|
+
- Multiple inheritance hierarchies
|
|
17
|
+
- Over-abstracted interfaces
|
|
18
|
+
|
|
19
|
+
## Complexity Budget
|
|
20
|
+
|
|
21
|
+
**State BEFORE implementation:** Files (target 1-2, max 3), Lines (~50-300), Checkpoints ("Is this MINIMUM?", "Fewer files?", "Functions vs classes?")
|
|
22
|
+
|
|
23
|
+
## YAGNI for API Surface
|
|
24
|
+
|
|
25
|
+
**Don't expose optional parameters until they're actually used.**
|
|
26
|
+
|
|
27
|
+
If a value will always be a constant for now, use the constant internally.
|
|
28
|
+
Only add the parameter when callers actually need to vary it.
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
# Self-
|
|
1
|
+
# Self-Contained Documentation
|
|
2
|
+
|
|
3
|
+
**When this applies:** All generated artifacts — gists, decision docs, PR descriptions, issue bodies, plans, SKILL.md content. Exception: Obsidian session logs (intentionally conversation-scoped).
|
|
4
|
+
|
|
5
|
+
## Rule
|
|
6
|
+
|
|
7
|
+
Every document must be fully self-contained. A reader with zero prior context must understand every statement without needing access to the conversation that produced it.
|
|
8
|
+
|
|
9
|
+
## Patterns to Catch and Replace
|
|
10
|
+
|
|
11
|
+
| Pattern | Example | Fix |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| References to options/choices discussed in conversation | "This is not Option A from the original framing" | Delete the sentence, or restate the decision on its own terms |
|
|
14
|
+
| "As discussed" / "as we decided" / "from the prior session" | "As discussed, we'll use embeddings" | "Sref matching uses sentence-transformer embeddings" |
|
|
15
|
+
| Pronouns pointing to conversation context | "This approach addresses the concerns raised earlier" | State what the concerns were inline, or delete |
|
|
16
|
+
| Relative framing ("instead of X") where X was only discussed verbally | "Instead of the three options considered" | State the chosen approach directly without referencing alternatives the reader can't see |
|
|
17
|
+
| Session-specific sequencing | "After Round 3 we decided..." | State the decision as a fact |
|
package/rules/tdd.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# TDD Process: Red-Green-Refactor
|
|
2
|
+
|
|
3
|
+
**TEST-DRIVEN DEVELOPMENT IS NON-NEGOTIABLE.** Every single line of production code must be written in response to a failing test. No exceptions.
|
|
4
|
+
|
|
5
|
+
1. **Red**: Write failing test. NO PRODUCTION CODE.
|
|
6
|
+
2. **Green**: MINIMUM code to pass. Resist urge for more.
|
|
7
|
+
3. **Refactor**: Assess improvements. Only if valuable.
|
package/rules/testing.md
CHANGED
package/rules/vault-context.md
CHANGED
|
@@ -1 +1,34 @@
|
|
|
1
|
-
# Vault
|
|
1
|
+
# Obsidian Vault Context
|
|
2
|
+
|
|
3
|
+
An Obsidian vault stores session reports, decisions, and research documents across all projects. Its filesystem location is configured per user via the `OBSIDIAN_VAULT_PATH` environment variable (or the equivalent path exposed by the user's Obsidian MCP server). Do not assume a specific OS path; resolve the vault location from the configured MCP tools before reading files directly.
|
|
4
|
+
|
|
5
|
+
## Available MCP Tools
|
|
6
|
+
|
|
7
|
+
- `mcp__obsidian__search_notes` -- search by content or frontmatter (`searchFrontmatter: true`)
|
|
8
|
+
- `mcp__obsidian__read_note` -- read a single note by path
|
|
9
|
+
- `mcp__obsidian__read_multiple_notes` -- read several notes at once
|
|
10
|
+
|
|
11
|
+
## Vault Structure
|
|
12
|
+
|
|
13
|
+
- `sessions/` -- session reports with frontmatter: `type: session-report`, `project`, `session`, `date`, `status`, `blocked`, `tags`
|
|
14
|
+
- `decisions/` -- decision notes with frontmatter: `type: decision|procedural|fact|gotcha`, `project`, `date`, `status: Active|Superseded`, `tags`
|
|
15
|
+
- `Research/` -- deep research documents
|
|
16
|
+
|
|
17
|
+
## When to Search
|
|
18
|
+
|
|
19
|
+
IMPORTANT: Before starting substantive project work, search the vault for prior sessions and decisions for the current project. Also search when:
|
|
20
|
+
- Encountering a component or system with known history
|
|
21
|
+
- A task might repeat or reverse a prior decision
|
|
22
|
+
- You need context on why something was built a certain way
|
|
23
|
+
|
|
24
|
+
Search by `project` frontmatter field first, then by content keywords like "blocked", "superseded", "decision", "gotcha".
|
|
25
|
+
|
|
26
|
+
## Session Logging
|
|
27
|
+
|
|
28
|
+
When the user invokes `/session-log`, treat **short and long sessions the same**: run the full logging flow. Session length does not change the requirements below.
|
|
29
|
+
|
|
30
|
+
At the end of substantive sessions, offer to run `/session-log` if not already invoked.
|
|
31
|
+
|
|
32
|
+
When running `/session-log`, include `vault_context_retrieved: true|false` in frontmatter based on whether vault MCP tools were used this session.
|
|
33
|
+
|
|
34
|
+
After writing a session log, ALWAYS output a `/rename` command with a descriptive session name based on the session's primary outcome. Format: `/rename [Project] - [Primary Outcome]`. This is a mandatory output requirement, not optional.
|
|
@@ -1 +1,42 @@
|
|
|
1
|
-
# Verify
|
|
1
|
+
# Verify Before Asking
|
|
2
|
+
|
|
3
|
+
**When this applies:** Before asking the user any clarifying question during discovery, scoping, or implementation planning.
|
|
4
|
+
|
|
5
|
+
## Rule
|
|
6
|
+
|
|
7
|
+
If a question can be answered by inspecting files, running a command, querying a database, reading a config, or using any available tool, answer it yourself. Only ask the user questions that require their judgment, preference, or knowledge that is not accessible to automated inspection.
|
|
8
|
+
|
|
9
|
+
## Decision Checklist
|
|
10
|
+
|
|
11
|
+
Before writing any AskUserQuestion or asking a clarifying question in chat, evaluate:
|
|
12
|
+
|
|
13
|
+
| Check | Action |
|
|
14
|
+
|---|---|
|
|
15
|
+
| Does the answer live in a file on disk? | Read the file. |
|
|
16
|
+
| Does the answer live in a directory structure? | List the directory. |
|
|
17
|
+
| Does the answer live in a database? | Query the database. |
|
|
18
|
+
| Does the answer live in git history? | Run `git log` or `git blame`. |
|
|
19
|
+
| Is the answer determined by file naming patterns or contents? | Glob a sample and inspect. |
|
|
20
|
+
| Is the answer a value in a config or environment variable? | Read the config or check the env. |
|
|
21
|
+
| Is the answer retrievable from any available MCP tool? | Use the tool. |
|
|
22
|
+
|
|
23
|
+
Only after confirming the answer cannot be obtained through any available tool, ask the user.
|
|
24
|
+
|
|
25
|
+
## Questions That Belong to the User
|
|
26
|
+
|
|
27
|
+
Reserve user questions for:
|
|
28
|
+
- **Preferences** — "Do you want approach A or B?" when both are viable and the user has a stake.
|
|
29
|
+
- **Missing context the user holds** — passwords, account names, intent, future plans.
|
|
30
|
+
- **Judgment calls** — tradeoffs the user needs to evaluate.
|
|
31
|
+
- **Scope decisions** — what to include or exclude from a piece of work.
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
**Wrong:** "Are there multiple images per folder, or just one image + one mp4?"
|
|
36
|
+
**Right:** List the folder contents directly, then state what was found.
|
|
37
|
+
|
|
38
|
+
**Wrong:** "What columns does the themes table have?"
|
|
39
|
+
**Right:** Query `information_schema.columns` and report the schema.
|
|
40
|
+
|
|
41
|
+
**Wrong:** "Is there a Prisma schema in this project?"
|
|
42
|
+
**Right:** Glob for `schema.prisma` and check.
|