Refactor documentation structure into modular files
Extracted strict typing standards and response protocol into separate files in .claude-docs/ directory for better maintainability and reduced duplication. CLAUDE.md now serves as a lightweight index with references to detailed documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
13c963575d
commit
b476c2aa1f
41
.claude-docs/strict-typing.md
Normal file
41
.claude-docs/strict-typing.md
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Strict Typing - NO EXCEPTIONS
|
||||||
|
|
||||||
|
**Claude must ALWAYS use explicit types in ALL code. The use of `any` type is FORBIDDEN.**
|
||||||
|
|
||||||
|
## Rules:
|
||||||
|
1. **Every variable must have an explicit type annotation**
|
||||||
|
2. **Every function parameter must be typed**
|
||||||
|
3. **Every function return value must be typed**
|
||||||
|
4. **Never use `any`, `dynamic` (in Dart), or equivalent loose types**
|
||||||
|
5. **Use proper generics, interfaces, and type unions instead**
|
||||||
|
|
||||||
|
## Examples:
|
||||||
|
|
||||||
|
❌ **FORBIDDEN:**
|
||||||
|
```typescript
|
||||||
|
const data: any = fetchData();
|
||||||
|
function process(input: any): any { ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
```dart
|
||||||
|
dynamic value = getValue();
|
||||||
|
void handleData(var data) { ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
✅ **REQUIRED:**
|
||||||
|
```typescript
|
||||||
|
const data: UserData = fetchData();
|
||||||
|
function process(input: UserInput): ProcessedOutput { ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
```dart
|
||||||
|
UserData value = getValue();
|
||||||
|
void handleData(RequestData data) { ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
**This rule applies to:**
|
||||||
|
- TypeScript/JavaScript
|
||||||
|
- Dart/Flutter
|
||||||
|
- Python (use type hints)
|
||||||
|
- All statically-typed languages
|
||||||
|
- Even when interfacing with external APIs - create proper type definitions
|
||||||
134
claude.md
134
claude.md
@ -2,138 +2,10 @@
|
|||||||
|
|
||||||
## Strict Typing - NO EXCEPTIONS
|
## Strict Typing - NO EXCEPTIONS
|
||||||
|
|
||||||
**Claude must ALWAYS use explicit types in ALL code. The use of `any` type is FORBIDDEN.**
|
See [.claude-docs/strict-typing.md](.claude-docs/strict-typing.md) for complete typing requirements.
|
||||||
|
|
||||||
### Rules:
|
|
||||||
1. **Every variable must have an explicit type annotation**
|
|
||||||
2. **Every function parameter must be typed**
|
|
||||||
3. **Every function return value must be typed**
|
|
||||||
4. **Never use `any`, `dynamic` (in Dart), or equivalent loose types**
|
|
||||||
5. **Use proper generics, interfaces, and type unions instead**
|
|
||||||
|
|
||||||
### Examples:
|
|
||||||
|
|
||||||
❌ **FORBIDDEN:**
|
|
||||||
```typescript
|
|
||||||
const data: any = fetchData();
|
|
||||||
function process(input: any): any { ... }
|
|
||||||
```
|
|
||||||
|
|
||||||
```dart
|
|
||||||
dynamic value = getValue();
|
|
||||||
void handleData(var data) { ... }
|
|
||||||
```
|
|
||||||
|
|
||||||
✅ **REQUIRED:**
|
|
||||||
```typescript
|
|
||||||
const data: UserData = fetchData();
|
|
||||||
function process(input: UserInput): ProcessedOutput { ... }
|
|
||||||
```
|
|
||||||
|
|
||||||
```dart
|
|
||||||
UserData value = getValue();
|
|
||||||
void handleData(RequestData data) { ... }
|
|
||||||
```
|
|
||||||
|
|
||||||
**This rule applies to:**
|
|
||||||
- TypeScript/JavaScript
|
|
||||||
- Dart/Flutter
|
|
||||||
- Python (use type hints)
|
|
||||||
- All statically-typed languages
|
|
||||||
- Even when interfacing with external APIs - create proper type definitions
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🗣️ Response Protocol — Defined Answer Types
|
## 🗣️ Response Protocol
|
||||||
|
|
||||||
Claude must **always** end responses with exactly one of these two structured formats:
|
See [.claude-docs/response-protocol.md](.claude-docs/response-protocol.md) for complete protocol details.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **Answer Type 1: Binary Choice**
|
|
||||||
Used for: simple confirmations, proceed/cancel actions, file operations.
|
|
||||||
|
|
||||||
**Format:**
|
|
||||||
|
|
||||||
(Y) Yes — [brief action summary]
|
|
||||||
|
|
||||||
(N) No — [brief alternative/reason]
|
|
||||||
|
|
||||||
(+) I don't understand — ask for clarification
|
|
||||||
|
|
||||||
|
|
||||||
**When user selects `(+)`:**
|
|
||||||
Claude responds:
|
|
||||||
> "What part would you like me to explain?"
|
|
||||||
Then teaches the concept step‑by‑step in plain language.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### **Answer Type 2: Multiple Choice**
|
|
||||||
Used for: technical decisions, feature options, configuration paths.
|
|
||||||
|
|
||||||
**Format:**
|
|
||||||
|
|
||||||
(A) Option A — [minimalist description]
|
|
||||||
|
|
||||||
(B) Option B — [minimalist description]
|
|
||||||
|
|
||||||
(C) Option C — [minimalist description]
|
|
||||||
|
|
||||||
(D) Option D — [minimalist description]
|
|
||||||
|
|
||||||
(+) I don't understand — ask for clarification
|
|
||||||
|
|
||||||
|
|
||||||
**When user selects `(+)`:**
|
|
||||||
Claude responds:
|
|
||||||
> "Which option would you like explained, or should I clarify what we're deciding here?"
|
|
||||||
Then provides context on the decision + explains each option's purpose.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### ⚠️ Mandatory Rules
|
|
||||||
1. **No text after the last option** — choices must be the final content.
|
|
||||||
2. Every option description ≤8 words.
|
|
||||||
3. The `(+)` option is **always present** in both formats.
|
|
||||||
4. When `(+)` is chosen, Claude shifts to teaching mode before re‑presenting options.
|
|
||||||
5. Claude must include `(always read claude.md to keep context between interactions)` before every option set.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Example 1 (Binary)
|
|
||||||
|
|
||||||
We need to initialize npm in your project folder.
|
|
||||||
|
|
||||||
(always read claude.md to keep context between interactions)
|
|
||||||
|
|
||||||
(Y) Yes — run npm init -y now
|
|
||||||
|
|
||||||
(N) No — show me what this does first
|
|
||||||
|
|
||||||
(+) I don't understand — explain npm initialization
|
|
||||||
|
|
||||||
|
|
||||||
### Example 2 (Multiple Choice)
|
|
||||||
|
|
||||||
Choose your testing framework:
|
|
||||||
|
|
||||||
(always read claude.md to keep context between interactions)
|
|
||||||
|
|
||||||
(A) Jest — popular, feature-rich
|
|
||||||
|
|
||||||
(B) Vitest — faster, Vite-native
|
|
||||||
|
|
||||||
(C) Node test runner — built-in, minimal
|
|
||||||
|
|
||||||
(D) Skip tests — add later
|
|
||||||
|
|
||||||
(+) I don't understand — explain testing frameworks
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**This protocol ensures:**
|
|
||||||
- You always have an escape hatch to learn.
|
|
||||||
- Claude never assumes your technical knowledge.
|
|
||||||
- Every interaction has clear, actionable paths.
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user