ContextGate — Data skill for Claude Code
Spring Boot + MyBatis 框架感知代码地图:静态分析调用链/SQL/事务/实体影响面,通过 MCP 喂给 AI 编程工具(Trae/Cursor/Claude Code),省 token、防幻觉.
How to install ContextGate
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open 23512478/ContextGate and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What ContextGate does
Spring Boot + MyBatis 框架感知代码地图:静态分析调用链/SQL/事务/实体影响面,通过 MCP 喂给 AI 编程工具(Trae/Cursor/Claude Code),省 token、防幻觉.
Alternatives in Data
- Private GPT — Complete API layer for private AI applications on local models: RAG, skills, tools, MCP, text-to-sql, and more 57.5k ★
- SQL Queries — Generate SQL queries from natural language across major dialects 7.8k ★
- Claude Code Usage Monitor — by Maciek-roboblog - A real-time terminal-based tool for monitoring Claude Code token usage 7k ★
README
ContextGate
[](https://github.com/23512478/ContextGate/releases) [](LICENSE) [](https://www.python.org/downloads/)
给 Spring Boot + MyBatis(-Plus) 项目做一份「框架感知代码地图」,再通过 MCP 协议喂给 AI 编程工具(Trae / Cursor / Claude Code 等)。
AI 编程工具改后端代码时,通常靠全文搜索去猜"这个接口调了谁、这条 SQL 碰了哪些表、改这个字段会炸哪条链路"——费 token、还容易幻觉。ContextGate 的思路是**离线预编译框架约定**:把 Spring 的隐式约定(路由注解、依赖注入、事务边界)和 MyBatis 的映射关系(Mapper → SQL → 表/列 → 实体)静态解析成结构化地图,AI 只需要调一个工具就能拿到压缩后的调用链和影响面。
为什么需要它
Spring Boot + MyBatis 项目的调用关系大量是**隐式约定**:一个 HTTP 请求要经过 `@RequestMapping` → Controller → `@Autowired` 注入的 Service → `BaseMapper` → SQL,中间没有任何一处显式 import 能把它们串起来。AI 每次都得翻七八个文件才能拼出一条链。
而通用代码索引看不懂这些"框架黑话"。三个最直接的痛点:
- 改字段不知道会炸哪:改一个实体字段(如
walletBalance)前,要人工找出所有读写它的 SQL 和接口——显式注解 SQL 好查,MyBatis-Plus 的selectById/insert这种隐式全行读写最容易漏。ContextGate 在真实项目上的实测:工具找出的波及路由比人工排查多出约一半,多出来的全是走 MP 内置 CRUD 的链路。 - 事务边界靠脑补:
@Transactional闭包里调了哪些写操作、回滚影响什么,工具直接标在调用链上。 - AI 会幻觉:工具返回的是从源码数出来的事实(路由、Mapper 方法、SQL 全文、触碰列都有出处),AI 没法编造不存在的方法或路径。
**定位是"窄而深"**:不做通用代码 RAG,只做 Spring Boot + MyBatis 这一个垂直,但把框架语义做到列级(`o.*` 星号展开、JOIN 列精确归因、MP 内置方法全列触碰)。框架约定越重的项目,通用工具越吃力,这个垂直线索的价值越大。
和现有方案的差异
| 方案 | 强在哪 | ContextGate 的不同 |
|---|---|---|
| 全量代码 RAG(embedding) | 语言无关、什么代码都能塞 | 召回靠相似度,不懂事务边界、SQL 触碰列、MP 隐式 CRUD——这些框架语义完全不知道 |
| LSP 符号索引(定义跳转/引用) | 显式调用关系精确 | 注解注入、BaseMapper 内置方法、SELECT */XML SQL 都是"字符串/约定",不在符号层,全部盲区 |
| AI 编码工具自带的代码搜索 | 零配置 | 每次对话全量 grep,token 贵、结果靠 AI 临场推理,同一个问题每次重新推 |
不是替代关系:工具给主干(调用链、影响面),AI 再用源码搜索补边角(如 JdbcTemplate 裸 SQL)。
它能做什么
- 调用链追踪:
GET /api/v1/orders/my→ Controller → Service → Mapper → SQL 全文,含@Transactional事务边界标记 - SQL 反查:按 Mapper 方法名 / 表名 / 列名片段搜 SQL,给出 SQL 全文、涉及表、触碰列、上游调用者和路由
- 变更影响面:改实体/字段前查出波及的自定义 SQL、MyBatis-Plus 内置 CRUD 调用点(
selectById=SELECT * 全列触碰)、上游路由 - 一键刷新:代码改完让
Related Skills
Secnews
面向 AI + 安全从业者的单人本地工作站: Sentinel Terminal 三层工作流 (Data 采集 / Judge 评估 / Action 执行) · llm-wiki-2.0 wiki-first 知识库
Usc Econ AI Workshop
Materials and code from USC Economics Department AI workshops (Spring 2026). Hands-on sessions on GPT for data
Hutchdb
A database for AI agents. No schema, SQL, or structure required. Claude Code, Codex, Cursor, Hermes, Claw, Gro
AI Data Extraction
extract all your personal data history from cursor, codex, claude-code, windsurf, and trae
Token Usage
Local LLM token usage analytics for Claude, Codex, OpenCode, ZCode, WorkBuddy, and Zhipu-AutoClaw — build your
Figma UI MCP
AI can draw UI directly on the Figma canvas via JavaScript, and read existing designs back as structured data.
Related Agents
Spring Boot Engineer
Chatforyou Backend Expert
chatforyou-dev-team의 백엔드 전문가. Spring Boot 백엔드 설계·분석·개발(요청 시)·프로덕션 코드 컨벤션 검증을 담당하며, 구현한 메서드에 대한 간단한 Service 레이어
Be Springboot Expert
Expert Spring Boot 4.0 developer for enterprise-grade Java 25 LTS applications. Use for Spring Boot projects,