Generates comprehensive R tutorials for specialized applications (health economics, qualitative research, signal processing, environmental epidemiology) with theory + practice workflow. Creates .rmd/.qmd files with domain background, professional methods, complete workflows, and result interpretation.
Generates comprehensive R tutorials for specialized applications including health economics (CEA/TreeAge), qualitative research (text mining), signal processing (wavelet/VMD), and environmental epidemiology (DLNM/WQS/BKMR). Produces complete .rmd/.qmd files with domain background, professional terminology, analysis frameworks, practice workflows, and domain-specific result interpretation.
This skill creates in-depth, domain-specific R tutorials following a structured "domain background → terminology → principles → practice → interpretation" workflow. It generates tutorial content with proper YAML frontmatter, cover images, navigation updates, and ensures all content is render-ready with Quarto.
**Use this skill when:**
1. **Identify the domain**: Ask user which specialized domain (health economics/qualitative/signal processing/epidemiology)
2. **Confirm topic specificity**: Get specific method/technique (e.g., "cost-effectiveness analysis with TreeAge", "DLNM for environmental health")
3. **Check existing structure**: Read `doc/references/content-structure.md` for tutorial template requirements
4. **Verify file numbering**: Check existing `doc/` directory to determine next sequential number
Create the `.rmd` or `.qmd` file following this mandatory structure:
**YAML Frontmatter Requirements:**
```yaml
---
title: "[Domain-Method] Tutorial Title in Chinese"
subtitle: "Subtitle explaining scope"
author: "Author Name"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_depth: 3
toc_float: true
number_sections: true
theme: flatly
highlight: tango
code_folding: show
---
```
**Content Structure (Minimum 300 lines):**
1. **领域背景 (Domain Background)** - 15-20% of content
- Why this method matters in the domain
- Real-world applications and use cases
- Key challenges addressed
2. **核心概念 (Core Concepts)** - 20-25% of content
- Technical terminology with Chinese-English pairs
- Plain language explanations
- Conceptual frameworks and diagrams
3. **方法原理 (Method Principles)** - 15-20% of content
- Mathematical/statistical foundations (LaTeX equations where appropriate)
- Assumptions and limitations
- When to use vs. alternatives
4. **实践流程 (Practice Workflow)** - 30-35% of content
- Step-by-step implementation with R code
- Data preparation and validation
- Complete working examples with sample data
- Code comments explaining each step
5. **结果解读 (Result Interpretation)** - 10-15% of content
- Domain-specific interpretation guidance (clinical significance, policy implications)
- Common pitfalls and misinterpretations
- Reporting standards (if applicable, e.g., CHEERS for CEA, STROBE for epidemiology)
**Content Ratio:** 70% explanatory text, 30% R code
**Terminology Rules:**
1. **Cover Image** - REQUIRED
- Generate SVG: `doc/images/[number]-[topic]-cover.svg`
- Must visually represent the domain/method
- Use professional color schemes appropriate to domain
2. **Conceptual Diagrams** - Generate as needed
- For complex logic, frameworks, or concepts not easily shown in code
- Save as: `doc/images/diagrams/stat-[descriptive-name].svg` or `.png`
- Reference in markdown: ``
- Examples: mind maps, flowcharts, conceptual frameworks
Before proceeding, test that the tutorial renders without errors:
```bash
quarto render doc/[number]-[topic].rmd
```
**If rendering fails:** Fix all errors before continuing. Common issues:
You MUST update all navigation files or the tutorial won't appear on the website:
#### 5.1 Update `doc/_quarto.yml`
Find the `sidebar` → `contents` → `特殊应用` (Special Applications) section and add:
```yaml
- text: "Your Tutorial Title"
href: "[number]-[topic].rmd"
```
**IMPORTANT:** Maintain exact indentation (use spaces, not tabs)
#### 5.2 Update `doc/0001-guide.rmd`
Add entry to the appropriate category table:
```markdown
| [Method Name] | [Tutorial Title]([number]-[topic].html) | [Brief description] |
```
#### 5.3 Run Auto-Generation Script (MANDATORY)
This updates section index pages based on `_quarto.yml`:
```bash
workdir="doc" Rscript doc/generate_sections.R
```
This will update `doc/sections/special.qmd` and other category index pages.
#### 5.4 Update `README.md`
Add link in the `🧭 内容导航` → `🛠️ 特殊应用` section:
```markdown
```
1. **Render affected pages:**
```bash
quarto render doc/sections/special.qmd
quarto render doc/index.qmd
```
2. **Stage and commit all files:**
```bash
git add doc/[number]-[topic].rmd
git add doc/images/[number]-[topic]-cover.svg
git add doc/images/diagrams/stat-*.svg # if created
git add doc/_quarto.yml doc/0001-guide.rmd README.md doc/sections/special.qmd
git commit -m "feat(spc): Add [Domain-Method] specialized tutorial"
```
Before considering the task complete, verify:
Always consult these reference files in the repository:
**Health Economics (CEA/TreeAge):**
**Qualitative Research (Text Mining):**
**Signal Processing (Wavelet/VMD):**
**Environmental Epidemiology (DLNM/WQS/BKMR):**
**User Request:** "Create a tutorial on cost-effectiveness analysis using TreeAge in R"
**Agent Response:**
1. Confirm: "I'll create a health economics tutorial on CEA with TreeAge. This will be file `doc/XXXX-cea-treeage.rmd`. Should I include both deterministic and probabilistic sensitivity analysis?"
2. Generate full tutorial with domain background on health technology assessment
3. Create cover image showing decision tree concept
4. Validate rendering
5. Update all navigation files
6. Commit with message: `feat(spc): Add cost-effectiveness analysis TreeAge tutorial`
1. **Insufficient depth** - Don't create surface-level tutorials. These must be comprehensive (300+ lines).
2. **Missing navigation updates** - File exists but doesn't appear on website because `_quarto.yml` wasn't updated.
3. **Skipping render validation** - Committing broken RMarkdown that won't compile.
4. **Generic explanations** - Must use domain-specific language and interpretation frameworks.
5. **Missing cover image** - Every tutorial requires a cover SVG.
6. **Forgetting `generate_sections.R`** - Section index pages remain stale.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/r-specialized-domain-tutorial-generator/raw