| 365 | } |
| 366 | |
| 367 | function getBestPracticesPrompt(): GetPromptResult { |
| 368 | return { |
| 369 | description: 'Best practices for Deepnote notebooks', |
| 370 | messages: [ |
| 371 | { |
| 372 | role: 'user', |
| 373 | content: { |
| 374 | type: 'text', |
| 375 | text: `# Deepnote Notebook Best Practices |
| 376 | |
| 377 | ## Structure |
| 378 | - Start with a title (text-cell-h1) and introduction (markdown) |
| 379 | - Organize into sections with headers (text-cell-h2) |
| 380 | - Add markdown explanations before complex code blocks |
| 381 | - End with conclusions or next steps |
| 382 | |
| 383 | ## Interactivity |
| 384 | - Convert hardcoded values to input blocks: |
| 385 | - File paths → input-text |
| 386 | - Thresholds/parameters → input-slider |
| 387 | - Categories → input-select |
| 388 | - Toggles → input-checkbox |
| 389 | - Use meaningful variable names and labels |
| 390 | |
| 391 | ## Code Quality |
| 392 | - Keep code blocks focused on one task |
| 393 | - Use df.head() or display() to show dataframes |
| 394 | - Add error handling for file loading |
| 395 | - Import all dependencies at the start |
| 396 | |
| 397 | ## Documentation |
| 398 | - Explain the "why" not just the "what" |
| 399 | - Document expected input formats |
| 400 | - Note any external dependencies |
| 401 | - Add callouts for important warnings |
| 402 | |
| 403 | ## Tools Workflow |
| 404 | |
| 405 | **For new notebooks:** |
| 406 | 1. ${TOOL_NAMES.create} → Creates project and initial notebook |
| 407 | 2. ${TOOL_NAMES.addBlock} → Adds content and interactivity incrementally |
| 408 | 3. ${TOOL_NAMES.run} → Validates the notebook end-to-end |
| 409 | |
| 410 | **For existing notebooks:** |
| 411 | 1. ${TOOL_NAMES.read} include=["lint","dag"] → Find issues |
| 412 | 2. ${TOOL_NAMES.cat} + ${TOOL_NAMES.editBlock} → Inspect and fix blocks |
| 413 | 3. ${TOOL_NAMES.run} + ${TOOL_NAMES.snapshotLoad} → Verify behavior |
| 414 | |
| 415 | **For analysis:** |
| 416 | 1. ${TOOL_NAMES.read} include=["structure","stats"] → See structure |
| 417 | 2. ${TOOL_NAMES.read} include=["dag"] → View dependencies |
| 418 | 3. ${TOOL_NAMES.snapshotLoad} → Inspect outputs from previous runs`, |
| 419 | }, |
| 420 | }, |
| 421 | ], |
| 422 | } |
| 423 | } |