cpp-tscancode
TscanCode静态分析技能:使用TscanCode(腾讯开源)进行C/C++代码质量分析,检测缺陷、安全漏洞和代码风格问题
Skill by hellyguo
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/hellyguo-cpp-tscancode
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Shell scripts
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/cpp-tscancode
What's inside
- Skill name
cpp-tscancode- Description
- TscanCode静态分析技能:使用TscanCode(腾讯开源)进行C/C++代码质量分析,检测缺陷、安全漏洞和代码风格问题
- License
- Apache-2.0
- Instructions
- 111 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (5)
- SKILL.md
- CMakeLists-tscancode.txt · templates/
- Makefile-tscancode · templates/
- tscancode-check.sh · templates/
- tscancode-summary.sh · templates/
SKILL.md (first lines)
# TscanCode C/C++静态分析技能
> 本文件中的 `templates/...` 均指本技能目录下的 `templates/` 子目录。
## 工具位置
```bash
TSCANCODE=${HOME}/app/TscanCode.linux/tscancode
```
## 执行流程
1. **确定源代码路径**:`SRC_DIR=src`(根据项目结构调整)
1. **执行分析**(按需选择级别):
```bash
# 基础检查
$TSCANCODE $SRC_DIR
# 完整检查(含风格、性能、可移植性)
$TSCANCODE --enable=all $SRC_DIR 2> tscancode-full.txt
# 仅警告检查
$TSCANCODE --enable=warning $SRC_DIR 2> tscancode-warning.txt
# 风格和性能检查
$TSCANCODE --enable=style,performance $SRC_DIR 2> tscancode-style.txt
```
1. **指定输出格式**:
```bash
# 文本格式(默认,输出到stderr)
$TSCANCODE --enable=all $SRC_DIR 2> tscancode.txt
# XML格式
$TSCANCODE --enable=all --xml $SRC_DIR 2> tscancode.xml
# 静默模式
$TSCANCODE --quiet --enable=all $SRC_DIR 2> tscancode.txt
```
1. **处理结果**:
```bash
# 统计问题类型
grep -oP '\[.*?\]' tscancode.txt | sort | uniq -c | sort -nr
# 提取高危问题
grep -E '(error|warning):' tscancode.txt
```
## 常用参数
| 参数 | 描述 | 示例 |
| --- | --- | --- |
| `--enable=<id>` | 启用检查类别 | `warning`, `style`, `performance`, `portability`, `information`, `all` |
| `-I <dir>` | 包含目录 | `-I include -I /usr/include` |
| `-D<macro>` | 定义宏 | `-DDEBUG -DNDEBUG` |
| `-U<macro>` | 取消宏定义 | `-UDEBUG` |
| `-j <n>` | 并行检查线程数 | `-j 4` |
| `--quiet` | 静默模式 | `--quiet` |
| `--xml` | XML格式输出 | `--xml` |
## 检查类别
| 类别 | 关键检查项 |
| --- | --- |
| warning | 空指针解引用、数组越界、整数溢出、未初始化变量、内存泄漏、双重释放 |
| style | 冗余代码、复杂表达式、变量作用域、命名规范 |
| performance | 按值传递、冗余拷贝、低效算法 |
| portability | 平台依赖、类型大小假设 |
| information | 缺少包含、配置问题 |
| unusedFunction | 定义但未被调用的函数 |
## 典型场景
| 场景 | 命令 |
| --- | --- |
| 快速检查 | `$TSCANCODE --enable=warning $SRC_DIR 2> tscancode-warning.txt` |
| 完整检查 | `$TSCANCODE --enable=all -j 4 $SRC_DIR 2> tscancode-full.txt` |
| 特定目录 | `$TSCANCODE --enable=all -I include src/core/ 2> tscancode-core.txt` |
| CI集成 | `$TSCANCODE --quiet --enable=warning --xml $SRC_DIR 2> tscancode-report.xml` |
| 宏控制 | `$TSCANCODE --enable=all -DDEBUG $SRC_DIR 2> tscancode-debug.txt` |
## 构建系统集成
模板文件位于 `templates/` 目录:
- `tscancode-check.sh` - Shell脚本封装
- `tscancode-summary.sh` - 摘要报告生成
- `CMakeLists-tscancode.txt` - CMake集成目标
- `Makefile-tscancode` - Makefile集成
## 最佳实践
1. 增量检查:大型项目使用 `-j` 并行加速
2. 分级处理:先修复 error,再处理 warning,最后优化 style
3. 包含路径:确保 `-I` 参数包含所有必要的头文件路径
4. 宏定义:正确设置 `-D` 参数以覆盖所有代码路径
5. CI集成:将 TscanCode 纳入持续集成流程
## 注意事项
1. TscanCode 默认输出到 stderr,需重定向 `2>` 捕获
2. `--enable=all` 会启用 unusedFunction,建议全项目扫描
3. 确保 `-I` 路径正确,否则可能误报缺少包含
---
**技能版本**: 1.0.0 | **适用项目**: C/C++ | **输出位置**: 当前目录 tscancode-*.txtFrom hellyguo/self-ai-spec, Apache-2.0.
More from hellyguo/self-ai-spec
- 0.618score
code-review
hellyguo
代码审查框架:通用审查流程 + 语言特定规则引用,支持多语言代码审查
SkillAFreshness: A★ 8Claude Code +9 - 0.614score
code-deconstruct
hellyguo
读取所有源代码,解构为设计图、设计文档、数据库设计; 没有执行文件,请按流程执行
SkillAFreshness: A★ 8Claude Code +9 - 0.592score
gdb-heap-analysis
hellyguo
GDB heap/arena memory analysis for core dump debugging.
SkillBFreshness: B★ 8Claude Code +9 - 0.589score
java-coverage
hellyguo
Strategies and patterns to boost test coverage to 80%+ line or 60%+ branch coverage.
SkillBFreshness: B★ 8Claude Code +9 - 0.581score
java-check-spotbugs
hellyguo
SpotBugs静态分析技能:使用SpotBugs、Find Security Bugs、fb-contrib进行Java代码缺陷和安全分析
SkillBFreshness: B★ 8Claude Code +9 - 0.580score
ast-grep-block
hellyguo
基于 ast-grep 的代码审查门禁:使用 code-checklist 规则集对 Java/C++/ANSI C 项目分级扫描(high/medium/low),输出命中清单与 CI 退出码。仅使用 CLI 模式(run.sh),适用于交互式审查、CI 质量门禁、批量检测
SkillBFreshness: B★ 8Claude Code +9 - 0.578score
java-check-pmd
hellyguo
PMD静态分析技能:使用PMD进行Java代码质量分析,检测代码坏味道、编码规范和安全问题
SkillBFreshness: B★ 8Claude Code +9 - 0.578score
java-env
hellyguo
该skill没有执行文件,为信息输入:Java开发需要的环境信息
SkillBFreshness: B★ 8Claude Code +9 - 0.575score
code-refactor
hellyguo
该skill没有执行文件,为操作指引:如何重构
SkillBFreshness: B★ 8Claude Code +9 - 0.575score
java-asprof
hellyguo
该skill没有执行文件,为操作指引:采集Java执行情况
SkillBFreshness: B★ 8Claude Code +9 - 0.574score
code-part-modification
hellyguo
局部代码修改技能:最小化修改完成功能,确保无蝴蝶效应,支持独立测试验证和全量关联检查
SkillBFreshness: B★ 8Claude Code +9 - 0.530score
cpp-clang-tidy
hellyguo
Clang-Tidy 静态分析技能:使用 clang-tidy 进行 C/C++ 代码质量检测,支持自定义检查规则和自动修复
SkillCFreshness: C★ 8Claude Code +9
Signals
- Stars
- 8
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 27, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/hellyguo/self-ai-spec
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from hellyguo
- 0.618score
code-review
hellyguo
代码审查框架:通用审查流程 + 语言特定规则引用,支持多语言代码审查
SkillAFreshness: A★ 8Claude Code +9 - 0.614score
code-deconstruct
hellyguo
读取所有源代码,解构为设计图、设计文档、数据库设计; 没有执行文件,请按流程执行
SkillAFreshness: A★ 8Claude Code +9 - 0.592score
gdb-heap-analysis
hellyguo
GDB heap/arena memory analysis for core dump debugging.
SkillBFreshness: B★ 8Claude Code +9 - 0.589score
java-coverage
hellyguo
Strategies and patterns to boost test coverage to 80%+ line or 60%+ branch coverage.
SkillBFreshness: B★ 8Claude Code +9 - 0.581score
java-check-spotbugs
hellyguo
SpotBugs静态分析技能:使用SpotBugs、Find Security Bugs、fb-contrib进行Java代码缺陷和安全分析
SkillBFreshness: B★ 8Claude Code +9 - 0.580score
ast-grep-block
hellyguo
基于 ast-grep 的代码审查门禁:使用 code-checklist 规则集对 Java/C++/ANSI C 项目分级扫描(high/medium/low),输出命中清单与 CI 退出码。仅使用 CLI 模式(run.sh),适用于交互式审查、CI 质量门禁、批量检测
SkillBFreshness: B★ 8Claude Code +9
Cite this page
cpp-tscancode skill. Agent Mart. https://agentmart.dev/skills/hellyguo-cpp-tscancode (last updated 2026-10-24)