backend-services-api
Operate Nexent backend FastAPI app/service/database changes, environment constants, domain exceptions, auth and tenant permissions, prompt templates, and API orchestration.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- backend-services-api
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Operate Nexent backend FastAPI app/service/database changes, environment constants, domain exceptions, auth and tenant permissions, prompt templates, and API orchestration.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-service-map.md15.8 KB
- 参考文档references/backend-architecture.md13.0 KB
- 参考文档references/testing.md11.5 KB
- 参考文档references/troubleshooting.md11.7 KB
- 脚本scripts/list_fastapi_routes.py13.6 KB
03 SKILL.md 正文
Backend Services API
Use this sub-skill for Nexent backend work that changes or diagnoses FastAPI routes, service orchestration, database helpers, backend configuration constants, domain exceptions, tenant/auth permissions, prompt-template storage, agent/model/skill/repository/memory route wiring, or backend service entrypoints.
Route here when
- Adding, changing, or debugging a route under backend app modules such as
/agent,/skills,/model,/repository/*,/prompt*,/tenant*,/user*,/mcp*,/nb/*, or shared app construction. - Tracing an API failure across app endpoint, service function, domain exception, database helper, auth utility, or prompt-template synchronization.
- Adding a backend environment variable, version constant, error code, exception, request/response Pydantic model, tenant/role permission check, or database CRUD helper.
- Updating backend NL2Agent/NL2Skill orchestration, prompt-generation templates, service startup composition, or route-to-service ownership.
- Selecting focused backend app/service pytest cases and mocks for route, service, auth, and database boundaries.
Route elsewhere
- Direct SDK agent/model/tool usage,
AgentConfig,ModelConfig, streaming SDK internals, MCP transport semantics, sandbox policy, scheduler primitives, or SDK skill-manager details:../sdk-agent-runtime/SKILL.md. - Deep document ingestion, vector database implementation, storage, knowledge-base retrieval, memory records/retrieval/dreaming, Redis/Elasticsearch/MinIO live behavior, or data-process worker details:
../knowledge-data-memory/SKILL.md. - Next.js service clients, TypeScript contracts, chat UI streaming components, stores, i18n, or frontend build issues:
../frontend-integration/SKILL.md. - Docker/Kubernetes/offline deployment, SQL migration/init synchronization, env-file deployment ownership, image builds, runtime operations, or uninstall/upgrade scripts:
../deployment-operations/SKILL.md.
Operating procedure
- Read
references/backend-architecture.mdfor the layer contract, environment-variable source of truth, exception flow, tenant/auth rules, prompt-template ownership, and safe entrypoint reasoning. - Read
references/api-service-map.mdto identify the route family, app module, service owner, likely database helper, and boundary handoff before editing code. - Use
scripts/list_fastapi_routes.pyto statically inventory backend app routes from a checkout without importing the backend or starting services. - Read
references/testing.mdbefore selecting app/service tests or mocks. Patch dependencies at the module lookup site and avoid live external services unless a test explicitly provisions them. - Read
references/troubleshooting.mdwhen an import, route, permission, exception envelope, startup hook, prompt template, or service dependency behaves unexpectedly.
Non-negotiable backend rules
- Only backend constants may read environment variables. Add or change backend env vars in
backend/consts/const.py, import resolved constants elsewhere, and pass configuration to SDK code as parameters. - App modules parse/validate HTTP input, derive auth context, call services, map domain exceptions to HTTP responses, and preserve existing route shapes. Do not put core business logic in an app endpoint.
- Services orchestrate business logic, database helpers, SDK calls, and external clients. Do not raise
HTTPExceptionor return FastAPI/Starlette responses from service code. - Database helpers use
get_db_session()as the transaction boundary, useTableBaseaudit fields for ordinary tables, soft-delete withdelete_flag='Y', and do not manually commit, rollback, or close sessions. - Domain exceptions belong in
backend/consts/exceptions.py; business error-code mappings belong inbackend/consts/error_code.pyand message mappings beside them. - Keep prompt-template YAML placeholders and language variants aligned. Startup sync stores the system default prompt template, so template schema changes require service and test updates.
- Unit and route tests must mock storage, database, Redis, Elasticsearch, model providers, network clients, and SDK agent execution unless the selected native case explicitly supplies those services.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).