Skip to content

Commit 320e9cb

Browse files
committed
docs: Update docs for claude
1 parent ffec444 commit 320e9cb

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,63 @@ References are resolved at different stages:
204204
- **Semantic**: All references resolved to actual objects
205205
- **Execution**: Executors work with resolved objects only
206206

207+
## Critical Constraints
208+
209+
### Semantic Model Generation
210+
211+
⚠️ **NEVER manually edit `qtype/semantic/model.py`**
212+
213+
The semantic model is **auto-generated** from DSL models using:
214+
```bash
215+
uv run qtype generate semantic-model
216+
```
217+
218+
**Why this matters:**
219+
- `semantic/model.py` must stay in sync with `dsl/model.py`
220+
- Manual edits will break `test_generate_semantic_model_matches_existing`
221+
- Changes to semantic models should be made in DSL first, then regenerated
222+
223+
**If you need to add new semantic models:**
224+
1. Add the model to `qtype/dsl/model.py` first
225+
2. Run `uv run qtype generate semantic-model` to regenerate
226+
3. Verify with `uv run pytest tests/semantic/test_semantic_generator.py`
227+
228+
**Exception:** Simple immutable wrappers and helper classes can be added manually, but discriminated union types and core models MUST be auto-generated.
229+
230+
### Span Injection and Tracing
231+
232+
When adding tracing/observability features:
233+
234+
**Prefer abstraction over direct modification:**
235+
- Add span creation and metadata injection at the appropriate abstraction level
236+
- For output-level spans, consider using the base executor pattern rather than modifying `flow.py` directly
237+
- Think about where the feature belongs architecturally, not just what file is easiest to modify
238+
239+
**Best practices:**
240+
- Create child spans for logical units of work
241+
- Inject metadata (span_id, trace_id) into FlowMessage.metadata
242+
- Set span attributes that are useful for debugging
243+
- Handle cases where telemetry is not configured
244+
245+
### Testing Requirements
246+
247+
When implementing new features:
248+
249+
**Always run the full test suite before considering a feature "done":**
250+
```bash
251+
uv run pytest # Run ALL tests, not just the ones you created
252+
```
253+
254+
**Pay special attention to:**
255+
- Integration tests that verify end-to-end behavior
256+
- Tests that validate architectural patterns, not just functionality
257+
258+
**Test coverage should include:**
259+
- Unit tests for new models and functions
260+
- Integration tests for cross-layer functionality
261+
- Negative tests for error conditions
262+
- Mock-based tests for external integrations (Phoenix, LLM APIs, etc.)
263+
207264
## Python Code Guidelines
208265

209266
All Python code in this repository must follow strict guidelines defined in `.github/copilot-instructions.md`:

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ See the [full docs](https://bazaarvoice.github.io/qtype/) for more examples and
7878
## ✨ Developing with AI?
7979

8080
Use the QType MCP server to speed yourself up! Just set your assistant to run `qtype mcp`.
81+
8182
For VSCode, just add the following to `.vscode/mcp.json`:
8283

8384
```json
@@ -93,6 +94,11 @@ For VSCode, just add the following to `.vscode/mcp.json`:
9394
}
9495
```
9596

97+
For Claude Code:
98+
```
99+
claude mcp add qtype -- qtype mcp --transport stdio"
100+
```
101+
96102
97103
## 🤝 Contributing
98104

docs/How To/Language Features/use_qtype_mcp.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ The QType MCP server provides these capabilities to AI assistants:
3434
- **visualize_qtype_architecture**: Generate Mermaid diagrams from QType apps
3535

3636

37+
## Claude Code Configuration
38+
39+
```bash
40+
claude mcp add qtype -- qtype mcp --transport stdio"
41+
```
42+
43+
3744
## VS Code Configuration
3845
3946
Add the QType MCP server to your workspace's `.vscode/mcp.json`:

0 commit comments

Comments
 (0)