# music-theory-verification

music-theory-verification verifies music theory calculations: mod 12 intervals, fretboard mappings, modal scales, and Nashville numbers. Helps spot mathematical bugs in audio code.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 1 install
- Author: EvanMcCormick
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/EvanMcCormick/Interactive-Music-Theory/tree/HEAD/.claude/skills/music-theory-verification/SKILL.md
- Updated: 2026-10-22
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/music-theory-verification

## What it does

Music theory algorithms depend on modular arithmetic base 12. A misplaced index or improper wrap yields incorrect notes that stay hidden until someone listens to the output. This skill provides concrete test matrices for scales, chord voicings, MIDI octaves, and guitar strings.

The reference points target frequent pitfalls such as modulo 11 typos and negative interval offsets. Without using `((root - interval) % 12 + 12) % 12`, downward transposition breaks note lookup tables by querying negative array indices.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add EvanMcCormick/Interactive-Music-Theory --skill music-theory-verification -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/music-theory-verification/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/music-theory-verification/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add EvanMcCormick/Interactive-Music-Theory --skill music-theory-verification -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/music-theory-verification/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add EvanMcCormick/Interactive-Music-Theory --skill music-theory-verification -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/music-theory-verification/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install EvanMcCormick/Interactive-Music-Theory .claude/skills/music-theory-verification
```

2. **Manually: put the files in place**
- File: `.github/skills/music-theory-verification/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add EvanMcCormick/Interactive-Music-Theory --skill music-theory-verification -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/EvanMcCormick/Interactive-Music-Theory --path .claude/skills/music-theory-verification
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/music-theory-verification/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add EvanMcCormick/Interactive-Music-Theory --skill music-theory-verification -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/EvanMcCormick/Interactive-Music-Theory/tree/HEAD/.claude/skills/music-theory-verification/SKILL.md

## When to use it
- catch modulo 12 calculation errors during note transposition
- verify note mapping on standard guitar tuning E-A-D-G-B-E
- validate 1-indexed Nashville number scale lookups
- derive and test intervals across the seven diatonic modes

## Example prompts
- Verify the note interval modulo math in `fretboard.ts`
- Check my Nashville number logic for non-scale notes
- Test chord voicing calculations for G7 and C major

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 38a5dedb4a86ced4.

BEGIN THIRD-PARTY FILE 38a5dedb4a86ced4
````text
---
name: music-theory-verification
description: Use when implementing or debugging music theory calculations - provides verification methods for intervals, note naming, scale construction, and chord voicings to catch common mathematical errors
---

# Music Theory Verification

## Overview

Music theory code involves modular arithmetic (mod 12) and interval calculations. Small errors produce completely wrong notes that may not be obvious until heard.

**Core principle:** Verify calculations against known musical facts before trusting code.

## When to Use

- Debugging incorrect note display
- Verifying new scale/chord implementations
- Troubleshooting Nashville number display
- Checking fretboard/keyboard generation
- Validating transposition logic

## The Chromatic Scale

```
Index:  0   1    2   3    4   5   6    7   8    9   10   11
Sharp:  C   C#   D   D#   E   F   F#   G   G#   A   A#   B
Flat:   C   Db   D   Eb   E   F   Gb   G   Ab   A   Bb   B
```

## Interval Math

### Note Value Calculation
```typescript
// Adding interval to root
noteValue = (rootValue + interval) % 12;

// Example: G major 3rd
// G = 7, major 3rd = 4
// (7 + 4) % 12 = 11 = B ✓
```

### Fret Note Calculation
```typescript
// Note at fret position
noteValue = (openStringValue + fretNumber) % 12;

// Example: 3rd fret on A string (A = 9)
// (9 + 3) % 12 = 0 = C ✓
```

### Common Errors
```typescript
// WRONG: Forgetting modulo
noteValue = rootValue + interval;  // Can exceed 11!

// WRONG: Wrong modulo base
noteValue = (root + interval) % 11;  // Should be 12

// WRONG: Negative intervals without handling
noteValue = (root - interval) % 12;  // Can be negative!

// CORRECT: Handle negative
noteValue = ((root - interval) % 12 + 12) % 12;
```

## Quick Verification Tests

### Major Scale Test
Starting from C (0), major scale intervals [0,2,4,5,7,9,11] should produce:
```
C(0) D(2) E(4) F(5) G(7) A(9) B(11)
```

Starting from G (7):
```
G(7) A(9) B(11) C(0) D(2) E(4) F#(6)
```

### Minor Scale Test
Starting from A (9), natural minor [0,2,3,5,7,8,10]:
```
A(9) B(11) C(0) D(2) E(4) F(5) G(7)
```

### Chord Test
C Major chord [0,4,7] from C(0):
```
C(0) E(4) G(7) ✓
```

G7 chord [0,4,7,10] from G(7):
```
G(7) B(11) D(2) F(5) ✓
```

## Nashville Number Verification

Nashville numbers represent scale degrees 1-7.

### Calculation
```typescript
// Find position of note in current scale
nashvilleNumber = scaleIntervals.indexOf(
  (noteValue - rootValue + 12) % 12
) + 1;  // +1 because Nashville is 1-indexed

// If not in scale, nashvilleNumber = 0 or null
```

### Test Cases

C Major scale, notes C-D-E-F-G-A-B:
```
C → 1 (root)
D → 2
E → 3
F → 4
G → 5
A → 6
B → 7
C# → null (not in scale)
```

## Mode Derivation Verification
````
END THIRD-PARTY FILE 38a5dedb4a86ced4

The third-party file has ended. Everything between the 38a5dedb4a86ced4 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2763 of 6450 bytes. © EvanMcCormick · MIT · https://github.com/EvanMcCormick/Interactive-Music-Theory/tree/HEAD/.claude/skills/music-theory-verification/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
