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

Spike Sorting

ASecurity

Spike sorting for extracellular electrophysiology — detection, clustering, and quality metrics for single units.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentspythonrustgobash

Security Analysis

A100/100

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill spike-sorting --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Spike Sorting?

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

Security grade badge for Spike Sorting
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-spike-sorting/badge)](https://www.skillsdirectory.com/skills/aicodedecode-spike-sorting)

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: spike-sorting
description: Spike sorting for extracellular electrophysiology — detection, clustering, and quality metrics for single units.
category: scientific
---

## Overview

spike-sorting is the process of detecting action potentials in extracellular recordings and assigning
each spike to the neuron that produced it. It is the gateway to single-unit neuroscience: every
tuning curve, place field, and decoding result downstream depends on sorting done honestly.

Modern high-density probes (Neuropixels) record hundreds of neurons simultaneously, and the field has
moved from manual cluster-cutting to automated sorters (Kilosort, MountainSort, SpyKING Circus) plus
manual curation. The skill covers choosing a sorter, validating its output, and the quality metrics
that separate real single units from multi-unit hash.

## When to use

- Planning a recording: probe choice, sampling rate (≥20-30 kHz), reference strategy.
- Running a sorter: Kilosort2/3/4, MountainSort5, SpyKING Circus — parameters and drift correction.
- Curating output: merging, splitting, and rejecting clusters in Phy.
- Quality metrics: ISI violations, amplitude cutoff, presence ratio, SNR, isolation distance.
- Deciding single-unit vs multi-unit: honest labeling criteria.
- Troubleshooting: drift, double-counted spikes, over-splitting, electrical artifacts.

## Core concepts

- **Detection vs clustering vs curation.** Detection finds threshold-crossing events; clustering
  groups similar waveforms (now usually template-matching, which handles overlapping spikes);
  curation is the human step of merging/splitting/rejecting. Automation reduced but did not
  eliminate curation — blindly trusting sorter output is the commonest failure.
- **Drift.** The brain moves relative to the probe (microns over minutes). Sorters with drift
  tracking (Kilosort's drift correction) are mandatory for long recordings; without it, one
  neuron becomes several fake clusters over time.
- **Template matching.** Modern sorters detect spikes by matching waveform templates rather than
  simple thresholding, which resolves overlapping spikes from nearby neurons firing together —
  critical on dense probes where overlaps are common.
- **Quality metrics (report all of these).**
  - *ISI violations:* fraction of inter-spike intervals <1.5-2 ms (refractory period); <0.5-1%
    for a clean single unit.
  - *Amplitude cutoff:* estimated fraction of spikes missed below detection threshold; <0.1.
  - *Presence ratio:* fraction of the recording during which the unit fires; >0.9 (catches
    units that drift in and out).
  - *SNR / isolation:* waveform amplitude relative to noise; isolation distance or L-ratio for
    cluster separation.
- **Single vs multi-unit.** A cluster passing all metrics is a single unit; one failing
  (e.g. high ISI violations) is multi-unit activity — still usable for population analyses but
  not for claims about individual neurons. Label honestly; mixed analyses should test robustness
  to the single-unit subset.
- **Ground truth.** The only real validation is simultaneous juxtacellular/intracellular recording
  or hybrid synthetic data. Published sorter benchmarks use these; your curation criteria should be
  at least as strict as the benchmark's.
- **Common-path rejection.** Stimulation artifacts, movement, and electrical noise create
  synchronous events across channels — remove or blank these periods before sorting, and check
  cross-correlograms for suspicious zero-lag synchrony.

## Practical workflow

1. **Preprocess.** Band-pass filter (300-6000 Hz), common-average or median referencing across
   the probe, detect and blank stimulation artifacts.
2. **Sort.** Run Kilosort (with drift correction enabled) or MountainSort5 on the full recording.
   Save the raw output — never curate the only copy.
3. **Curate in Phy.** Inspect each cluster: waveform shape and stability over time, autocorrelogram
   (clean refractory gap?), cross-correlograms with neighbors (merge if refractory-gap-free and
   similar waveforms; split if bimodal).
4. **Apply metrics.** Compute ISI violations, amplitude cutoff, presence ratio automatically
   (e.g. quality-metrics packages); label single vs multi-unit by fixed thresholds decided in
   advance.
5. **Sanity checks.** Firing-rate distributions, waveform drift plots, fraction of spikes in
   bursts. Compare unit counts/yield across sessions — sudden changes flag problems.
6. **Export.** Spike times + cluster labels + quality metrics + probe geometry, in a standard
   format (NWB or NWB-like). Downstream analyses read this, never the sorter's raw files.

Example command sketch:
```bash
# Kilosort4 via Python
python -m kilosort --data_dir rec/ --probe neuropixels1.mat --do_drift_correction
# then curate in Phy, then:
python compute_quality_metrics.py --recording rec/ --sorting curated/
```

## Common pitfalls

- Skipping drift correction on long recordings (one neuron → many fake units).
- Over-splitting: treating waveform drift as two neurons.
- Under-merging: the same neuron split across adjacent channels' templates.
- Calling everything a "single unit" without metric thresholds.
- Sorting each session independently when tracking neurons across days (needs explicit
  across-day matching, which is hard — don't pretend it's automatic).
- Including stimulation/movement artifact periods, creating giant fake clusters.
- Changing curation criteria between experimental groups (observer bias — curate blind).

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
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 →