# C Cpp Analyzer

> Analyze C/C++ code for Rust migration planning. Classifies functions by migration difficulty (easy/medium/hard), identifies unsafe patterns, pointer complexity, and macro usage. Use when: analyze C code, migration planning, C to Rust, assess migration difficulty, code complexity analysis.

- **Type:** Skill
- **Install:** `agentstack add skill-juanmarchetto-agent-skills-c-cpp-analyzer`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [JuanMarchetto](https://agentstack.voostack.com/s/juanmarchetto)
- **Installs:** 0
- **Category:** [Web & Browser](https://agentstack.voostack.com/c/web-and-browser)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [JuanMarchetto](https://github.com/JuanMarchetto)
- **Source:** https://github.com/JuanMarchetto/agent-skills/tree/main/skills/c-cpp-analyzer
- **Website:** https://github.com/JuanMarchetto/agent-skills

## Install

```sh
agentstack add skill-juanmarchetto-agent-skills-c-cpp-analyzer
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# C/C++ Analysis for Migration

## Difficulty Classification
Uses tree-sitter AST analysis with regex fallback:
- **Easy**: Pure functions, simple arithmetic, no pointers, 30 lines → Medium):
- Pointer declarations
- Cast expressions
- `malloc`/`calloc` usage

## Pattern Detection
| C Pattern | Rust Equivalent | Difficulty |
|-----------|----------------|------------|
| `ptr + len` pairs | `&[T]` slices | Medium |
| Error code returns | `Result` | Easy |
| NULL checks | `Option` | Easy |
| `malloc`/`free` | `Vec`, `Box` | Medium |
| `char*` strings | `&str`, `String` | Medium |
| Manual iteration with pointers | `.iter()`, `.enumerate()` | Medium |
| `goto` cleanup | `Drop` trait, `?` operator | Hard |
| Global mutable state | Function parameters, `OnceLock` | Hard |
| Bit manipulation | Same ops with explicit types | Medium |
| `union` | `enum` with variants | Hard |
| Function pointers / callbacks | Enum dispatch (preferred) or `Fn` traits | Hard |
| Linked lists (next/prev) | `Vec` (flatten) | Medium |
| Type tag + union (tagged union) | `enum` with data variants | Medium-Hard |
| Recursive data structures | `enum` + `Box` | Medium |
| Coroutine via switch/case | Explicit state machine (`match` loop) | Hard |
| Printf format strings | `format!()` / `println!()` macros | Easy-Medium |
| `strdup`/`strcpy` | `.to_string()`, `.clone()` | Easy |

## Size-Based Strategy
| LOC Range | Strategy | Chunking | Repair Iters |
|-----------|----------|----------|--------------|
| 4000 LOC — may exceed API token limits even with chunking

## Migration Ceiling (learned from miniz)
Some patterns have NO safe Rust equivalent and require full algorithm redesign:
- Coroutine via switch/case (Duff's device) → explicit state machine
- Large structs with internal pointers (~300KB) → redesign needed
- Bit-level DEFLATE/INFLATE → requires exact semantic preservation
- These files need "best-effort" mode: output highest-quality version for developer to finish

---

Powered by [Noricum](https://github.com/JuanMarchetto/noricum) — autonomous C/C++ to Rust migration agent

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [JuanMarchetto](https://github.com/JuanMarchetto)
- **Source:** [JuanMarchetto/agent-skills](https://github.com/JuanMarchetto/agent-skills)
- **License:** MIT
- **Homepage:** https://github.com/JuanMarchetto/agent-skills

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-juanmarchetto-agent-skills-c-cpp-analyzer
- Seller: https://agentstack.voostack.com/s/juanmarchetto
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
