description: Creates concise, structured scientific documents with LaTeX equations, integrated figures, and clear technical writing. Use when documenting results, writing research summaries, or creating technical reports. name: scientific-writing priority: high
Scientific Writing
Creates publication-quality markdown documents with mathematical rigor and visual clarity.
Core Principles
- •Concision: Every sentence must earn its place
- •Structure: Logical flow with clear hierarchies
- •Precision: Technical accuracy over verbosity
- •Integration: Seamlessly embed figures and equations
- •Clarity: Complex ideas expressed simply
Document Structure
Standard Template
# [Descriptive Title] ## Summary [2-3 sentences: what was done, key finding, significance] ## Methods [Essential details only - enough to reproduce] ## Results [Observations → Data → Interpretation] ### [Subsection 1] [Finding with supporting figure/equation] ### [Subsection 2] [Finding with supporting figure/equation] ## Discussion [Implications, limitations, future directions - 1 paragraph max]
Section Guidelines
Summary (3-5 lines)
- •First sentence: what you investigated
- •Second sentence: how you investigated it
- •Third sentence: what you found
- •NO background or motivation
Methods (minimal)
- •Only non-standard procedures
- •Reference standard protocols by name
- •Use lists for clarity
Results (core content)
- •Lead with observation, follow with data
- •One finding per subsection
- •Figure/equation immediately after relevant text
- •NO speculation (save for Discussion)
Discussion (1 paragraph)
- •Interpret in broader context
- •State limitations explicitly
- •Suggest next steps
Writing Style Rules
Concision Tactics
Before (wordy):
The results that we obtained from the experiment clearly demonstrate that there is a significant increase in the fluorescence intensity.
After (concise):
Fluorescence intensity increased 3.2-fold (p < 0.001).
Common eliminations:
- •❌ "It is important to note that..."
- •❌ "The results clearly demonstrate..."
- •❌ "As can be seen from the figure..."
- •❌ "In order to..." → ✅ "To..."
- •❌ "Due to the fact that..." → ✅ "Because..."
Active Voice
- •✅ "We measured force using AFM"
- •❌ "Force was measured using AFM"
- •✅ "Cells exhibited biphasic dynamics"
- •❌ "Biphasic dynamics were exhibited by cells"
Precision
Vague: "The protein concentration was high" Precise: "Protein concentration was 2.5 mg/mL"
Vague: "Cells responded quickly" Precise: "Cells responded within 30 s"
LaTeX Equations
Inline Math
Use $...$ for inline equations:
The diffusion coefficient $D = 0.43 \pm 0.05 \, \mu\text{m}^2/\text{s}$ indicates...
Display Math
Use $$ with \begin{} and \end{} for block equations:
The force balance is described by:
$$
\begin{equation}
F_{\text{total}} = F_{\text{spring}} + F_{\text{drag}} = kx + \gamma \frac{dx}{dt}
\end{equation}
$$
where $k$ is the spring constant and $\gamma$ is the drag coefficient.
Equation Environments
Common environments:
- •
equation- Single numbered equation - •
align- Multiple aligned equations - •
split- Split long equations across lines
Examples:
$$
\begin{align}
\sigma_{xx} &= E \epsilon_{xx} \\
\sigma_{yy} &= E \epsilon_{yy}
\end{align}
$$
Equation Style
Good practices:
- •Define all variables immediately after equation
- •Use
\text{}for words in equations: $F_{\text{max}}$ - •Use proper spacing:
\,for thin space (units) - •Use
equationenvironment for automatic numbering
Example:
The relationship between stress $\sigma$ and strain $\epsilon$ follows:
$$
\begin{equation}
\sigma = E \epsilon
\end{equation}
$$
where $E = 5 \pm 0.3$ kPa is the Young's modulus.
Figure Integration
Workflow
- •Generate figure during analysis (follow python-coding-standards)
- •Save as SVG in
figures/folder - •Reference immediately after relevant text
- •Caption format: statement of finding, not description
Figure Template
Force increased linearly with deformation up to 20% strain, then plateaued (Figure 1).  **Figure 1.** Linear stress-strain response transitions to plateau regime at ε > 0.2.
Caption Guidelines
Bad (descriptive):
Figure 1. A plot showing force on the y-axis and deformation on the x-axis.
Good (interpretive):
Figure 1. Force increases linearly with deformation until strain exceeds 0.2.
Best (finding):
Figure 1. Biphasic mechanical response reveals strain-stiffening at ε > 0.2.
Multiple Panels
For multi-panel figures:
 **Figure 2.** Cell morphology changes with substrate stiffness. **(A)** Representative images on soft (1 kPa), medium (10 kPa), and stiff (100 kPa) substrates. **(B)** Quantification shows area increases 2.5-fold from soft to stiff. **(C)** Aspect ratio decreases with stiffness (p < 0.001, n = 150 cells per condition).
