# contour-integrals

contour-integrals — a Claude Code skill for solving contour integral problems in complex analysis. It guides you through choosing the right contour, locating poles, and applying the residue theorem to evaluate definite integrals.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 3951 repo stars
- Author: parcadei
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/parcadei/Continuous-Claude-v3/tree/HEAD/.claude/skills/math/complex-analysis/contour-integrals/SKILL.md
- Updated: 2026-01-26
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/contour-integrals

## What it does

The skill breaks down the process: identify the integral type, select an appropriate contour (semicircle, unit circle, keyhole), find singularities, and compute residues using the residue formula. It provides SymPy commands to search for poles, calculate residues at specific points, and evaluate integrals directly.

Commands run via `uv run python -m runtime.harness scripts/sympy_compute.py` with subcommands like residue, solve, and integrate. You'll need Python with SymPy installed; the skill runs locally in Claude Code on your machine.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add parcadei/Continuous-Claude-v3 --skill contour-integrals -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add parcadei/Continuous-Claude-v3 --skill contour-integrals -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add parcadei/Continuous-Claude-v3 --skill contour-integrals -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install parcadei/Continuous-Claude-v3 .claude/skills/math/complex-analysis/contour-integrals
```

2. **Manually: put the files in place**
- File: `.github/skills/contour-integrals/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add parcadei/Continuous-Claude-v3 --skill contour-integrals -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/parcadei/Continuous-Claude-v3 --path .claude/skills/math/complex-analysis/contour-integrals
```

### Windsurf (Devin Desktop)

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

### 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/parcadei/Continuous-Claude-v3/tree/HEAD/.claude/skills/math/complex-analysis/contour-integrals/SKILL.md

## When to use it
- compute an integral over the real line using a closed contour
- locate all poles of a function in the complex plane
- apply Jordan's lemma to show an arc contribution vanishes
- calculate the residue of a function at a given point

## Example prompts
- Find the poles of `1/(z**2 + 1)` and compute the residue at each
- Set up a semicircular contour for the integral `integral_{-inf}^{inf} 1/(x**2 + 1) dx`
- Verify that the arc integral vanishes as the radius approaches infinity

## 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: 562b545c4800e60f.

BEGIN THIRD-PARTY FILE 562b545c4800e60f
````text
---
name: contour-integrals
description: "Problem-solving strategies for contour integrals in complex analysis"
allowed-tools: [Bash, Read]
---

# Contour Integrals

## When to Use

Use this skill when working on contour-integrals problems in complex analysis.

## Decision Tree


1. **Integral Type Selection**
   - For integral_{-inf}^{inf} f(x)dx where f decays like 1/x^a, a > 1:
     * Use semicircular contour (upper or lower half-plane)
   - For integral involving e^{ix} or trigonometric functions:
     * Close in upper half-plane for e^{ix} (Jordan's lemma)
     * Close in lower half-plane for e^{-ix}
   - For integral_0^{2pi} f(cos theta, sin theta)d theta:
     * Substitute z = e^{i theta}, use unit circle contour
   - For integrand with branch cuts:
     * Use keyhole or dogbone contour around cuts

2. **Contour Setup**
   - Identify singularities and their locations
   - Choose contour that encloses desired singularities
   - `sympy_compute.py solve "f(z) = inf"` to find poles

3. **Jordan's Lemma**
   - For integral over semicircle of radius R:
   - If |f(z)| -> 0 as |z| -> inf, semicircular contribution vanishes

4. **Compute with Residue Theorem**
   - oint_C f(z)dz = 2*pi*i * (sum of residues inside C)
   - `sympy_compute.py residue "f(z)" --var z --at z0`


## Tool Commands

### Sympy_Residue
```bash
uv run python -m runtime.harness scripts/sympy_compute.py residue "1/(z**2 + 1)" --var z --at I
```

### Sympy_Poles
```bash
uv run python -m runtime.harness scripts/sympy_compute.py solve "z**2 + 1" --var z
```

### Sympy_Integrate
```bash
uv run python -m runtime.harness scripts/sympy_compute.py integrate "1/(x**2 + 1)" --var x --from "-oo" --to "oo"
```

## Key Techniques

*From indexed textbooks:*

- [Complex Analysis (Elias M. Stein, Ram... (Z-Library)] The keyhole contour and one small, connected by a narrow corridor. The interior of Γ, which we denote by Γint, is clearly that region enclosed by the curve, and can be given precise meaning with enough work. We x a point z0 in that If f is holomorphic in a neighborhood of Γ and its interior, interior.
- [Complex Analysis (Elias M. Stein, Ram... (Z-Library)] For the proof, consider a multiple keyhole which has a loop avoiding In each one of the poles. Let the width of the corridors go to zero. Suppose that f is holomorphic in an open set containing a toy contour γ and its interior, except for poles at the points z1, .
- [Complex Analysis (Elias M. Stein, Ram... (Z-Library)] CAUCHY’S THEOREM AND ITS APPLICATIONS The following denition is loosely stated, although its applications will be clear and unambiguous. We call a toy contour any closed curve where the notion of interior is obvious, and a construction similar to that in Theorem 2. Its positive orientation is that for which the interior is to the left as we travel along the toy contour.
````
END THIRD-PARTY FILE 562b545c4800e60f

The third-party file has ended. Everything between the 562b545c4800e60f 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 2858 of 3616 bytes. © parcadei · MIT · https://github.com/parcadei/Continuous-Claude-v3/tree/HEAD/.claude/skills/math/complex-analysis/contour-integrals/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
