| name | ipynb-validator |
| description | Validate Jupyter notebooks (.ipynb files) for production readiness. Checks smart links consistency, layout structure, transition cells with action cards, numbered part flow, cell ordering, and overall quality. Use when validating notebooks, checking notebook structure, testing smart links, verifying action cards, or preparing notebooks for production deployment. Keywords include ipynb validation, notebook structure, smart links, action cards, transitions, part flow, production ready. |
Jupyter Notebook Validator
Purpose
Comprehensive validation of Jupyter notebooks (.ipynb files) to ensure production readiness. Validates smart links, layout structure, transitions, part flow, and overall quality standards.
When to Use This Skill
Use this skill when you need to:
- Validate a notebook before production deployment
- Check smart link consistency and resolution
- Verify layout structure and organization
- Ensure all transition cells have action cards β οΈ MOST COMMON ISSUE
- Validate numbered part/section flow
- Check cell ordering and completeness
- Assess overall notebook quality
- Prepare notebooks for client or end-user viewing
β οΈ Quick Check: Missing Action Cards
Before running full validation, manually verify:
- Find all transition cells (cells with "Part X:", Progress indicator, and π΅ dots)
- Check each has
<!-- action-cards -->marker - Verify 3-6 links follow the marker
- Ensure links use
(#)placeholder pattern
This single check catches 80% of validation failures.
Validation Categories
1. Smart Links Validation
What it checks:
- All smart links (
[text](#)) have matching headings - No broken links or orphaned references
- Link text matches heading text (case-insensitive, emoji-agnostic)
- Smart links resolve to valid cells
- Action card links are properly formatted
Expected pattern:
[Link Text](#) β Finds heading containing "Link Text"
Common issues:
- Link text doesn't match any heading
- Heading was renamed but link wasn't updated
- Typos in link text
- Missing target heading
2. Layout Structure
What it checks:
- Clear introduction section (hero, TOC, emergency nav)
- Numbered parts/sections in logical order
- Each part has consistent structure:
- Transition cell (optional but recommended)
- Part start cell with full title
- Content cells
- Part summary cell
- Conclusion section present
- No gaps or missing sections
Expected structure:
Introduction (Cells 0-N)
β Transition (optional)
β Part 1 (Start β Content β Summary)
β Transition
β Part 2 (Start β Content β Summary)
...
β Conclusion
3. Transition Cells β οΈ CRITICAL CHECK
What it checks:
- Transition cells exist between major parts
- Each transition MUST have
<!-- action-cards -->marker (REQUIRED) - Action cards have 3-6 links (enforced)
- Action cards link to upcoming content
- Transition text provides context
Expected pattern:
### Part X: Section Name
**Progress: X of Y** π΅π΅π΅βͺβͺβͺ
**Reading time: N minutes**
Contextual text explaining what's next...
<!-- action-cards -->
- [Topic 1](#)
- [Topic 2](#)
- [Topic 3](#)
β οΈ COMMON FAILURE: Missing Action Cards Marker
This is the #1 validation failure. Every transition cell between parts MUST include:
- The
<!-- action-cards -->HTML comment marker - A markdown list of 3-6 links immediately following
- Each link using the
(#)placeholder pattern
Validation will FAIL if:
- Transition cell lacks
<!-- action-cards -->marker - Fewer than 3 action card links
- Action cards not in proper markdown list format
When transitions are optional:
- Part flows naturally from previous summary
- First part (follows introduction)
- Conclusion section
4. Part Flow Validation
What it checks:
- Parts are numbered sequentially (1, 2, 3, ...)
- No missing or duplicate part numbers
- Part summaries come after part content
- Part titles follow consistent format
- Progress indicators are accurate
Expected title patterns:
### π Part 1: Topic Name
### π₯Part 2: By Your Role - Subtopic
### π―Part 3: By Your Task - Subtopic
Part structure requirements:
- First cell: Full title with part number
- Middle cells: Clean titles without part prefix
- Last cell: Summary with "You've Completed Part X"
5. Cell Ordering
What it checks:
- Cells are in logical sequence
- No content cells after summary
- Summaries appear at end of parts
- Transition cells precede part starts
- No orphaned or misplaced cells
- Reference/utility cells placed appropriately
- Part X completion immediately before Part X+1 transition
Common ordering issues:
- Summary before content is complete
- Transition after part start
- Content cells out of sequence
- Missing cells in expected flow
- Reference cells (Resources, Bookmarks, Next Steps) between parts
- Completion cells appearing before part content
- Technical detail cells orphaned outside their parent section
Example of correct flow:
Part 6 Completion Cell
β immediately adjacent
Part 7 Transition Cell (with action cards)
β
Part 7 Content Cells
β
Part 7 Completion Cell
β immediately adjacent
Part 8 Transition Cell
6. Action Cards Quality
What it checks:
<!-- action-cards -->marker present- Marker followed by markdown list
- 3-6 links per action card section
- Links use
(#)placeholder - Link text is descriptive and unique
- No duplicate action card sections in same cell
Quality criteria:
- Clear, actionable link text
- Links point to major sections
- Balanced number of options (not too few, not too many)
- Consistent formatting
7. Production Readiness
What it checks:
- Notebook metadata present (title, description, author, etc.)
- Repository URL configured (for .md links)
- No test or placeholder content
- All code cells are appropriate (if any)
- No broken formatting
- File size is reasonable
- JSON structure is valid
Metadata requirements:
{
"metadata": {
"title": "Notebook Title",
"description": "Brief description",
"author": "Author Name",
"date": "YYYY-MM-DD",
"version": "X.Y",
"repo": "https://github.com/user/repo"
}
}
Validation Workflow
Step 1: Load and Parse
- Read notebook JSON file
- Validate JSON structure
- Extract all cells
- Parse cell sources
- Identify headings and links
Step 2: Analyze Structure
- Identify introduction section
- Find all parts and their boundaries
- Locate transition cells
- Map cell relationships
- Verify overall organization
Step 3: Validate Links
- Extract all smart links
- Build heading index
- Match links to headings
- Report unresolved links
- Check action card links
Step 4: Check Transitions (CRITICAL)
This is the most important validation step for missing action cards.
Find all transition cells by pattern matching:
def is_transition_cell(source): return ( re.search(r'###.*Part \d+:', source) and 'Progress:' in source and 'π΅' in source and 'Reading time:' in source )Verify action card markers (REQUIRED):
has_action_cards = '<!-- action-cards -->' in source if not has_action_cards: issues.append({ 'severity': 'ERROR', 'cell': cell_idx, 'message': f'Part {part_num} transition missing action cards marker' })Count links per transition (must be 3-6):
links = re.findall(r'^\s*- \[([^\]]+)\]\(#\)', source, re.MULTILINE) if len(links) < 3: issues.append({'severity': 'ERROR', 'message': 'Too few action cards'}) elif len(links) > 6: issues.append({'severity': 'WARN', 'message': 'Too many action cards'})Validate link targets - ensure all action card links resolve
Check contextual text - verify transition has explanatory text before action cards
Step 5: Verify Part Flow
- Extract part numbers
- Check sequential order
- Verify part structure
- Validate summaries
- Check progress indicators
Step 6: Assess Quality
- Check metadata completeness
- Verify repository configuration
- Review cell ordering
- Assess content quality
- Generate quality score
Common Issues and Fixes
Issue 1: Broken Smart Links
Symptom: Link text doesn't match any heading
Fix:
# Before (broken)
[Getting Started](#) β No heading contains "Getting Started"
# After (fixed)
Heading: ### Getting Started Guide
Link: [Getting Started Guide](#)
Issue 2: Missing Transitions
Symptom: Part starts immediately after previous summary
Fix:
# Add transition cell with action cards
Contextual text...
<!-- action-cards -->
- [Topic 1](#)
- [Topic 2](#)
Issue 3: Incorrect Cell Order
Symptom: Summary appears before content, or reference cells between parts
Fix:
# Reorder cells in notebook JSON
# Example: Move completion cell from index 64 to index 72
cells = notebook['cells']
completion_cell = cells.pop(64) # Remove from wrong position
cells.insert(72, completion_cell) # Insert at correct position
Common scenarios:
- Completion cell before part content β Move to end of part
- Reference cells between parts β Move to end of notebook (before final wrap-up)
- Technical cells outside their section β Move into proper section
Issue 4: Missing Action Cards
Symptom: Transition cell has no <!-- action-cards --> marker
Critical Issue: This is one of the most common validation failures. Every transition cell between parts MUST have action cards to guide readers.
Detection Pattern:
# Identifies transition cells by:
# 1. Contains "Part X:" heading
# 2. Has progress indicator (Progress: X of Y)
# 3. Has progress dots (π΅π΅...)
# 4. Has reading time estimate
# Then checks for:
# - <!-- action-cards --> marker (REQUIRED)
# - 3-6 markdown links after marker
# - Links use (#) placeholder pattern
Fix:
# Before (FAILS validation):
### Part 7: Universal Patterns
**Progress: 7 of 8** π΅π΅π΅π΅π΅π΅π΅βͺ
**Reading time: 2 minutes**
These patterns work everywhere...
# After (PASSES validation):
### Part 7: Universal Patterns
**Progress: 7 of 8** π΅π΅π΅π΅π΅π΅π΅βͺ
**Reading time: 2 minutes**
These patterns work everywhere...
<!-- action-cards -->
- [Beyond EDS](#)
- [Universal Patterns](#)
- [Apply Anywhere](#)
Why this matters:
- Action cards provide visual navigation
- Helps readers preview upcoming content
- Maintains consistent user experience
- Critical for educational notebooks
Issue 5: Part Number Gaps
Symptom: Parts numbered 1, 2, 4 (missing 3)
Fix: Renumber parts sequentially or add missing part
Testing the Notebook
Manual Testing
- Open in VS Code with Jupyter extension
- Click through all smart links
- Verify action cards display correctly
- Check part flow and navigation
- Test in ipynb-viewer block
Automated Validation
Use the /validate-notebook command:
/validate-notebook notebook-name.ipynb
Output includes:
- Smart link validation results
- Structure analysis
- Transition checks
- Part flow verification
- Overall quality score
- Detailed issue report
Production Checklist
Before deploying to production:
- All smart links resolve correctly
- Structure is complete and logical
- Transitions have action cards
- Parts flow sequentially
- Cells are properly ordered
- Metadata is complete
- Repository URL is set
- No test/placeholder content
- Formatting is correct
- File size is reasonable
- Tested in ipynb-viewer
- Action cards display correctly
- Navigation works smoothly
- Content is final and approved
Quality Scoring
The validator assigns scores (0-100) in each category:
Smart Links (0-100):
- 100: All links resolve perfectly
- 75-99: Minor issues or warnings
- 50-74: Some broken links
- 0-49: Many broken links
Structure (0-100):
- 100: Perfect organization
- 75-99: Minor structural issues
- 50-74: Missing sections or gaps
- 0-49: Poor organization
Transitions (0-100):
- 100: All transitions present with action cards
- 75-99: Missing some action cards
- 50-74: Some transitions missing
- 0-49: Few or no transitions
Part Flow (0-100):
- 100: Perfect sequential flow
- 75-99: Minor numbering issues
- 50-74: Gaps or duplicates
- 0-49: Major flow problems
Overall (0-100):
- 90-100: Production ready
- 75-89: Minor fixes needed
- 60-74: Moderate issues
- 0-59: Major rework required
Best Practices
For Smart Links
β Use descriptive, unique link text β Keep link text consistent with headings β Test all links before deployment β Use emojis in headings (they're ignored in matching)
β Don't use generic link text like "Click here"
β Don't hardcode cell IDs like #cell-5
β Don't create circular link references
For Cell Ordering
β Validate cell order with structural checks:
# Check adjacency between key sections
part_completion_idx < part_transition_idx + 1 # Must be adjacent
part_transition_idx < next_part_start_idx # Proper sequence
β Place reference/utility cells strategically:
- Resources & Quick Reference β End of notebook
- Essential Bookmarks β End of notebook
- Troubleshooting β End of notebook
- "What's Next" β End of notebook
β Keep technical detail cells within their parent section:
- Code examples belong in "How This Works" section
- Implementation details stay with their topic
- Don't orphan detail cells between major parts
β Don't place utility cells between parts β Don't split sections with unrelated content β Don't place completion cells before content
For Transitions
β Provide contextual text explaining what's next β Include 3-6 action cards per transition β Link to major upcoming sections β Use consistent formatting
β Don't skip transitions between major parts β Don't have too many action cards (> 6) β Don't have too few action cards (< 3)
For Part Flow
β Number parts sequentially β Use consistent title format β Place summaries at end of parts β Keep part structure uniform
β Don't skip part numbers β Don't change title format mid-notebook β Don't place summaries before content
Related Files
.claude/commands/validate-notebook.md- Command implementationblocks/ipynb-viewer/README.md- Viewer documentationdocs/for-ai/explaining-educational-notebooks.md- Notebook creation guidedocs/for-ai/explaining-presentation-notebooks.md- Presentation notebooks
Validation Output Format
The validator produces a detailed report:
NOTEBOOK VALIDATION REPORT: notebook-name.ipynb
================================================================
SUMMARY:
Total Cells: 66
Smart Links: 51 (51 valid, 0 broken)
Parts: 7 (sequential)
Transitions: 6 (all with action cards)
Overall Score: 95/100 β
PRODUCTION READY
SMART LINKS: β
PASS
β All 51 smart links resolve correctly
β No broken or orphaned links
β Action card links validated
STRUCTURE: β
PASS
β Clear introduction section (8 cells)
β 7 parts with consistent structure
β Conclusion section present
β No gaps or missing sections
TRANSITIONS: β
PASS
β 6 transition cells with action cards
β Part 6 flows naturally (no transition needed)
β All action cards have 3-6 links
β Contextual text present
PART FLOW: β
PASS
β Parts numbered 1-7 sequentially
β No gaps or duplicates
β Summaries at end of each part
β Consistent title format
CELL ORDERING: β
PASS
β All cells in logical sequence
β Summaries after content
β Transitions before parts
β No orphaned cells
PRODUCTION READINESS: β
PASS
β Metadata complete
β Repository URL set
β No test content
β Valid JSON structure
β Appropriate file size
RECOMMENDATIONS:
β’ Notebook is ready for production deployment
β’ All validation checks passed
β’ Quality score: 95/100
Note: This validator is designed for educational and navigation notebooks. Testing notebooks (test.ipynb) may have different structure requirements and are validated separately.