# c-bounds-safety

Guides the adoption of the -fbounds-safety C language extension, helping add pointer annotations and debug runtime bounds violations.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 623 installs · ★ 352
- Author: superagents-lab
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/superagents-lab/xcode27-skills/tree/HEAD/c-bounds-safety/SKILL.md
- Updated: 2026-06-09
- HTML: https://affpapa.org/en/nevibecode/skills/c-bounds-safety

## What it does

This skill guides developers through adopting `-fbounds-safety` in existing C projects. The extension stops buffer overflows by enforcing bounds checking at compile time and turning out-of-bounds access into deterministic runtime traps. The model asks clarifying questions about codebase goals and uses plan mode before modifying multiple files.

The skill references documentation covering pointer annotations like `__counted_by` or `__null_terminated`, helper conversion functions, and `ptrcheck.h` macros. It also covers Xcode build settings, soft trap modes, and runtime troubleshooting. For crash diagnosis, it details LLDB inspection of wide pointers, watchpoints, and crash log analysis.

Your toolchain must support `-fbounds-safety` and include `ptrcheck.h`, because standard C compilers will fail on these annotations.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill c-bounds-safety -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill c-bounds-safety -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill c-bounds-safety -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install superagents-lab/xcode27-skills c-bounds-safety
```

2. **Manually: put the files in place**
- File: `.github/skills/c-bounds-safety/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill c-bounds-safety -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/superagents-lab/xcode27-skills --path c-bounds-safety
```

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add superagents-lab/xcode27-skills --skill c-bounds-safety -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/superagents-lab/xcode27-skills/tree/HEAD/c-bounds-safety/SKILL.md

## When to use it
- annotate C pointers using `__counted_by`, `__single`, and `__sized_by`
- migrate legacy C codebases to `-fbounds-safety` mode
- configure Xcode build flags and `ptrcheck.h` headers
- diagnose runtime traps and wide pointer crashes in LLDB

## Example prompts
- Help me annotate pointer bounds with __counted_by in this C header
- How do I configure Xcode build settings for -fbounds-safety and soft traps?
- Debug this LLDB crash log caused by an out-of-bounds trap

## Similar
- [memory-safety-patterns](https://affpapa.org/en/nevibecode/skills/memory-safety-patterns.md) — skill · 11746 installs
- [debugging-instruments](https://affpapa.org/en/nevibecode/skills/debugging-instruments.md) — skill · 4100 installs
- [golang-safety](https://affpapa.org/en/nevibecode/skills/golang-safety.md) — skill · 40600 installs
- [python-type-safety](https://affpapa.org/en/nevibecode/skills/python-type-safety.md) — skill · 12643 installs
- [address-sanitizer](https://affpapa.org/en/nevibecode/skills/address-sanitizer.md) — skill · 5400 installs
- [rust-systems-programming](https://affpapa.org/en/nevibecode/skills/rust-systems-programming.md) — skill · 485 installs

From the same set: [superagents-lab/xcode27-skills](https://affpapa.org/en/nevibecode/by/superagents-lab/xcode27-skills.md) — 6 cards

---
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
