prime-backend
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePrime Backend: Load Backend Context
Prime Backend:加载后端上下文
Objective
目标
Build targeted understanding of the backend codebase by analyzing its structure, routes, services, and data layer. Loading only backend context keeps the context window light on complex full-stack codebases. If external task references are provided, load them first so the analysis is anchored to the actual work.
通过分析后端代码库的结构、路由、服务和数据层,建立对其的针对性理解。在复杂的全栈代码库中,仅加载后端上下文可保持上下文窗口轻量化。如果提供了外部任务参考,请先加载这些内容,以便分析能锚定实际工作需求。
Process
流程
Step 0: Load External Context
步骤0:加载外部上下文
Run this step BEFORE the codebase analysis. It accepts optional arguments: .
[jira-issue-keys] [confluence-page-ids]- Jira keys may be a single key () or comma-separated (
ACC-2).ACC-2,ACC-3 - Confluence page ids are numeric page ids.
If Jira issue keys are provided:
- Call to obtain the
mcp__atlassian__getAccessibleAtlassianResources.cloudId - For each Jira key, call with that
mcp__atlassian__getJiraIssue, the issue key, andcloudId.responseContentFormat: "markdown" - Treat the returned issue summary, description, and acceptance criteria as the task context for everything that follows.
If Confluence page ids are provided:
- Call for each page id with
mcp__atlassian__getConfluencePage(use thecontentFormat: "markdown"from above, fetching it viacloudIdif it was not already retrieved).mcp__atlassian__getAccessibleAtlassianResources - Treat the returned page content as supporting context (specs, design docs, requirements).
If no arguments are provided: Skip this step entirely and proceed to Step 1.
Briefly summarize any external context loaded before continuing — this frames the rest of the priming.
在代码库分析之前运行此步骤。 它接受可选参数:。
[jira-issue-keys] [confluence-page-ids]- Jira密钥可以是单个密钥()或逗号分隔的多个密钥(
ACC-2)。ACC-2,ACC-3 - Confluence页面ID是数字格式的页面ID。
如果提供了Jira工单密钥:
- 调用获取
mcp__atlassian__getAccessibleAtlassianResources。cloudId - 针对每个Jira密钥,调用,传入
mcp__atlassian__getJiraIssue、工单密钥以及cloudId。responseContentFormat: "markdown" - 将返回的工单摘要、描述和验收标准作为后续所有操作的任务上下文。
如果提供了Confluence页面ID:
- 针对每个页面ID调用,并设置
mcp__atlassian__getConfluencePage(如果尚未获取contentFormat: "markdown",可通过cloudId获取)。mcp__atlassian__getAccessibleAtlassianResources - 将返回的页面内容作为支持上下文(规范、设计文档、需求说明)。
如果未提供任何参数: 完全跳过此步骤,直接进入步骤1。
在继续之前简要总结已加载的所有外部上下文——这将为后续的准备工作奠定框架。
1. Locate the Backend
1. 定位后端
List all tracked files to find the backend root:
!
git ls-filesCommon backend roots: , , , (FastAPI/Django), (when project is backend-only). Identify the correct root before proceeding.
backend/server/api/app/src/列出所有被追踪的文件以找到后端根目录:
!
git ls-files常见的后端根目录:、、、(FastAPI/Django项目)、(当项目仅为后端时)。在继续之前先确定正确的根目录。
backend/server/api/app/src/2. Read Backend Documentation
2. 阅读后端文档
- Read CLAUDE.md or similar global rules file (for project-wide conventions)
- Read any README inside the backend root
- Read if it exists — it contains project-specific API conventions
.claude/references/backend-api-best-practices.md
- 阅读CLAUDE.md或类似的全局规则文件(了解项目范围的约定)
- 阅读后端根目录内的任何README文件
- 如果存在,请阅读该文件——它包含项目特定的API约定
.claude/references/backend-api-best-practices.md
3. Identify Key Backend Files
3. 识别关键后端文件
Based on the structure, read:
- Main entry point (,
main.py,app.py,server.ts, etc.)index.ts - Route registration / router index (,
routes/,api/)routers/ - Core configuration (,
pyproject.toml,package.json)tsconfig.json - Database configuration and ORM setup (,
database.py,db.ts)alembic.ini - Core data models or schemas (,
models/)schemas/ - One or two representative feature slices (route + service + model) to internalize established patterns
- Middleware and dependency injection setup
Skip files outside the backend root unless they define a shared type or contract the backend exposes.
根据结构,阅读以下文件:
- 主入口文件(、
main.py、app.py、server.ts等)index.ts - 路由注册/路由索引文件(、
routes/、api/)routers/ - 核心配置文件(、
pyproject.toml、package.json)tsconfig.json - 数据库配置和ORM设置文件(、
database.py、db.ts)alembic.ini - 核心数据模型或模式文件(、
models/)schemas/ - 一到两个具有代表性的功能切片(路由+服务+模型),以熟悉已确立的模式
- 中间件和依赖注入设置文件
除非文件定义了后端暴露的共享类型或契约,否则跳过后端根目录之外的文件。
4. Understand Current Backend State
4. 了解当前后端状态
Check recent backend-relevant activity:
!
git log -10 --oneline!
git statusNote any open migrations, pending schema changes, or in-progress API changes.
检查近期与后端相关的活动:
!
git log -10 --oneline!
git status记录任何未完成的迁移、待处理的模式变更或正在进行的API变更。
Output Report
输出报告
Provide a concise summary covering:
提供一份简洁的摘要,涵盖以下内容:
External Task Context (if loaded)
外部任务上下文(如果已加载)
- Jira issue(s): key, title, one-line goal, acceptance criteria
- Confluence page(s): title and what they specify
- Jira工单:密钥、标题、一行式目标、验收标准
- Confluence页面:标题及其内容说明
Backend Overview
后端概述
- Framework and major libraries (FastAPI, Django, Express, NestJS, etc.)
- Language and runtime version
- Database and ORM (PostgreSQL + SQLAlchemy, MongoDB + Mongoose, etc.)
- 框架和主要库(FastAPI、Django、Express、NestJS等)
- 语言和运行时版本
- 数据库和ORM(PostgreSQL + SQLAlchemy、MongoDB + Mongoose等)
Directory Map
目录结构
- Backend root and key sub-directories with one-line purpose each
- 后端根目录和关键子目录,每个目录附带一行说明其用途
Architecture Patterns
架构模式
- How routes, services, and data access are layered
- Dependency injection or middleware patterns observed
- Error handling approach
- 路由、服务和数据访问的分层方式
- 观察到的依赖注入或中间件模式
- 错误处理方法
Conventions
约定规范
- Naming conventions, module organization
- Migration tooling and current migration state
- Testing framework and conventions observed
- 命名约定、模块组织方式
- 迁移工具和当前迁移状态
- 观察到的测试框架和约定
Current State
当前状态
- Active branch, recent backend changes
- Any pending migrations or schema changes
- Any immediate concerns (missing validation, unhandled errors, etc.)
Make this summary easy to scan - use bullet points and clear headers.
- 活跃分支、近期后端变更
- 任何待处理的迁移或模式变更
- 任何即时需要关注的问题(缺少验证、未处理的错误等)
请让这份摘要易于浏览——使用项目符号和清晰的标题。