Source: https://github.com/aipoch/medical-research-skills
Figure Legend Generator
Generate publication-quality figure legends for scientific research charts and images.
Quick Check
Use this command to verify that the packaged script entry point can be parsed before deeper execution.
python -m py_compile scripts/main.py
Audit-Ready Commands
Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
python -m py_compile scripts/main.py
python scripts/main.py --help
python scripts/main.py -h
python scripts/main.py --help
When to Use
- Use this skill when the task is to Generate standardized figure legends for scientific charts and graphs.
- Use this skill for academic writing tasks that require explicit assumptions, bounded scope, and a reproducible output format.
- Use this skill when you need a documented fallback path for missing inputs, execution errors, or partial evidence.
Workflow
- Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.
- Validate that the request matches the documented scope and stop early if the task would require unsupported assumptions.
- Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
- Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
- If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
Supported Chart Types
| Chart Type |
Description |
| Bar Chart |
Compare values across categories |
| Line Graph |
Show trends over time or continuous data |
| Scatter Plot |
Display relationships between variables |
| Box Plot |
Show distribution and outliers |
| Heatmap |
Display matrix data intensity |
| Microscopy |
Fluorescence/confocal images |
| Flow Cytometry |
FACS plots and histograms |
| Western Blot |
Protein expression bands |
Usage
python scripts/main.py --input <image_path> --type <chart_type> [--output <output_path>]
Parameters
| Parameter |
Required |
Description |
--input |
Yes |
Path to chart image |
--type |
Yes |
Chart type (bar/line/scatter/box/heatmap/microscopy/flow/western) |
--output |
No |
Output path for legend text (default: stdout) |
--format |
No |
Output format (text/markdown/latex), default: markdown |
--language |
No |
Language (en/zh), default: en |
Examples
# Generate legend for bar chart
python scripts/main.py --input figure1.png --type bar
# Save to file
python scripts/main.py --input plot.jpg --type line --output legend.md
# Chinese output
python scripts/main.py --image.png --type scatter --language zh
Legend Structure
Generated legends follow academic standards:
- Figure Number - Sequential numbering
- Brief Title - Concise description
- Main Description - What the figure shows
- Data Details - Key statistics/measurements
- Methodology - Brief experimental context
- Statistics - P-values, significance markers
- Scale Bars - For microscopy images
Technical Notes
- Difficulty: Low
- Dependencies: PIL, pytesseract (optional OCR)
- Processing: Vision analysis for chart type detection
- Output: Structured markdown by default
References
references/legend_templates.md - Templates by chart type
references/academic_style_guide.md - Formatting guidelines
Risk Assessment
| Risk Indicator |
Assessment |
Level |
| Code Execution |
Python scripts with tools |
High |
| Network Access |
External API calls |
High |
| File System Access |
Read/write data |
Medium |
| Instruction Tampering |
Standard prompt guidelines |
Low |
| Data Exposure |
Data handled securely |
Medium |
Security Checklist
Prerequisites
# Python dependencies
pip install -r requirements.txt
Evaluation Criteria
Success Metrics
Test Cases
- Basic Functionality: Standard input → Expected output
- Edge Case: Invalid input → Graceful error handling
- Performance: Large dataset → Acceptable processing time
Lifecycle Status
- Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues: None
- Planned Improvements:
- Performance optimization
- Additional feature support
Output Requirements
Every final response should make these items explicit when they are relevant:
- Objective or requested deliverable
- Inputs used and assumptions introduced
- Workflow or decision path
- Core result, recommendation, or artifact
- Constraints, risks, caveats, or validation needs
- Unresolved items and next-step checks
Error Handling
- If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.py fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback.
- Do not fabricate files, citations, data, search results, or execution outcomes.
Input Validation
This skill accepts requests that match the documented purpose of figure-legend-gen and include enough context to complete the workflow safely.
Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
figure-legend-gen only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
Response Template
Use the following fixed structure for non-trivial requests:
- Objective
- Inputs Received
- Assumptions
- Workflow
- Deliverable
- Risks and Limits
- Next Checks
If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.
When Not to Use
- Do not proceed when required input files, identifiers, parameters, or context are missing — ask the user to provide them first.
- Do not assume capabilities beyond this skill's declared scope when the user requests external operations or inferences.
- Do not proceed without user confirmation when overwriting existing results, executing high-cost batch operations, or expanding task scope.
Required Inputs
| Field |
Required |
Format/Source |
Example |
If Missing |
| User task description |
Yes |
Text |
Research question, writing goal, analysis objective |
Stop and ask user to provide |
| Primary input material |
Depends on task |
Text, file path, ID, table, or literature |
PMID, PDF, CSV, DOCX, keywords, etc. |
Specify which material type is missing |
| Output preference |
No |
Text |
Language, format, target journal, template |
Use skill default format |
Output Contract
- Primary output: Structured result or target file aligned with this skill's objective.
- Optional output: Intermediate check notes, issue list, supplementary suggestions, or generated file paths.
- Format requirement: Unless the user specifies otherwise, prefer stable, reviewable Markdown or JSON; if the skill's bundled script requires a fixed format, use that format.
- If partially complete: Must explicitly mark as PARTIAL and state which steps are completed and which remain.
Failure Handling
- Missing critical input: Explicitly state which fields, files, or identifiers are missing and pause.
- Script, template, or resource execution failure: Report the failing step, likely cause, and recovery suggestions — do not silently degrade.
- Partial completion only: Return the verified portion first, then list remaining blockers and suggested next steps.
User Checkpoints
- Before executing batch processing, overwriting files, long-running searches, or multi-stage generation, confirm scope and output format with the user.
- Before proceeding when a key judgment is ambiguous, evidence is insufficient, or the workflow is entering the next stage, confirm with the user.
Quick Validation
- Check that key scripts, templates, or reference file paths this skill depends on exist.
- Check that the final output contains the core fields, sections, or files specified for this task.
- Check that results clearly mark assumptions, limitations, and incomplete items.
1---2name: figure-legend-gen3description: Generate standardized figure legends for scientific figures and charts; use when preparing publication-ready legends that summarize design, variables, sample size, and key statistical notes.4license: MIT5---6> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)
7
8# Figure Legend Generator
9
10Generate publication-quality figure legends for scientific research charts and images.
11
12## Quick Check
13
14Use this command to verify that the packaged script entry point can be parsed before deeper execution.
15
16```bash
17python -m py_compile scripts/main.py
18```
19
20## Audit-Ready Commands
21
22Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
23
24```bash
25python -m py_compile scripts/main.py
26python scripts/main.py --help
27python scripts/main.py -h
28python scripts/main.py --help
29```
30
31## When to Use
32
33- Use this skill when the task is to Generate standardized figure legends for scientific charts and graphs.
34- Use this skill for academic writing tasks that require explicit assumptions, bounded scope, and a reproducible output format.
35- Use this skill when you need a documented fallback path for missing inputs, execution errors, or partial evidence.
36
37## Workflow
38
391. Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.
402. Validate that the request matches the documented scope and stop early if the task would require unsupported assumptions.
413. Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
424. Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
435. If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
44
45## Supported Chart Types
46
47| Chart Type | Description |
48|------------|-------------|
49| Bar Chart | Compare values across categories |
50| Line Graph | Show trends over time or continuous data |
51| Scatter Plot | Display relationships between variables |
52| Box Plot | Show distribution and outliers |
53| Heatmap | Display matrix data intensity |
54| Microscopy | Fluorescence/confocal images |
55| Flow Cytometry | FACS plots and histograms |
56| Western Blot | Protein expression bands |
57
58## Usage
59
60```text
61python scripts/main.py --input <image_path> --type <chart_type> [--output <output_path>]
62```
63
64### Parameters
65
66| Parameter | Required | Description |
67|-----------|----------|-------------|
68| `--input` | Yes | Path to chart image |
69| `--type` | Yes | Chart type (bar/line/scatter/box/heatmap/microscopy/flow/western) |
70| `--output` | No | Output path for legend text (default: stdout) |
71| `--format` | No | Output format (text/markdown/latex), default: markdown |
72| `--language` | No | Language (en/zh), default: en |
73
74### Examples
75
76```text
77# Generate legend for bar chart
78python scripts/main.py --input figure1.png --type bar
79
80# Save to file
81python scripts/main.py --input plot.jpg --type line --output legend.md
82
83# Chinese output
84python scripts/main.py --image.png --type scatter --language zh
85```
86
87## Legend Structure
88
89Generated legends follow academic standards:
90
911. **Figure Number** - Sequential numbering
922. **Brief Title** - Concise description
933. **Main Description** - What the figure shows
944. **Data Details** - Key statistics/measurements
955. **Methodology** - Brief experimental context
966. **Statistics** - P-values, significance markers
977. **Scale Bars** - For microscopy images
98
99## Technical Notes
100
101- **Difficulty**: Low
102- **Dependencies**: PIL, pytesseract (optional OCR)
103- **Processing**: Vision analysis for chart type detection
104- **Output**: Structured markdown by default
105
106## References
107
108- `references/legend_templates.md` - Templates by chart type
109- `references/academic_style_guide.md` - Formatting guidelines
110
111## Risk Assessment
112
113| Risk Indicator | Assessment | Level |
114|----------------|------------|-------|
115| Code Execution | Python scripts with tools | High |
116| Network Access | External API calls | High |
117| File System Access | Read/write data | Medium |
118| Instruction Tampering | Standard prompt guidelines | Low |
119| Data Exposure | Data handled securely | Medium |
120
121## Security Checklist
122
123- [ ] No hardcoded credentials or API keys
124- [ ] No unauthorized file system access (../)
125- [ ] Output does not expose sensitive information
126- [ ] Prompt injection protections in place
127- [ ] API requests use HTTPS only
128- [ ] Input validated against allowed patterns
129- [ ] API timeout and retry mechanisms implemented
130- [ ] Output directory restricted to workspace
131- [ ] Script execution in sandboxed environment
132- [ ] Error messages sanitized (no internal paths exposed)
133- [ ] Dependencies audited
134- [ ] No exposure of internal service architecture
135
136## Prerequisites
137
138```text
139# Python dependencies
140pip install -r requirements.txt
141```
142
143## Evaluation Criteria
144
145### Success Metrics
146- [ ] Successfully executes main functionality
147- [ ] Output meets quality standards
148- [ ] Handles edge cases gracefully
149- [ ] Performance is acceptable
150
151### Test Cases
1521. **Basic Functionality**: Standard input → Expected output
1532. **Edge Case**: Invalid input → Graceful error handling
1543. **Performance**: Large dataset → Acceptable processing time
155
156## Lifecycle Status
157
158- **Current Stage**: Draft
159- **Next Review Date**: 2026-03-06
160- **Known Issues**: None
161- **Planned Improvements**:
162 - Performance optimization
163 - Additional feature support
164
165## Output Requirements
166
167Every final response should make these items explicit when they are relevant:
168
169- Objective or requested deliverable
170- Inputs used and assumptions introduced
171- Workflow or decision path
172- Core result, recommendation, or artifact
173- Constraints, risks, caveats, or validation needs
174- Unresolved items and next-step checks
175
176## Error Handling
177
178- If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
179- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
180- If `scripts/main.py` fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback.
181- Do not fabricate files, citations, data, search results, or execution outcomes.
182
183## Input Validation
184
185This skill accepts requests that match the documented purpose of `figure-legend-gen` and include enough context to complete the workflow safely.
186
187Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
188
189> `figure-legend-gen` only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
190
191## Response Template
192
193Use the following fixed structure for non-trivial requests:
194
1951. Objective
1962. Inputs Received
1973. Assumptions
1984. Workflow
1995. Deliverable
2006. Risks and Limits
2017. Next Checks
202
203If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.
204
205## When Not to Use
206
207- Do not proceed when required input files, identifiers, parameters, or context are missing — ask the user to provide them first.
208- Do not assume capabilities beyond this skill's declared scope when the user requests external operations or inferences.
209- Do not proceed without user confirmation when overwriting existing results, executing high-cost batch operations, or expanding task scope.
210
211## Required Inputs
212
213| Field | Required | Format/Source | Example | If Missing |
214|---|---|---|---|---|
215| User task description | Yes | Text | Research question, writing goal, analysis objective | Stop and ask user to provide |
216| Primary input material | Depends on task | Text, file path, ID, table, or literature | PMID, PDF, CSV, DOCX, keywords, etc. | Specify which material type is missing |
217| Output preference | No | Text | Language, format, target journal, template | Use skill default format |
218
219## Output Contract
220
221- Primary output: Structured result or target file aligned with this skill's objective.
222- Optional output: Intermediate check notes, issue list, supplementary suggestions, or generated file paths.
223- Format requirement: Unless the user specifies otherwise, prefer stable, reviewable Markdown or JSON; if the skill's bundled script requires a fixed format, use that format.
224- If partially complete: Must explicitly mark as PARTIAL and state which steps are completed and which remain.
225
226## Failure Handling
227
228- Missing critical input: Explicitly state which fields, files, or identifiers are missing and pause.
229- Script, template, or resource execution failure: Report the failing step, likely cause, and recovery suggestions — do not silently degrade.
230- Partial completion only: Return the verified portion first, then list remaining blockers and suggested next steps.
231
232## User Checkpoints
233
234- Before executing batch processing, overwriting files, long-running searches, or multi-stage generation, confirm scope and output format with the user.
235- Before proceeding when a key judgment is ambiguous, evidence is insufficient, or the workflow is entering the next stage, confirm with the user.
236
237## Quick Validation
238
239- Check that key scripts, templates, or reference file paths this skill depends on exist.
240- Check that the final output contains the core fields, sections, or files specified for this task.
241- Check that results clearly mark assumptions, limitations, and incomplete items.