cc-discipline 2.10.1 → 2.10.2
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/README.md +153 -153
- package/README.zh-CN.md +207 -207
- package/bin/cli.sh +96 -96
- package/global/CLAUDE.md +45 -45
- package/init.sh +594 -594
- package/lib/doctor.sh +145 -145
- package/lib/stack-remove.sh +68 -68
- package/lib/status.sh +100 -100
- package/package.json +34 -34
- package/templates/.claude/agents/investigator.md +44 -44
- package/templates/.claude/agents/reviewer.md +46 -46
- package/templates/.claude/hooks/action-counter.sh +58 -58
- package/templates/.claude/hooks/git-guard.sh +62 -62
- package/templates/.claude/hooks/phase-gate.sh +10 -10
- package/templates/.claude/hooks/post-error-remind.sh +114 -114
- package/templates/.claude/hooks/pre-edit-guard.sh +100 -100
- package/templates/.claude/hooks/session-start.sh +44 -44
- package/templates/.claude/hooks/streak-breaker.sh +111 -111
- package/templates/.claude/rules/00-core-principles.md +16 -16
- package/templates/.claude/rules/01-debugging.md +32 -32
- package/templates/.claude/rules/02-before-edit.md +22 -22
- package/templates/.claude/rules/03-context-mgmt.md +44 -44
- package/templates/.claude/rules/04-no-mole-whacking.md +26 -26
- package/templates/.claude/rules/05-phase-discipline.md +15 -15
- package/templates/.claude/rules/06-multi-task.md +12 -12
- package/templates/.claude/rules/07-integrity.md +92 -92
- package/templates/.claude/rules/stacks/embedded.md +24 -24
- package/templates/.claude/rules/stacks/js-ts.md +21 -21
- package/templates/.claude/rules/stacks/mobile.md +16 -16
- package/templates/.claude/rules/stacks/python.md +20 -20
- package/templates/.claude/rules/stacks/rtl.md +24 -24
- package/templates/.claude/settings.json +84 -84
- package/templates/.claude/skills/commit/SKILL.md +40 -40
- package/templates/.claude/skills/evaluate/SKILL.md +57 -57
- package/templates/.claude/skills/investigate/SKILL.md +192 -192
- package/templates/.claude/skills/retro/SKILL.md +40 -40
- package/templates/.claude/skills/self-check/SKILL.md +87 -87
- package/templates/.claude/skills/summary/SKILL.md +48 -48
- package/templates/.claude/skills/think/SKILL.md +108 -108
- package/templates/CLAUDE.md +96 -96
- package/templates/docs/debug-log.md +48 -48
- package/templates/docs/progress.md +72 -72
- package/templates/memory/MEMORY.md +23 -23
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
---
|
|
2
|
-
globs: "**/*"
|
|
3
|
-
description: "Integrity discipline — verification, honesty, and protecting the user's credibility"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Integrity Discipline
|
|
7
|
-
|
|
8
|
-
These practices protect the user's credibility and the quality of our work together. They exist because past failures in these areas had real consequences.
|
|
9
|
-
|
|
10
|
-
### 1. Start with what you can control
|
|
11
|
-
|
|
12
|
-
When something fails, the natural instinct is to look outward: the library has a bug, the tool is broken, the docs are wrong. But most failures trace back to something within your control: an assumption not tested, docs not fully read, a verification step skipped.
|
|
13
|
-
|
|
14
|
-
**Rule: When something fails, exhaust internal causes first. Only consider external factors after ruling out your own assumptions and actions.**
|
|
15
|
-
|
|
16
|
-
### 2. Never claim "verified" without actually running it
|
|
17
|
-
|
|
18
|
-
Claiming something was tested without running it undermines all subsequent analysis — and the user's credibility if they rely on it.
|
|
19
|
-
|
|
20
|
-
- "Tests pass" requires actual test output showing pass
|
|
21
|
-
- "No errors" requires actual tool output showing zero errors
|
|
22
|
-
- "Removing X doesn't affect Y" requires actually removing X and observing Y
|
|
23
|
-
- Any conclusion without verification must be labeled "unverified" or "assumption"
|
|
24
|
-
|
|
25
|
-
**Rule: Every verification claim must have a corresponding actual execution. If you haven't run it, say so. Marking a task ✅ requires pasting the verification command and output summary.**
|
|
26
|
-
|
|
27
|
-
### 3. Never alter tool output
|
|
28
|
-
|
|
29
|
-
Error messages, test results, build logs, lint output — quote them exactly as-is. Do not:
|
|
30
|
-
- Rephrase error messages
|
|
31
|
-
- Add attribution not present in the original (e.g., "caused by library bug")
|
|
32
|
-
- Omit parts that are inconvenient
|
|
33
|
-
- Change meaning while "summarizing"
|
|
34
|
-
|
|
35
|
-
**Rule: When citing tool output, paste verbatim. Write your analysis separately and explicitly label it as your interpretation.**
|
|
36
|
-
|
|
37
|
-
### 4. Verify assumptions before acting
|
|
38
|
-
|
|
39
|
-
Before starting work, identify and verify:
|
|
40
|
-
- Does the target platform/environment actually support what you're assuming?
|
|
41
|
-
- Are the dependencies/libraries/APIs actually available?
|
|
42
|
-
- Is the external information you're referencing still current?
|
|
43
|
-
|
|
44
|
-
**Rule: List key assumptions at the start. Verify each one. Record how it was verified.**
|
|
45
|
-
|
|
46
|
-
### 4a. Project state must be verified, not assumed
|
|
47
|
-
|
|
48
|
-
Project phases (frozen, submitted, taped-out, deployed, released), component statuses (working, broken, deprecated), and environment state (installed, configured, running) must be verified by reading actual files (status docs, CI output, lock files) or asking the user.
|
|
49
|
-
|
|
50
|
-
Examples of assumptions that need checking:
|
|
51
|
-
- "Since we already submitted X..." — did we? Check.
|
|
52
|
-
- "The design is frozen, so..." — is it? Read the status doc.
|
|
53
|
-
- "Dependencies are installed..." — are they? Run the check command.
|
|
54
|
-
|
|
55
|
-
**Rule: When about to act on a project state assumption, verify it first. Read the file that proves the state, or ask the user.**
|
|
56
|
-
|
|
57
|
-
### 5. External communications require human review
|
|
58
|
-
|
|
59
|
-
Anything sent under the user's name — issues, PR comments, emails, forum posts — carries the user's professional reputation. Accuracy matters.
|
|
60
|
-
|
|
61
|
-
**Rule: Only produce drafts, clearly marked as "pending review". The user decides when and whether to submit. Never submit externally on your own. In drafts, clearly separate: verified facts vs. assumptions vs. suggestions.**
|
|
62
|
-
|
|
63
|
-
### 6. Label uncertainty honestly
|
|
64
|
-
|
|
65
|
-
Match your confidence level to the strength of your evidence.
|
|
66
|
-
|
|
67
|
-
- Confirmed fact: state directly
|
|
68
|
-
- High-confidence inference: "Based on X, likely Y (not directly verified)"
|
|
69
|
-
- Uncertain: "Not sure, needs confirmation"
|
|
70
|
-
- Don't know: say so openly
|
|
71
|
-
|
|
72
|
-
**Honest uncertainty invites verification. False confidence wastes time and erodes trust.**
|
|
73
|
-
|
|
74
|
-
### 7. Correct errors immediately
|
|
75
|
-
|
|
76
|
-
When you discover wrong information in memory, docs, or prior output:
|
|
77
|
-
1. Correct it now, not "next time"
|
|
78
|
-
2. Note the correction and why, to prevent recurrence
|
|
79
|
-
3. If wrong information was already sent externally, alert the user
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Pre-action Checklist
|
|
84
|
-
|
|
85
|
-
Before any significant action, verify:
|
|
86
|
-
|
|
87
|
-
- [ ] Are my assumptions verified, or inferred from names/context?
|
|
88
|
-
- [ ] Are my "verified" claims actually backed by execution output?
|
|
89
|
-
- [ ] Am I quoting tool output verbatim, or have I altered it?
|
|
90
|
-
- [ ] Is the external information I'm referencing current?
|
|
91
|
-
- [ ] Does this content go external? Has the user reviewed it?
|
|
92
|
-
- [ ] Is there anything I wrote confidently but am actually unsure about?
|
|
1
|
+
---
|
|
2
|
+
globs: "**/*"
|
|
3
|
+
description: "Integrity discipline — verification, honesty, and protecting the user's credibility"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Integrity Discipline
|
|
7
|
+
|
|
8
|
+
These practices protect the user's credibility and the quality of our work together. They exist because past failures in these areas had real consequences.
|
|
9
|
+
|
|
10
|
+
### 1. Start with what you can control
|
|
11
|
+
|
|
12
|
+
When something fails, the natural instinct is to look outward: the library has a bug, the tool is broken, the docs are wrong. But most failures trace back to something within your control: an assumption not tested, docs not fully read, a verification step skipped.
|
|
13
|
+
|
|
14
|
+
**Rule: When something fails, exhaust internal causes first. Only consider external factors after ruling out your own assumptions and actions.**
|
|
15
|
+
|
|
16
|
+
### 2. Never claim "verified" without actually running it
|
|
17
|
+
|
|
18
|
+
Claiming something was tested without running it undermines all subsequent analysis — and the user's credibility if they rely on it.
|
|
19
|
+
|
|
20
|
+
- "Tests pass" requires actual test output showing pass
|
|
21
|
+
- "No errors" requires actual tool output showing zero errors
|
|
22
|
+
- "Removing X doesn't affect Y" requires actually removing X and observing Y
|
|
23
|
+
- Any conclusion without verification must be labeled "unverified" or "assumption"
|
|
24
|
+
|
|
25
|
+
**Rule: Every verification claim must have a corresponding actual execution. If you haven't run it, say so. Marking a task ✅ requires pasting the verification command and output summary.**
|
|
26
|
+
|
|
27
|
+
### 3. Never alter tool output
|
|
28
|
+
|
|
29
|
+
Error messages, test results, build logs, lint output — quote them exactly as-is. Do not:
|
|
30
|
+
- Rephrase error messages
|
|
31
|
+
- Add attribution not present in the original (e.g., "caused by library bug")
|
|
32
|
+
- Omit parts that are inconvenient
|
|
33
|
+
- Change meaning while "summarizing"
|
|
34
|
+
|
|
35
|
+
**Rule: When citing tool output, paste verbatim. Write your analysis separately and explicitly label it as your interpretation.**
|
|
36
|
+
|
|
37
|
+
### 4. Verify assumptions before acting
|
|
38
|
+
|
|
39
|
+
Before starting work, identify and verify:
|
|
40
|
+
- Does the target platform/environment actually support what you're assuming?
|
|
41
|
+
- Are the dependencies/libraries/APIs actually available?
|
|
42
|
+
- Is the external information you're referencing still current?
|
|
43
|
+
|
|
44
|
+
**Rule: List key assumptions at the start. Verify each one. Record how it was verified.**
|
|
45
|
+
|
|
46
|
+
### 4a. Project state must be verified, not assumed
|
|
47
|
+
|
|
48
|
+
Project phases (frozen, submitted, taped-out, deployed, released), component statuses (working, broken, deprecated), and environment state (installed, configured, running) must be verified by reading actual files (status docs, CI output, lock files) or asking the user.
|
|
49
|
+
|
|
50
|
+
Examples of assumptions that need checking:
|
|
51
|
+
- "Since we already submitted X..." — did we? Check.
|
|
52
|
+
- "The design is frozen, so..." — is it? Read the status doc.
|
|
53
|
+
- "Dependencies are installed..." — are they? Run the check command.
|
|
54
|
+
|
|
55
|
+
**Rule: When about to act on a project state assumption, verify it first. Read the file that proves the state, or ask the user.**
|
|
56
|
+
|
|
57
|
+
### 5. External communications require human review
|
|
58
|
+
|
|
59
|
+
Anything sent under the user's name — issues, PR comments, emails, forum posts — carries the user's professional reputation. Accuracy matters.
|
|
60
|
+
|
|
61
|
+
**Rule: Only produce drafts, clearly marked as "pending review". The user decides when and whether to submit. Never submit externally on your own. In drafts, clearly separate: verified facts vs. assumptions vs. suggestions.**
|
|
62
|
+
|
|
63
|
+
### 6. Label uncertainty honestly
|
|
64
|
+
|
|
65
|
+
Match your confidence level to the strength of your evidence.
|
|
66
|
+
|
|
67
|
+
- Confirmed fact: state directly
|
|
68
|
+
- High-confidence inference: "Based on X, likely Y (not directly verified)"
|
|
69
|
+
- Uncertain: "Not sure, needs confirmation"
|
|
70
|
+
- Don't know: say so openly
|
|
71
|
+
|
|
72
|
+
**Honest uncertainty invites verification. False confidence wastes time and erodes trust.**
|
|
73
|
+
|
|
74
|
+
### 7. Correct errors immediately
|
|
75
|
+
|
|
76
|
+
When you discover wrong information in memory, docs, or prior output:
|
|
77
|
+
1. Correct it now, not "next time"
|
|
78
|
+
2. Note the correction and why, to prevent recurrence
|
|
79
|
+
3. If wrong information was already sent externally, alert the user
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Pre-action Checklist
|
|
84
|
+
|
|
85
|
+
Before any significant action, verify:
|
|
86
|
+
|
|
87
|
+
- [ ] Are my assumptions verified, or inferred from names/context?
|
|
88
|
+
- [ ] Are my "verified" claims actually backed by execution output?
|
|
89
|
+
- [ ] Am I quoting tool output verbatim, or have I altered it?
|
|
90
|
+
- [ ] Is the external information I'm referencing current?
|
|
91
|
+
- [ ] Does this content go external? Has the user reviewed it?
|
|
92
|
+
- [ ] Is there anything I wrote confidently but am actually unsure about?
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
## Embedded Development Discipline
|
|
2
|
-
|
|
3
|
-
### Resource Awareness
|
|
4
|
-
- **Memory is limited** — Consider RAM/ROM budget for every allocation. Avoid malloc, prefer static allocation
|
|
5
|
-
- **Stack depth** — Be extremely cautious with recursion; no deep call chains in ISRs
|
|
6
|
-
- **Peripherals are shared resources** — Register access must consider concurrency and interrupt safety
|
|
7
|
-
- **Timing constraints** — Interrupt response, communication timeouts, watchdog feeding must not be blocked
|
|
8
|
-
|
|
9
|
-
### Mandatory Checks Before Modification
|
|
10
|
-
- Involves interrupt handling? → Confirm whether `volatile` is needed, confirm critical section protection
|
|
11
|
-
- Involves peripheral registers? → Confirm register addresses and bit fields against the datasheet
|
|
12
|
-
- Involves memory layout? → Confirm linker script and section assignments
|
|
13
|
-
- Involves communication protocol? → Confirm endianness, alignment, timeout handling
|
|
14
|
-
|
|
15
|
-
### Prohibited
|
|
16
|
-
- No blocking functions in ISRs (printf, malloc, mutex lock)
|
|
17
|
-
- No assuming `sizeof(int)` — use fixed-width types like `uint32_t` explicitly
|
|
18
|
-
- No modifying register configurations without understanding the hardware behavior
|
|
19
|
-
- No ignoring compiler warnings — in embedded, warnings are often potential hardware issues
|
|
20
|
-
|
|
21
|
-
### Debugging Notes
|
|
22
|
-
- The problem may be hardware-related (power, signal integrity, EMI) — don't only look in software
|
|
23
|
-
- Timing-related bugs may not reproduce reliably — record reproduction conditions and frequency
|
|
24
|
-
- Optimization levels affect behavior — confirm whether behavior is consistent between -O0 and -O2
|
|
1
|
+
## Embedded Development Discipline
|
|
2
|
+
|
|
3
|
+
### Resource Awareness
|
|
4
|
+
- **Memory is limited** — Consider RAM/ROM budget for every allocation. Avoid malloc, prefer static allocation
|
|
5
|
+
- **Stack depth** — Be extremely cautious with recursion; no deep call chains in ISRs
|
|
6
|
+
- **Peripherals are shared resources** — Register access must consider concurrency and interrupt safety
|
|
7
|
+
- **Timing constraints** — Interrupt response, communication timeouts, watchdog feeding must not be blocked
|
|
8
|
+
|
|
9
|
+
### Mandatory Checks Before Modification
|
|
10
|
+
- Involves interrupt handling? → Confirm whether `volatile` is needed, confirm critical section protection
|
|
11
|
+
- Involves peripheral registers? → Confirm register addresses and bit fields against the datasheet
|
|
12
|
+
- Involves memory layout? → Confirm linker script and section assignments
|
|
13
|
+
- Involves communication protocol? → Confirm endianness, alignment, timeout handling
|
|
14
|
+
|
|
15
|
+
### Prohibited
|
|
16
|
+
- No blocking functions in ISRs (printf, malloc, mutex lock)
|
|
17
|
+
- No assuming `sizeof(int)` — use fixed-width types like `uint32_t` explicitly
|
|
18
|
+
- No modifying register configurations without understanding the hardware behavior
|
|
19
|
+
- No ignoring compiler warnings — in embedded, warnings are often potential hardware issues
|
|
20
|
+
|
|
21
|
+
### Debugging Notes
|
|
22
|
+
- The problem may be hardware-related (power, signal integrity, EMI) — don't only look in software
|
|
23
|
+
- Timing-related bugs may not reproduce reliably — record reproduction conditions and frequency
|
|
24
|
+
- Optimization levels affect behavior — confirm whether behavior is consistent between -O0 and -O2
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
## JavaScript / TypeScript Discipline
|
|
2
|
-
|
|
3
|
-
### Type Safety
|
|
4
|
-
- TypeScript projects: don't use `any` to escape the type system — use `unknown` + type guard
|
|
5
|
-
- When modifying interfaces (interface/type), confirm all usage sites are adapted
|
|
6
|
-
- New code should prefer TypeScript strict mode
|
|
7
|
-
|
|
8
|
-
### Async Handling
|
|
9
|
-
- All async calls must have error handling (try/catch or .catch)
|
|
10
|
-
- Be intentional about Promise concurrency — `Promise.all` vs `Promise.allSettled` is a deliberate choice
|
|
11
|
-
- Avoid callback hell — if nesting exceeds 2 levels, refactor to async/await
|
|
12
|
-
|
|
13
|
-
### Frontend Specific
|
|
14
|
-
- Before modifying a component, confirm props interface and state management approach
|
|
15
|
-
- Don't directly manipulate the DOM (in React/Vue projects)
|
|
16
|
-
- Style changes must consider responsiveness and impact on other components
|
|
17
|
-
|
|
18
|
-
### Prohibited
|
|
19
|
-
- No `// @ts-ignore` unless accompanied by a detailed comment explaining why
|
|
20
|
-
- No modifying webpack/vite/next config without understanding the build configuration
|
|
21
|
-
- No introducing new global state without stating the justification
|
|
1
|
+
## JavaScript / TypeScript Discipline
|
|
2
|
+
|
|
3
|
+
### Type Safety
|
|
4
|
+
- TypeScript projects: don't use `any` to escape the type system — use `unknown` + type guard
|
|
5
|
+
- When modifying interfaces (interface/type), confirm all usage sites are adapted
|
|
6
|
+
- New code should prefer TypeScript strict mode
|
|
7
|
+
|
|
8
|
+
### Async Handling
|
|
9
|
+
- All async calls must have error handling (try/catch or .catch)
|
|
10
|
+
- Be intentional about Promise concurrency — `Promise.all` vs `Promise.allSettled` is a deliberate choice
|
|
11
|
+
- Avoid callback hell — if nesting exceeds 2 levels, refactor to async/await
|
|
12
|
+
|
|
13
|
+
### Frontend Specific
|
|
14
|
+
- Before modifying a component, confirm props interface and state management approach
|
|
15
|
+
- Don't directly manipulate the DOM (in React/Vue projects)
|
|
16
|
+
- Style changes must consider responsiveness and impact on other components
|
|
17
|
+
|
|
18
|
+
### Prohibited
|
|
19
|
+
- No `// @ts-ignore` unless accompanied by a detailed comment explaining why
|
|
20
|
+
- No modifying webpack/vite/next config without understanding the build configuration
|
|
21
|
+
- No introducing new global state without stating the justification
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
## Mobile Development Discipline
|
|
2
|
-
|
|
3
|
-
### Platform Awareness
|
|
4
|
-
- Before modifying, confirm whether the code is iOS only / Android only / cross-platform shared
|
|
5
|
-
- Check minimum version support for platform-specific API calls
|
|
6
|
-
- Permission requests (camera, location, notifications, etc.) must have corresponding usage descriptions
|
|
7
|
-
|
|
8
|
-
### Performance & UX
|
|
9
|
-
- UI operations must be on the main thread; long-running operations must be on background threads
|
|
10
|
-
- For list rendering, use proper reuse mechanisms (UITableView reuse / RecyclerView / ListView.builder)
|
|
11
|
-
- Memory-sensitive — image loading must consider caching and scaling strategy
|
|
12
|
-
|
|
13
|
-
### Prohibited
|
|
14
|
-
- No hardcoded strings — use localization mechanisms
|
|
15
|
-
- No ignoring app lifecycle — handle resource release and restoration during background/foreground transitions
|
|
16
|
-
- No modifying Info.plist / AndroidManifest.xml without confirmation
|
|
1
|
+
## Mobile Development Discipline
|
|
2
|
+
|
|
3
|
+
### Platform Awareness
|
|
4
|
+
- Before modifying, confirm whether the code is iOS only / Android only / cross-platform shared
|
|
5
|
+
- Check minimum version support for platform-specific API calls
|
|
6
|
+
- Permission requests (camera, location, notifications, etc.) must have corresponding usage descriptions
|
|
7
|
+
|
|
8
|
+
### Performance & UX
|
|
9
|
+
- UI operations must be on the main thread; long-running operations must be on background threads
|
|
10
|
+
- For list rendering, use proper reuse mechanisms (UITableView reuse / RecyclerView / ListView.builder)
|
|
11
|
+
- Memory-sensitive — image loading must consider caching and scaling strategy
|
|
12
|
+
|
|
13
|
+
### Prohibited
|
|
14
|
+
- No hardcoded strings — use localization mechanisms
|
|
15
|
+
- No ignoring app lifecycle — handle resource release and restoration during background/foreground transitions
|
|
16
|
+
- No modifying Info.plist / AndroidManifest.xml without confirmation
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
## Python Discipline
|
|
2
|
-
|
|
3
|
-
### Code Quality
|
|
4
|
-
- Run lint/type check after modifications (use whatever the project has configured: ruff, mypy, pyright, etc.)
|
|
5
|
-
- Type annotations: new code must have type hints; add them to old code when modifying it
|
|
6
|
-
- Import ordering follows project conventions (typically managed by isort or ruff)
|
|
7
|
-
|
|
8
|
-
### Dependency Management
|
|
9
|
-
- Ask before adding new dependencies — is it truly needed? Is there a stdlib alternative?
|
|
10
|
-
- Confirm dependency version constraints — don't leave versions unconstrained, and don't pin too tightly
|
|
11
|
-
|
|
12
|
-
### Testing
|
|
13
|
-
- Run related tests after modifying logic
|
|
14
|
-
- First confirm which test framework the project uses (pytest? unittest?) and the run command — don't assume
|
|
15
|
-
- When tests fail, don't change the test to make it pass — first determine if the test is outdated or the code has a bug
|
|
16
|
-
|
|
17
|
-
### Prohibited
|
|
18
|
-
- No bare `except:` or `except Exception:` swallowing all exceptions
|
|
19
|
-
- No rewriting an entire module without understanding the existing code
|
|
20
|
-
- No introducing `os.system()` — use `subprocess.run()` with proper error handling
|
|
1
|
+
## Python Discipline
|
|
2
|
+
|
|
3
|
+
### Code Quality
|
|
4
|
+
- Run lint/type check after modifications (use whatever the project has configured: ruff, mypy, pyright, etc.)
|
|
5
|
+
- Type annotations: new code must have type hints; add them to old code when modifying it
|
|
6
|
+
- Import ordering follows project conventions (typically managed by isort or ruff)
|
|
7
|
+
|
|
8
|
+
### Dependency Management
|
|
9
|
+
- Ask before adding new dependencies — is it truly needed? Is there a stdlib alternative?
|
|
10
|
+
- Confirm dependency version constraints — don't leave versions unconstrained, and don't pin too tightly
|
|
11
|
+
|
|
12
|
+
### Testing
|
|
13
|
+
- Run related tests after modifying logic
|
|
14
|
+
- First confirm which test framework the project uses (pytest? unittest?) and the run command — don't assume
|
|
15
|
+
- When tests fail, don't change the test to make it pass — first determine if the test is outdated or the code has a bug
|
|
16
|
+
|
|
17
|
+
### Prohibited
|
|
18
|
+
- No bare `except:` or `except Exception:` swallowing all exceptions
|
|
19
|
+
- No rewriting an entire module without understanding the existing code
|
|
20
|
+
- No introducing `os.system()` — use `subprocess.run()` with proper error handling
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
## RTL Discipline
|
|
2
|
-
|
|
3
|
-
### Hardware Mindset (not software mindset)
|
|
4
|
-
- **Every line of code is a circuit** — Before writing, think about what hardware structure it synthesizes to
|
|
5
|
-
- **Distinguish synthesis from simulation** — `initial`, `$display`, `#delay` are for testbench only, never in synthesizable code
|
|
6
|
-
- **Timing awareness** — When modifying any register logic, consider the impact on timing paths
|
|
7
|
-
- **Consistent reset strategy** — Don't mix synchronous/asynchronous reset in the same module without a clear reason
|
|
8
|
-
|
|
9
|
-
### Mandatory Checks Before Modification
|
|
10
|
-
- Confirm the fan-out of the signal being modified — Who is reading this signal?
|
|
11
|
-
- Confirm the clock domain — Is this a clock domain crossing (CDC)? Is a synchronizer needed?
|
|
12
|
-
- Confirm bit width — Do widths match? Are there implicit truncations or extensions?
|
|
13
|
-
- Confirm FSM states — When modifying a state machine, are all state transitions fully covered?
|
|
14
|
-
|
|
15
|
-
### Prohibited
|
|
16
|
-
- No latches in `always @(*)` unless explicitly intended with a comment
|
|
17
|
-
- No missing else / default branches in combinational logic
|
|
18
|
-
- No modifying interface signals (ports) without updating all instantiation sites
|
|
19
|
-
- No modifying critical path logic without understanding timing constraints
|
|
20
|
-
|
|
21
|
-
### Testbench Rules
|
|
22
|
-
- New features must have corresponding testbench cases
|
|
23
|
-
- After modifying RTL, run existing simulations before checking results
|
|
24
|
-
- Prefer assertions / checkers over visual waveform inspection
|
|
1
|
+
## RTL Discipline
|
|
2
|
+
|
|
3
|
+
### Hardware Mindset (not software mindset)
|
|
4
|
+
- **Every line of code is a circuit** — Before writing, think about what hardware structure it synthesizes to
|
|
5
|
+
- **Distinguish synthesis from simulation** — `initial`, `$display`, `#delay` are for testbench only, never in synthesizable code
|
|
6
|
+
- **Timing awareness** — When modifying any register logic, consider the impact on timing paths
|
|
7
|
+
- **Consistent reset strategy** — Don't mix synchronous/asynchronous reset in the same module without a clear reason
|
|
8
|
+
|
|
9
|
+
### Mandatory Checks Before Modification
|
|
10
|
+
- Confirm the fan-out of the signal being modified — Who is reading this signal?
|
|
11
|
+
- Confirm the clock domain — Is this a clock domain crossing (CDC)? Is a synchronizer needed?
|
|
12
|
+
- Confirm bit width — Do widths match? Are there implicit truncations or extensions?
|
|
13
|
+
- Confirm FSM states — When modifying a state machine, are all state transitions fully covered?
|
|
14
|
+
|
|
15
|
+
### Prohibited
|
|
16
|
+
- No latches in `always @(*)` unless explicitly intended with a comment
|
|
17
|
+
- No missing else / default branches in combinational logic
|
|
18
|
+
- No modifying interface signals (ports) without updating all instantiation sites
|
|
19
|
+
- No modifying critical path logic without understanding timing constraints
|
|
20
|
+
|
|
21
|
+
### Testbench Rules
|
|
22
|
+
- New features must have corresponding testbench cases
|
|
23
|
+
- After modifying RTL, run existing simulations before checking results
|
|
24
|
+
- Prefer assertions / checkers over visual waveform inspection
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hooks": {
|
|
3
|
-
"SessionStart": [
|
|
4
|
-
{
|
|
5
|
-
"matcher": "startup|resume|clear|compact",
|
|
6
|
-
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
"type": "command",
|
|
9
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh\""
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"PreToolUse": [
|
|
15
|
-
{
|
|
16
|
-
"matcher": "Edit|Write|MultiEdit",
|
|
17
|
-
"hooks": [
|
|
18
|
-
{
|
|
19
|
-
"type": "command",
|
|
20
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-edit-guard.sh\""
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"matcher": "Edit|Write|MultiEdit",
|
|
26
|
-
"hooks": [
|
|
27
|
-
{
|
|
28
|
-
"type": "command",
|
|
29
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/streak-breaker.sh\""
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"matcher": "Edit|Write|MultiEdit|Bash|Agent",
|
|
35
|
-
"hooks": [
|
|
36
|
-
{
|
|
37
|
-
"type": "command",
|
|
38
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/action-counter.sh\""
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"matcher": "Bash",
|
|
44
|
-
"hooks": [
|
|
45
|
-
{
|
|
46
|
-
"type": "command",
|
|
47
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/git-guard.sh\""
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"matcher": "ExitPlanMode",
|
|
53
|
-
"hooks": [
|
|
54
|
-
{
|
|
55
|
-
"type": "command",
|
|
56
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/phase-gate.sh\""
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"PostToolUse": [
|
|
62
|
-
{
|
|
63
|
-
"matcher": "Bash",
|
|
64
|
-
"hooks": [
|
|
65
|
-
{
|
|
66
|
-
"type": "command",
|
|
67
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/post-error-remind.sh\""
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"PostToolUseFailure": [
|
|
73
|
-
{
|
|
74
|
-
"matcher": "Bash",
|
|
75
|
-
"hooks": [
|
|
76
|
-
{
|
|
77
|
-
"type": "command",
|
|
78
|
-
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/post-error-remind.sh\""
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "startup|resume|clear|compact",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh\""
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"PreToolUse": [
|
|
15
|
+
{
|
|
16
|
+
"matcher": "Edit|Write|MultiEdit",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/pre-edit-guard.sh\""
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"matcher": "Edit|Write|MultiEdit",
|
|
26
|
+
"hooks": [
|
|
27
|
+
{
|
|
28
|
+
"type": "command",
|
|
29
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/streak-breaker.sh\""
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"matcher": "Edit|Write|MultiEdit|Bash|Agent",
|
|
35
|
+
"hooks": [
|
|
36
|
+
{
|
|
37
|
+
"type": "command",
|
|
38
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/action-counter.sh\""
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"matcher": "Bash",
|
|
44
|
+
"hooks": [
|
|
45
|
+
{
|
|
46
|
+
"type": "command",
|
|
47
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/git-guard.sh\""
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"matcher": "ExitPlanMode",
|
|
53
|
+
"hooks": [
|
|
54
|
+
{
|
|
55
|
+
"type": "command",
|
|
56
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/phase-gate.sh\""
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"PostToolUse": [
|
|
62
|
+
{
|
|
63
|
+
"matcher": "Bash",
|
|
64
|
+
"hooks": [
|
|
65
|
+
{
|
|
66
|
+
"type": "command",
|
|
67
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/post-error-remind.sh\""
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"PostToolUseFailure": [
|
|
73
|
+
{
|
|
74
|
+
"matcher": "Bash",
|
|
75
|
+
"hooks": [
|
|
76
|
+
{
|
|
77
|
+
"type": "command",
|
|
78
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/post-error-remind.sh\""
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
}
|