zensical-development
Best practices for developing zensical/Material for MkDocs static sites. Covers installation, virtual environments, project structure, responsive images, CSS, media embedding, and verification. Use for ANY Material for MkDocs project development beyond basic text editing.
What this skill does
# Zensical Development Best Practices
Comprehensive workflow and best practices for developing zensical (Material for MkDocs) static sites with proper setup, responsive design, image handling, and media embedding.
## CRITICAL: Always Use Zensical, Never MkDocs Directly
**NEVER use `mkdocs serve` or `mkdocs build` commands directly.**
Always use the zensical CLI:
- `zensical serve` (NOT `mkdocs serve`)
- `zensical build` (NOT `mkdocs build`)
## Project Setup & Requirements
### Installation & Virtual Environment
**CRITICAL:** Every Zensical project MUST have a Python virtual environment (`.venv`).
```bash
# Create virtual environment
python3 -m venv .venv
# Activate virtual environment
source .venv/bin/activate # macOS/Linux
# Install zensical
pip install zensical
```
### .gitignore Requirements
**MANDATORY entries:**
```gitignore
# Python virtual environment
.venv/
venv/
# Zensical build output
site/
# Cache directories
.cache/
# System files
.DS_Store
```
### Creating a New Project
```bash
# Bootstrap new project
zensical new .
# This creates:
# - .github/ directory
# - docs/ folder with index.md
# - zensical.toml configuration file
```
## Development Workflow
### Step 1: Make Changes
**Text-only changes** (no visual verification needed):
- Fixing typos, updating content
**Visual changes** (REQUIRES visual verification):
- Adding/modifying CSS
- Adding/moving images
- Embedding videos
- Changing layouts
### Step 2: Deploy Locally
```bash
source .venv/bin/activate
zensical serve
# Site runs at http://localhost:8000
```
**Server Restart Required For:**
- CSS file changes
- Configuration changes (`zensical.toml`)
- JavaScript file changes
### Step 3: Verification (MANDATORY for visual changes)
```python
# Navigate to page
mcp__chrome-devtools__navigate_page(url="http://127.0.0.1:8000/page/")
# Take screenshot
mcp__chrome-devtools__take_screenshot()
# Verify image dimensions
mcp__chrome-devtools__evaluate_script(function="""
() => {
const images = document.querySelectorAll('img');
return Array.from(images).map(img => ({
src: img.src.split('/').pop(),
maxWidth: window.getComputedStyle(img).maxWidth,
displayWidth: img.offsetWidth
}));
}
""")
```
## Best Practices
### Responsive Images
```css
img {
display: block;
margin: 0 auto;
max-width: 100%;
height: auto;
}
```
### YouTube Videos
```html
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin: 20px 0;">
<iframe
src="https://www.youtube.com/embed/VIDEO_ID"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
frameborder="0"
allowfullscreen>
</iframe>
</div>
```
## Common Issues & Fixes
### Images Cropped/Cut Off
Remove `max-height` from global `img` selector:
```css
img {
max-width: 100%;
height: auto;
}
```
### Images Not Loading (404)
Check path relative to markdown file location.
### Horizontal Overflow on Mobile
Use `max-width: 100%` and test at 375px.
## Project Structure
```
project-root/
├── .venv/ # Virtual environment (in .gitignore)
├── docs/ # Content directory
│ ├── index.md
│ ├── stylesheets/
│ │ └── extra.css
│ └── img/
├── zensical.toml # Configuration
├── .gitignore
└── site/ # Built output (in .gitignore)
```
## Common Commands
```bash
# Setup
python3 -m venv .venv
source .venv/bin/activate
pip install zensical
zensical new .
# Development
zensical serve
# Building
zensical build
zensical build --strict
```
## Summary
1. Every Zensical project MUST have `.venv/`
2. `.gitignore` MUST include: `.venv/`, `site/`, `.cache/`
3. Always activate venv before running zensical commands
4. Visual verification is MANDATORY for CSS/HTML/image changes
5. CSS changes require server restart
6. Images use `max-width: 100%; height: auto;`
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.