Generate professional lab reports for university courses, scientific research, engineering tests, and medical/material experiments. Supports three input modes (topic/raw data/draft improvement), auto-research with WebSearch, data tables & chart generation, error analysis, and output as docx/markdown. Use when writing experiment reports, lab reports, test reports, or any structured scientific/technical document. Triggers: lab report, experiment report, test report, experimental report, write r...
Scanned 9/6/2026
Install to Claude Code
npx -y skills add dxkjuanjuan/lab-report-writer --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Lab Report Writer?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/dxkjuanjuan-lab-report-writer)More formats (shields.io, HTML) on the badges page.
---
name: "Lab Report Writer"
description: "Generate professional lab reports for university courses, scientific research, engineering tests, and medical/material experiments. Supports three input modes (topic/raw data/draft improvement), auto-research with WebSearch, data tables & chart generation, error analysis, and output as docx/markdown. Use when writing experiment reports, lab reports, test reports, or any structured scientific/technical document. Triggers: lab report, experiment report, test report, experimental report, write report, generate report."
---
# Lab Report Writer
Generate professional, low-plagiarism lab reports with proper structure, data analysis, and references.
## What This Skill Does
1. **Three input modes**: From topic/description → full report; From raw data → analysis + report; From draft → improvement & formatting
2. **Covers all report types**: University course labs, scientific research, engineering tests, medical/material experiments
3. **Auto-research**: WebSearch for theoretical background, related work, and real citable references
4. **Data processing**: Tables, charts (line/scatter/bar with error bars), uncertainty propagation, least-squares fitting
5. **Low plagiarism**: Original writing throughout, proper paraphrasing, no copy-paste
6. **Multiple output formats**: docx (with tables/charts/formulas) or markdown, user's choice
## Prerequisites
- Node.js 18+ (for docx generation via npm `docx` package)
- If docx output: `docx` npm package must be available (`npm list -g docx` or project-local)
- For charts: Python 3 with matplotlib, OR use ASCII/markdown tables as fallback
---
## Level 2: Quick Start
### Interactive Launch
When the user mentions writing a lab report, experiment report, or test report, start the interactive flow:
```
/lab-report
```
The skill will ask clarifying questions via AskUserQuestion before generating anything.
---
## Level 3: Detailed Instructions
### Step 1: Interactive Questionnaire
Use AskUserQuestion to collect the following information. Ask in 1-2 rounds (max 4 questions per round).
#### Round 1 — Core Parameters
| Question | Header | Options | Notes |
|----------|--------|---------|-------|
| Report type? | 报告类型 | 高校课程实验, 科研实验报告, 工程测试报告, 医学/材料实验 | Multi-select OK |
| Input mode? | 输入模式 | 从题目/描述生成, 从实验数据生成, 从草稿改进 | Determines workflow |
| Output format? | 输出格式 | Word文档(docx), Markdown(md), 同时输出docx+md | User picks |
| Target word count? | 字数要求 | 2000-5000字, 5000-8000字, 8000-15000字, 不限 | Guides depth |
#### Round 2 — Content Details (adapt based on Round 1 answers)
| Question | Header | When to Ask |
|----------|--------|-------------|
| What is the experiment topic/title? | 实验题目 | Input mode = topic |
| What course/subject is this for? | 课程/学科 | University course type |
| Do you have raw data files? (provide paths) | 数据文件 | Input mode = data |
| Do you have a draft file? (provide path) | 草稿文件 | Input mode = draft |
| What sections do you need? | 报告章节 | If non-standard structure needed |
| Any specific formatting requirements? | 格式要求 | If user mentions rubric/grading criteria |
### Step 2: Load Grading Criteria (If Provided)
If the user provides a grading rubric file path (e.g., `成绩评定表.docx`):
1. Read the file using `textutil -convert txt -stdout` (macOS) or Python
2. Extract scoring dimensions and weights
3. Align the report structure and content depth to maximize score on each dimension
4. Store extracted criteria in memory for self-check at the end
### Step 3: Research Phase
Execute WebSearch queries to gather:
1. **Theoretical background**: Core principles, equations, mechanisms
2. **Related work**: Key papers, review articles, textbook references
3. **Reference literature**: Real, verifiable sources with complete bibliographic info
Search strategy:
- Start broad: `"[topic] 实验原理 综述"` or `"[topic] experiment principle review"`
- Then specific: `"[topic] 数据处理 误差分析"` or `"[topic] data analysis uncertainty"`
- For references: `"[author] [key term]" IEEE/Sensors/Review` to find specific papers
- Run 10-20 searches for thorough coverage; 5-8 for shorter reports
**Critical**: Record every search result that yields a usable reference. Do NOT fabricate references.
### Step 4: Section Template Selection
Based on report type, select the appropriate section template from [Section Templates](#section-templates) below.
### Step 5: Data Processing (If Applicable)
If the user provides experimental data:
1. **Read data**: CSV via `Read`, Excel via Python, or JSON directly
2. **Generate tables**: Format as markdown tables in the report; for docx, use Table objects
3. **Compute statistics**: Mean, standard deviation, relative error
4. **Uncertainty propagation**: Apply formula Δy = √(Σ(∂y/∂xi · Δxi)²)
5. **Curve fitting**: Linear least-squares y = ax + b with R², or polynomial if needed
6. **Charts**: Generate using matplotlib (save as PNG) or describe as ASCII for markdown
For data processing code, use Python via Bash:
```python
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# ... analysis code ...
```
### Step 6: Write the Report
Write section by section, following these principles:
#### Low-Plagiarism Writing Rules
1. **Original phrasing**: Never copy sentences from sources. Read, understand, rephrase in your own words.
2. **Structure variation**: Don't follow the exact paragraph structure of any single source.
3. **Specific details**: Include concrete numbers, formulas, and technical terms — generic text is more likely to match existing content.
4. **Personal analysis**: The "discussion/analysis" section should reflect independent reasoning, not paraphrased conclusions.
5. **Chinese-English mixing**: For Chinese reports, mixing technical terms in English (with Chinese explanation) naturally lowers similarity scores.
#### Section Writing Order
Recommended order for efficiency:
1. Write the body sections first (principle, procedure, data, analysis)
2. Then introduction and conclusion (these frame the body)
3. Then abstract (summarizes everything)
4. Finally compile references
### Step 7: Format and Generate Output
#### For docx output:
Use Node.js with the `docx` npm package. Generate using a script:
```javascript
const docx = require("docx");
const { Document, Packer, Paragraph, TextRun, AlignmentType, Table, ... } = docx;
// Build document with proper formatting
// Font: SimSun (宋体) body, SimHei (黑体) headings, KaiTi (楷体) abstract
// Line spacing: 1.5x (360 twips)
// Margins: 2.54cm top/bottom, 3.17cm left/right
// First-line indent: 2 characters (~480 twips)
```
Find the `docx` module path:
```bash
# Check global install
npm list -g docx 2>/dev/null
# Use NODE_PATH when running
NODE_PATH=$(npm root -g) node generate-report.js
```
#### For markdown output:
Write directly with `Write` tool. Include:
- YAML frontmatter with title, author, date
- Proper heading hierarchy
- Markdown tables for data
- Math notation with `$...$` or `$$...$$`
- Image references for charts
### Step 8: Self-Check Against Grading Criteria
If grading criteria were loaded, verify:
| Dimension | Self-Check |
|-----------|------------|
| Format & language | Correct font, spacing, margins? No typos? |
| Abstract quality | Covers all sections? Concise and readable? |
| Introduction depth | Sufficient background research? Clear motivation? |
| Logic & evidence | Arguments supported by data? Smooth transitions? |
| Conclusion validity | Follows from analysis? No overclaims? |
| Personal insight | Unique observations? Own perspective? |
### Step 9: Deliver
1. Save output file to the user's specified location (default: `~/Desktop/`)
2. Report word count (Chinese characters + English terms)
3. List any manual edits needed (e.g., author name, school info)
4. Clean up temporary files (generation scripts, intermediate data)
---
## Section Templates
### Template A: University Course Lab Report
| # | Section | Content | Font Style |
|---|---------|---------|------------|
| - | Title | Experiment name + descriptive subtitle | SimHei, 小二号, bold, centered |
| - | Author info | Name, student ID, department | KaiTi, 小四号, centered |
| 1 | Abstract | 150-300 words summarizing purpose, method, results, conclusion | KaiTi, 小四号 |
| 2 | Introduction | Background, motivation, objectives | SimSun, 小四号 |
| 3 | Theoretical Principles | Core theory, equations (numbered), diagrams | SimSun, 小四号 |
| 4 | Apparatus & Materials | Equipment list with model/specs, materials | SimSun, 小四号 |
| 5 | Experimental Procedure | Step-by-step, parameter settings, precautions | SimSun, 小四号 |
| 6 | Data & Results | Raw data tables, processed results, charts | SimSun, 小四号 |
| 7 | Analysis & Discussion | Error analysis, comparison with theory, uncertainty | SimSun, 小四号 |
| 8 | Conclusion | Summary of findings, answers to objectives | SimSun, 小四号 |
| 9 | Reflections | Personal insights, suggestions for improvement | SimSun, 小四号 |
| - | References | GB/T 7714 format, [1][2]... numbered | SimSun, 五号 |
### Template B: Scientific Research Report
| # | Section | Content |
|---|---------|---------|
| - | Title | Descriptive, concise |
| - | Authors & Affiliations | Name, institution, email |
| 1 | Abstract | Background, method, key results, significance |
| 2 | Introduction | Literature review, gap identification, research questions |
| 3 | Materials & Methods | Detailed methodology, reproducibility focus |
| 4 | Results | Data presentation, statistical analysis, figures |
| 5 | Discussion | Interpretation, limitations, comparison with literature |
| 6 | Conclusion | Key findings, implications, future directions |
| - | Acknowledgments | Funding, assistance |
| - | References | GB/T 7714 or APA format |
### Template C: Engineering Test Report
| # | Section | Content |
|---|---------|---------|
| - | Title | Test item + test type |
| - | Test Info | Date, location, personnel, equipment |
| 1 | Test Objective | Purpose, acceptance criteria |
| 2 | Test Method | Standard followed, procedure, parameters |
| 3 | Test Environment | Conditions, instrumentation, calibration |
| 4 | Test Data | Raw measurements, calculated results |
| 5 | Data Analysis | Statistical treatment, comparison with spec |
| 6 | Conclusions | Pass/fail, compliance assessment |
| - | Appendices | Raw data, calibration certificates |
### Template D: Medical/Material Experiment Report
| # | Section | Content |
|---|---------|---------|
| 1 | Abstract | Structured: background, methods, results, conclusion |
| 2 | Introduction | Clinical/scientific context, research gap |
| 3 | Materials | Sample prep, reagents, instruments |
| 4 | Methods | Experimental protocol, controls, ethical approval |
| 5 | Results | Quantitative data, statistical tests, figures |
| 6 | Discussion | Clinical/scientific significance, limitations |
| 7 | Conclusion | Key findings, translational implications |
---
## Reference Format Guide (GB/T 7714)
### Journal Article
```
[1] Author1, Author2, Author3. Title[J]. Journal Name, Year, Volume(Issue): Pages.
```
Example:
```
[1] Smith C S. Piezoresistance effect in germanium and silicon[J]. Physical Review, 1954, 94(1): 42-49.
```
### Book/Monograph
```
[2] Author. Title[M]. Edition. Place: Publisher, Year: Pages.
```
### Conference Paper
```
[3] Author1, Author2. Title[C]//Conference Name. Place: Publisher, Year: Pages.
```
### Technical Report
```
[4] Author/Organization. Title[R]. Place: Institution, Year.
```
### Online Resource
```
[5] Author. Title[EB/OL]. (Date)[Cite Date]. URL.
```
### Data Sheet / Standard
```
[6] Organization. Title[Z]. Place: Organization, Year.
```
---
## Error Analysis Formulas
### Direct Measurement Uncertainty
**Type A (statistical)**:
$$u_A = \sqrt{\frac{\sum_{i=1}^{n}(x_i - \bar{x})^2}{n(n-1)}}$$
**Type B (instrument)**:
$$u_B = \frac{\Delta_{instr}}{\sqrt{3}}$$ (uniform distribution)
**Combined standard uncertainty**:
$$u_c = \sqrt{u_A^2 + u_B^2}$$
**Expanded uncertainty** (k=2 for 95% confidence):
$$U = k \cdot u_c = 2u_c$$
### Indirect Measurement (Propagation)
If $y = f(x_1, x_2, ..., x_n)$:
$$u_c(y) = \sqrt{\sum_{i=1}^{n}\left(\frac{\partial f}{\partial x_i}\right)^2 u_c^2(x_i)}$$
### Linear Least-Squares Fit
For $y = ax + b$:
$$a = \frac{n\sum x_iy_i - \sum x_i\sum y_i}{n\sum x_i^2 - (\sum x_i)^2}$$
$$b = \frac{\sum y_i - a\sum x_i}{n}$$
$$R^2 = \frac{(n\sum x_iy_i - \sum x_i\sum y_i)^2}{[n\sum x_i^2 - (\sum x_i)^2][n\sum y_i^2 - (\sum y_i)^2]}$$
### Relative Error
$$\delta = \frac{|x_{measured} - x_{true}|}{x_{true}} \times 100\%$$
---
## Chart Generation Guidelines
### Using Python + matplotlib
```python
import matplotlib
matplotlib.use('Agg') # Non-interactive backend
import matplotlib.pyplot as plt
import numpy as np
# Configure for Chinese labels
plt.rcParams['font.sans-serif'] = ['Arial Unicode MS', 'SimHei', 'Heiti TC']
plt.rcParams['axes.unicode_minus'] = False
# Example: Line chart with error bars
fig, ax = plt.subplots(figsize=(8, 5))
x = np.array([1, 2, 3, 4, 5])
y = np.array([2.1, 3.8, 6.2, 7.9, 10.1])
y_err = np.array([0.2, 0.3, 0.2, 0.4, 0.3])
ax.errorbar(x, y, yerr=y_err, fmt='o-', capsize=4, label='Measured')
ax.set_xlabel('Independent Variable')
ax.set_ylabel('Dependent Variable')
ax.set_title('Experiment Results')
ax.legend()
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('chart.png', dpi=200)
print("Chart saved: chart.png")
```
### Chart Types by Data
| Data Type | Chart Type | matplotlib Function |
|-----------|-----------|-------------------|
| Single variable vs parameter | Line chart | `plot()` + `errorbar()` |
| Two variables correlation | Scatter plot | `scatter()` |
| Categorical comparison | Bar chart | `bar()` |
| Distribution | Histogram | `hist()` |
| Time series | Line chart | `plot()` |
---
## Troubleshooting
### Issue: docx npm module not found
**Solution**: Find the global install path and set NODE_PATH:
```bash
npm list -g docx # Find install location
NODE_PATH=$(npm root -g) node generate-report.js
```
### Issue: Chinese fonts not rendering in docx
**Solution**: Use standard font names: SimSun (宋体), SimHei (黑体), KaiTi (楷体). On macOS, these may render as fallback — the document will display correctly on Windows with Office.
### Issue: matplotlib Chinese characters show as boxes
**Solution**: Add font configuration:
```python
plt.rcParams['font.sans-serif'] = ['Arial Unicode MS', 'SimHei', 'Heiti TC']
```
### Issue: WebSearch returns no results
**Solution**: Try English queries, simplify terms, search for specific author+keyword combinations. Fall back to general knowledge if needed (mark references as "[待核实]").
### Issue: Data file format not recognized
**Solution**: For Excel (.xlsx), use Python with openpyxl or pandas. For .csv, use Read tool directly.
---
## Related Skills
- **kimi-webbridge**: For web research when WebSearch is disabled or insufficient
- **ui-styling**: For chart styling and visual design
- **design**: For report cover page or presentation-quality figures
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!