Data Presentation
Tables (use sparingly)
Only when comparing multiple conditions across multiple metrics:
| Condition | Spring Constant (pN/nm) | Relaxation Time (s) | n | |-----------|------------------------|---------------------|---| | Control | 12.3 ± 1.2 | 45 ± 8 | 23 | | Drug A | 8.7 ± 0.9* | 67 ± 12* | 21 | | Drug B | 15.1 ± 1.8 | 38 ± 6 | 19 | *p < 0.05 vs. control
Table caption: Place above table, descriptive
Inline Data
For single comparisons, embed in text:
Treatment increased velocity from 0.23 ± 0.03 to 0.41 ± 0.05 μm/s (p < 0.001, n = 45).
Common Patterns
Introducing Analysis
Pattern: Goal → Approach → Key result
To determine whether force depends on loading rate, we performed constant-velocity indentation at speeds from 0.1 to 10 μm/s. Peak force scaled linearly with velocity (Figure 3A), consistent with viscoelastic behavior.
Quantitative Results
Pattern: Observation → Measurement → Statistics
Cells on stiff substrates adopted elongated morphologies. Aspect ratio increased from 1.8 ± 0.2 (soft) to 3.4 ± 0.4 (stiff), a 1.9-fold change (p < 0.001, n = 120 cells, Figure 2B).
Model Validation
Pattern: Model → Prediction → Test → Result
If force transmission is primarily via focal adhesions, disrupting integrin binding should reduce traction forces. We treated cells with RGD peptide and measured a 73% reduction in traction stress (Figure 4), confirming integrin-mediated adhesion.
Checklist
Before finalizing document:
- • Summary states finding in 3 sentences
- • No sentence exceeds 25 words
- • All equations defined immediately after appearance
- • Figures referenced in text before appearing
- • Figure captions state findings, not descriptions
- • NO phrases: "clearly", "obviously", "it is important to note"
- • NO repetition between sections
- • Methods include only non-standard details
- • Discussion is ≤ 1 paragraph
- • All data includes uncertainty and sample size
- • Active voice used throughout
Quick Reference
Numbers and Units
- •Use ± for uncertainty:
5.2 ± 0.3 kPa - •Thin space before units:
10 \, \mu\text{m} - •Scientific notation for extremes: $3.2 \times 10^{-6}$
- •Significant figures match precision
Common Abbreviations
First use: full term (abbreviation)
Atomic force microscopy (AFM) measurements revealed...
Subsequent: abbreviation only
AFM images showed...
References
Inline citation:
Previous studies^[1,2]^ demonstrated...
End of document:
## References 1. Smith et al. (2023) Nature 612: 123-130 2. Jones et al. (2022) Science 378: 456-460
Anti-Patterns
Avoid Redundancy
Bad:
Figure 1 shows the force-distance curve. As can be seen in Figure 1, force increases with distance. The figure clearly demonstrates that...
Good:
Force increased linearly with distance (Figure 1).
Avoid Throat-Clearing
Bad:
It is important to note that our results suggest that it may be possible that cells potentially exhibit...
Good:
Cells exhibit viscoelastic behavior.
Avoid Over-Qualification
Bad:
The data appear to suggest that there might be a possible trend toward increased stiffness.
Good:
Stiffness increased 1.8-fold (p = 0.03).
Example Document
See EXAMPLE.md in this skill folder for a complete scientific results document demonstrating all principles.
Rules
image-analysis
Priority: high
Biological Image Analysis
Priority: Use MCP Tools First
Always prioritize Cellpose MCP over custom code:
- •MCPs are GPU-accelerated and tested
- •Only write scripts when explicitly requested
- •Use Python packages for tasks MCPs don't cover
Cellpose MCP Tools
Segmentation:
# Server: "user-cellpose"
CallMcpTool("user-cellpose", "segment_cells_2d",
{"image_path": "cells.tif",
"model_type": "cyto3", # or "nuclei", "cpsam"
"diameter": 30}) # 0 = auto-estimate
Models: cyto/cyto2/cyto3 (general cells), nuclei (nuclei only), cpsam (most accurate)
Key parameters: model_type, diameter, flow_threshold, cellprob_threshold, channels
Image restoration:
- •
denoise_image- Remove noise - •
deblur_image- Restore blur - •
upsample_image- Super-resolution - •
restore_and_segment- Combined pipeline
Utilities: estimate_cell_diameter, load_image_info, segment_cells_batch, list_available_models
Python Packages
Use when MCPs don't cover your needs:
scikit-image
from skimage.measure import regionprops
from skimage.filters import gaussian, threshold_otsu
from skimage.morphology import opening, closing
# Measure cells after segmentation
props = regionprops(masks)
for r in props:
area, perimeter, eccentricity = r.area, r.perimeter, r.eccentricity
Common functions: regionprops, gaussian, median, threshold_otsu, morphology operations
scipy.ndimage
from scipy.ndimage import gaussian_filter, label smoothed = gaussian_filter(image, sigma=2) labeled, n = label(binary_mask)
aicsimageio
from aicsimageio import AICSImage
# Load proprietary formats (ND2, CZI, LIF, LSM)
img = AICSImage("data.nd2")
data = img.get_image_data("CZYX")
Quick Reference
When to use MCPs:
- •Cell/nuclei segmentation
- •Denoise, deblur, upsample
- •Batch processing
When to write code:
- •Measurements (regionprops)
- •Statistical analysis
- •Custom filters
- •Data aggregation
project-repo
Priority: high
AI Research Workflow - Navigation Guide
This project demonstrates context engineering for AI-aided research workflows.
📖 Full documentation: See README.md for complete information about this framework.
Project Structure Quick Reference
Key locations in this repository:
- •ai-rulez/rules/ - AI guidance (see main rules for complete listing)
- •ai-rulez/agents/ - Specialized agents (e.g., literature-review)
- •ai-rulez/mcp/ - MCPs (e.g., napari-mcp, cellpose-mcp)
- •Data_analysis/ - Example datasets and data analysis workflows
- •Image_analysis/ - 23 sample microscopy images for testing
- •deep_stuff/ - Random stuff like rules of life, etc.
- •workflow.ipynb - Workflow notebook
python-coding-standards
Priority: high
Python Coding Standards
Core Principles
- •Style: Follow PEP 8
- •Execution: Keep silent - minimize print statements
- •Performance: Use vectorized operations (numpy/pandas) over loops
- •Functions: Analysis returns data only; plots accept
axargument - •Simplicity: Write inline code for one-off logic; functions for reuse
Jupyter Notebooks
⚠️ CRITICAL: Edit .py files only, NOT .ipynb
# %% [markdown]
# # Analysis Title
# %%
# Code cells use # %%
data = pd.read_csv('data.csv')
# %%
# Maintain 5-line spacing between cells
result = analyze(data)
Notebooks sync automatically via jupytext.
Analysis vs Plotting
NEVER create plots inside analysis functions:
# ❌ BAD: Analysis creates plot
def run_simulation():
history = compute_dynamics()
plt.plot(history) # DON'T DO THIS
return history
# ✅ GOOD: Analysis returns data
def run_simulation():
"""Compute dynamics and return history."""
return compute_dynamics()
# Plot in separate cell
history = run_simulation()
fig, ax = plt.subplots()
ax.plot(history)
plt.show()
Plot Functions
All plot functions MUST accept axes:
# ❌ BAD: Creates own figure
def plot_data(data):
fig, ax = plt.subplots()
ax.plot(data)
plt.savefig('plot.png')
# ✅ GOOD: Accepts axes argument
def plot_data(data, ax):
"""Plot data on provided axes."""
ax.plot(data)
ax.set_xlabel('X')
ax.set_ylabel('Y')
return ax
# Caller controls figure
fig, ax = plt.subplots(figsize=(8, 6))
plot_data(data, ax)
plt.savefig('plot.svg')
plt.show()
Plotting Configuration
Standard setup:
import matplotlib.pyplot as plt
import minimalist
minimalist.use_style("science")
plt.rcParams.update({'figure.facecolor': 'none', 'axes.facecolor': 'none'})
# Publication figure widths
text_width = 510/72.27 # LaTeX text width in inches
Standards:
- •Use matplotlib only (no seaborn)
- •Save as SVG for vector graphics
- •Save in
figures/folder - •Use minimalist "science" style
Code Style
Inline logic for one-off operations:
# ❌ BAD: Over-abstracted
def normalize(img):
return (img - img.min()) / (img.max() - img.min())
for q in quadrants:
result = normalize(q)
# ✅ GOOD: Inline for one-off
for q in quadrants:
result = (q - q.min()) / (q.max() - q.min())
Silent execution with inline comments:
# ❌ BAD: Noisy output
print("Processing...")
for i, f in enumerate(files):
print(f"File {i+1}/{len(files)}")
process(f)
# ✅ GOOD: Silent with comments
for f in files:
# Normalize → filter → threshold
process(f)
Docstrings
Simple format with Parameters and Returns:
def analyze_data(df, threshold=0.5):
"""
Analyze dataframe and compute metrics.
Parameters:
- df: pandas DataFrame with columns ['x', 'y', 'z']
- threshold: cutoff value for filtering (default 0.5)
Returns:
- dict with keys 'mean', 'std', 'count'
"""
filtered = df[df['x'] > threshold]
return {
'mean': filtered['y'].mean(),
'std': filtered['y'].std(),
'count': len(filtered)
}
Data Analysis
Pandas best practices:
# Use vectorized operations
df['result'] = df['x'] * df['y'] # Not: df.apply(lambda row: row['x'] * row['y'])
# Method chaining for readability
result = (df
.query('value > 0')
.groupby('category')
.agg({'value': ['mean', 'std']})
.reset_index()
)
# Save as CSV
result.to_csv('output.csv', index=False)
Quick Checklist
Before committing:
- • Analysis functions return data (no plots inside)
- • Plot functions accept
axargument - • Jupyter: edited
.pynot.ipynb - • Silent execution (minimal prints)
- • Docstrings with Parameters/Returns
- • Inline logic for one-off operations
- • File order: imports → config → functions → execution
rules
Priority: critical
Main rule for the project
The agent is an expert in:
- •Data Analysis: Exploratory data analysis, statistical analysis, data visualization
- •Image Analysis: Microscopy image processing, segmentation, quantification
- •Quantitative Analysis: Numerical computation, PDEs, ODEs, and mathematical modeling
- •AI Agents & MCPs: Model Context Protocol integration, agent workflows, context engineering
Core: Non-negotiable Rules
- •Provide concise, clear explanations
- •Ask questions; don't make assumptions
- •Prioritize readable, editable, reproducible, simple, modular code
- •Write concise, technical responses
Data Analysis
- •Use pandas, numpy, scipy, matplotlib for analysis and visualization
Image Analysis Expertise
Tools and Integration:
- •napari-mcp: Interactive image visualization and analysis
- •cellpose-mcp: Cell segmentation and quantification
- •Prioritize MCP tools over custom implementations
- •Extract quantitative metrics and validate results visually
- •Document analysis steps
Mathematical Tools:
- •Use sympy-mcp for calculus, algebra, differential equations
- •Use fmcp for mathematical plotting (matplotlib, numpy)
- •Generate LaTeX equations for documentation
- •Solve systems symbolically before numerical implementation
- •Vectorized operations for performance
Workflow:
- •Save results as CSV, plots as SVG
- •Only write custom scripts when explicitly requested
- •Validate results with custom code when needed
Location of important files
- •
Rules
- •
rules.md: Main rule file with project-wide standards and expert domains - •project-repo.md: Repository structure documentation and navigation guide for AI agents
- •python-coding-standards.md: Python coding patterns, best practices, and visualization standards
- •image-analysis.md: Image analysis workflow patterns and MCP tool prioritization
- •
- •
Commands
- •
git.md: Git workflow: quick commit & push, manual workflows, and status checking - •
airulez.md: AI-Rulez workflow: generate and commit with default message.
- •
- •
Agents
- •
literature-review.md: Expert literature research for biophysics and cell mechanics, semantic searches across local papers, Zotero library, and web sources
- •
- •
MCPs
- •
napari-mcp.md: Interactive image visualization and analysis - •
cellpose.md: Cell segmentation and quantification - •
fmcp.md: Mathematical plotting (matplotlib, numpy, sympy) - •
sympy-mcp.md: Symbolic mathematics and calculus - •
claude-scientific-skills.md: Scientific computing capabilities - •
data-forge.md: Data manipulation and analysis - •
notion.md: Notion workspace integration - •
zotero.md: Zotero library access for literature management - •
cursor-ide-browser.md: Browser automation for testing
- •
Context
architecture
Project Architecture
This project follows a modular architecture with clear separation of concerns.
Directory Structure
- •cmd/: Command-line interface and entry points
- •internal/: Private application code
- •pkg/: Public library code
- •tests/: Test files and fixtures
Key Principles
- •Dependency injection for better testability
- •Interface-based design for flexibility
- •Clear separation between business logic and infrastructure
git
Git - Complete GitHub Workflow
Repository: https://github.com/surajinacademia/AI-Aided-Research-Workflow
Command Parameters
User can type after /git to provide hints or descriptions:
- •
/git quickor/git small update→ Use quick workflow - •
/git new feature: add user auth→ Use detailed workflow with that description - •
/gitalone → Agent decides based on last commit date and change size
How to Choose Workflow
- •Prefer user hint: If user says "quick" / "small" / "just push" → quick workflow. If they say "significant" / "new feature" / "big change" or give a description → detailed workflow.
- •If no clear hint: Run
git statusandgit log -1 --format=%cito check last commit date. If last commit was within 2 days AND change set is small (few files, small diff) → quick workflow. Otherwise → detailed workflow. - •Default: When in doubt, use detailed workflow (propose message and ask) to avoid vague commits.
Quick Workflow (Small / Recent Updates)
When to use:
- •Changes are limited and last commit was within 2 days
- •User says "quick", "small update", "just sync", etc.
- •Typo fixes, config tweaks, small edits, daily sync
Steps:
- •Run
git status(and optionallygit diff --statto confirm scope) - •Stage all changes:
git add . - •Commit with short message:
- •If user provided text after
/git, use that - •Otherwise use timestamp:
Update: YYYY-MM-DD HH:MM
- •If user provided text after
- •Push:
git push
No confirmation step - keep it fast for small changes.
Detailed Workflow (Significant Changes / New Features)
When to use:
- •New features, large refactors, or many files changed
- •User says "significant", "new feature", "release", or provides description
- •Last commit is older than 2 days and change set is non-trivial
- •Multi-file changes that you'd want to read in
git loglater
Steps:
- •Run
git statusandgit diff(orgit diff --stagedafter temporarygit add .) to see what changed - •Propose a commit message:
- •If user provided description after
/git(e.g.,/git add auth and dashboard), use that as basis - •Otherwise, draft a short descriptive message following conventional commits style:
- •
feat:for new features - •
fix:for bug fixes - •
docs:for documentation - •
chore:for maintenance
- •
- •Example: "feat: add user authentication and dashboard"
- •If user provided description after
- •Ask the user: "I'll use this commit message:
<proposed message>. Confirm or edit?" - •Only after user confirms (or provides an edit):
- •Stage:
git add . - •Commit:
git commit -m "confirmed message" - •Push:
git push
- •Stage:
Standard Git Practices
Commit Message Format
- •Use short subject line (≤72 chars)
- •Optional body for explaining "why" (separate with blank line)
- •Conventional commits:
feat:,fix:,docs:,chore:for clarity
Pull Before Push
- •Before pushing, check if branch is behind remote:
git status - •If branch is ahead AND behind remote, run:
git pull --rebase - •Then push to avoid unnecessary merge commits
What Not to Commit
- •Check
git status --shortbefore staging - •Don't stage sensitive files (secrets,
.env, credentials) - •Don't stage large data files or build artifacts
- •Rely on
.gitignorefor automatic exclusion
Utility Commands
Check Status Only
git status
Shows what files changed without committing.
Check Last Commit Date
git log -1 --format=%ci
Shows when the last commit was made (helps decide workflow).
Check Ignored Files
git status --ignored
Shows files that won't be committed (in .gitignore).
View Recent Commits
git log --oneline -5
Shows last 5 commits with short messages.
Stash Changes
git stash # Save uncommitted work git stash pop # Restore stashed work
Use when switching branches with uncommitted changes.