Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Meg Skill

ASecurity

Use this skill whenever the user wants to process MEG (magnetoencephalography) data including source localization, time-frequency analysis, connectivity analysis, sensor-level preprocessing, or MEG-specific feature extraction. Triggers include: 'MEG', 'MEG processing', 'MEG source localization', 'MEG connectivity', 'magnetoencephalography', 'beamformer', 'time-frequency', 'MEG preprocessing', or any request involving MEG data files (.fif, .con, .ds).

171 stars
0 votes
0 copies
0 views
Added 9/6/2026
ai-agentspythonshellbashgitbackend

Works with

cli

Security Analysis

A100/100

Scanned 9/6/2026

$npx -y skills add BioTender-max/awesome-bio-agent-skills --skill meg-skill --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Meg Skill?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Meg Skill
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/biotender-max-meg-skill/badge)](https://www.skillsdirectory.com/skills/biotender-max-meg-skill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: meg-skill
description: "Use this skill whenever the user wants to process MEG (magnetoencephalography) data including source localization, time-frequency analysis, connectivity analysis, sensor-level preprocessing, or MEG-specific feature extraction. Triggers include: 'MEG', 'MEG processing', 'MEG source localization', 'MEG connectivity', 'magnetoencephalography', 'beamformer', 'time-frequency', 'MEG preprocessing', or any request involving MEG data files (.fif, .con, .ds)."
license: MIT License (NeuroClaw custom skill – freely modifiable within the project)
layer: subagent
skill_type: modality
dependencies:
  - claw-shell
complementary_skills:
  - eeg-skill
  - smri-skill
  - brain-visualization
---
# MEG Skill (Modality Layer)

## Overview

`meg-skill` is the NeuroClaw **modality-layer** interface skill responsible for all MEG (magnetoencephalography) data processing tasks.

It strictly follows the NeuroClaw hierarchical design principles:
- This skill **only describes WHAT needs to be done** and **which tool skill to delegate to**.
- It contains **no implementation code or concrete commands**.
- All concrete execution is delegated to MNE-Python (via `claw-shell`) and companion scripts.
- Companion scripts in `scripts/` provide reference implementations for time-frequency analysis and source localization.

**Core workflow (never bypassed):**
1. Identify input MEG data format (.fif Elekta/Neuromag, .ds CTF, .con KIT/Yokogawa).
2. Ensure T1w structural MRI is available for source localization (via `smri-skill` if not yet processed).
3. Generate a **numbered execution plan** clearly stating WHAT needs to be done.
4. Present the full plan, estimated runtime, resource requirements, and risks to the user and wait for explicit confirmation ("YES" / "execute" / "proceed").
5. On confirmation, delegate every step via `claw-shell`.
6. After execution, save all outputs in a clean directory structure (`meg_output/`).

**Research use only.**

---

## Quick Reference (Common MEG Tasks)

| Task | What needs to be done | Implementation via | Expected output |
|---|---|---|---|
| Load & validation | Read raw MEG, check channel types, info metadata | MNE-Python (`mne.io`) | Raw object + validation report |
| Maxwell filtering | Signal-space separation (SSS) for Elekta systems | MNE-Python (`mne.preprocessing.maxwell_filter`) | Cleaned raw MEG |
| Filtering | Band-pass, notch (line noise removal at 50/60 Hz) | MNE-Python (`raw.filter`, `raw.notch_filter`) | Filtered raw data |
| Epoching | Segment continuous data around events | MNE-Python (`mne.Epochs`) | Epoched data |
| ICA artifact removal | Remove cardiac, ocular, environmental artifacts | MNE-Python (`mne.preprocessing.ICA`) | Cleaned epochs |
| Time-frequency analysis | Morlet wavelet multitaper, Hilbert transform | `scripts/time_frequency.py` | TFR maps (power, ITC) |
| Source localization | Forward/inverse modeling (MNE, dSPM, beamformer) | MNE-Python + FreeSurfer | Source estimates in brain space |
| Source-space connectivity | Coherence, PLV, dPLI between source parcels | MNE-Python (`mne_connectivity`) | Connectivity matrices |
| Sensor-level connectivity | Coherence, PLV between sensor pairs | MNE-Python | Sensor connectivity |
| Evoked responses | Average epochs, compute ERPs/ERFs | MNE-Python (`epochs.average`) | Evoked NIfTI/fif files |

---

## Supported MEG File Formats

| Format | System | Extension | Reader |
|---|---|---|---|
| Elekta/Neuromag | VectorView, TRIUX | `.fif` | `mne.io.read_raw_fif` |
| CTF | CTF MEG systems | `.ds` | `mne.io.read_raw_ctf` |
| KIT/Yokogawa | KIT, Ricoh | `.con`, `.mrk` | `mne.io.read_raw_kit` |
| BIDS MEG | Any (BIDS format) | `.meg.fif` | `mne.io.read_raw_fif` |

---

## Core Processing Pipeline

### Stage 1: Data Loading & Validation
- Load raw MEG data and validate channel types (magnetometers, gradiometers, EEG, EOG, ECG, STIM)
- Check sampling rate, duration, and channel count
- Report bad channels if annotated

### Stage 2: Preprocessing
- **Maxwell filtering** (SSS/tSSS): for Elekta systems, remove environmental noise
- **Band-pass filtering**: typically 1–100 Hz for sensor-level analysis
- **Notch filter**: remove power line noise (50 Hz or 60 Hz)
- **Downsampling**: optional, to reduce computation (e.g., 1000 Hz → 250 Hz)

### Stage 3: Artifact Removal (ICA)
- Run ICA (FastICA, Infomax, or Picard)
- Auto-detect and remove cardiac (ECG), ocular (EOG), and muscle artifacts
- Correlate ICA components with ECG/EOG channels

### Stage 4: Epoching & Averaging
- Segment around events of interest
- Baseline correction
- Reject bad epochs (amplitude threshold, autoreject)
- Compute evoked responses (ERFs)

### Stage 5: Time-Frequency Analysis (via `scripts/time_frequency.py`)
- Morlet wavelet or multitaper spectral analysis
- Compute power spectral density per frequency band (δ/θ/α/β/γ)
- Inter-trial coherence (ITC)

### Stage 6 (Optional): Source Localization
- Requires T1w MRI from `smri-skill` and FreeSurfer cortical reconstruction
- Compute forward model (BEM or sphere)
- Apply inverse solution (MNE, dSPM, sLORETA, or LCMV beamformer)
- Output source estimates on cortical surface

---

## Scripts

### `scripts/time_frequency.py`
Computes time-frequency representations from MEG epochs.

```bash
python skills/meg-skill/scripts/time_frequency.py \
  --epochs /path/to/epochs.fif \
  --output /path/to/meg_output/tfr/ \
  --freq-min 1 --freq-max 100 --freq-steps 40 \
  --method morlet \
  --baseline -0.2 0.0
```

---

## Standard Output Layout

```
meg_output/
├── preprocessed/          # Filtered, cleaned raw MEG
├── epochs/                # Epoched data (.fif)
├── evoked/                # Averaged evoked responses (.fif, .nii.gz)
├── tfr/                   # Time-frequency results
│   ├── power_*.nii.gz
│   └── itc_*.nii.gz
├── source/                # Source estimates (if source localization run)
│   ├── stc_*.lh.stc
│   └── stc_*.rh.stc
├── connectivity/          # Connectivity matrices (if requested)
├── qc/                    # Quality control reports
└── logs/
```

---

## Installation (Handled by dependency-planner)

No manual installation required at this layer.
When first used, `meg-skill` automatically calls `dependency-planner` to install MNE-Python and dependencies via conda.

---

## Important Notes & Limitations

- MEG data is large (hundreds of MB to GB per recording); ensure sufficient disk space.
- Maxwell filtering (SSS) is specific to Elekta/Neuromag systems; CTF and KIT systems use different approaches.
- Source localization requires co-registered T1w MRI and MEG sensor positions (head position indicator coils or digitized head shape).
- MNE-Python is the primary backend; all MEG processing is built on MNE.
- MEG has millisecond temporal resolution but lower spatial resolution than fMRI.
- BIDS-MEG format follows the BIDS extension for MEG: https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/02-magnetoencephalography.html
- This skill is for research workflows; not for clinical decision-making.

---

## When to Call This Skill

- When the user provides MEG data (.fif, .ds, .con) and requests preprocessing, artifact removal, or analysis.
- When time-frequency analysis or source localization is needed for MEG data.
- When MEG connectivity analysis (sensor-level or source-level) is requested.
- When `eeg-skill` handles EEG but the data also includes MEG channels.
- When dataset skills (e.g., `Cam-CAN`) delegate MEG processing.

---

## Complementary / Related Skills

- `eeg-skill` → EEG processing (MEG and EEG share many MNE-Python tools)
- `smri-skill` → T1w structural preprocessing (required for source localization)
- `freesurfer-tool` → cortical reconstruction for source-space analysis
- `nibabel-skill` → NIfTI I/O for surface/volume data
- `brain-visualization` → MEG source overlay visualization
- `nilearn-tool` → post-hoc statistical analysis on source estimates

---

## Reference
- MNE-Python: https://mne.tools/
- Gramfort et al. (2013): MEG and EEG data analysis with MNE-Python
- Taulu & Simola (2006): Spatiotemporal signal space separation (SSS)
- BIDS MEG: https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/02-magnetoencephalography.html
- Cam-CAN dataset: https://www.cam-can.org/

Created At: 2026-05-06 12:19 HKT
Last Updated At: 2026-05-06 12:19 HKT
Author: chengwang96

Attribution

BioTender-maxBioTender-max
View sourceSee grades on GitHubMore from BioTender-max →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →