backend-core
FastAPI backend routes, auth credentials, data services, migrations, tests, and service-layer troubleshooting for Open Wearables.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- backend-core
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- FastAPI backend routes, auth credentials, data services, migrations, tests, and service-layer troubleshooting for Open Wearables.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-routes.md12.8 KB
- 参考文档references/data-model-and-services.md19.4 KB
- 参考文档references/troubleshooting.md13.9 KB
- 参考文档references/workflows.md14.6 KB
- 脚本scripts/check_backend_core.py19.8 KB
03 SKILL.md 正文
Backend Core
Use this sub-skill for Open Wearables FastAPI backend work: API routes, developer auth, API keys, SDK applications, users, connections, summaries, events, health scores, timeseries, sync status, seed data, outgoing webhooks, service/repository/model/schema patterns, configuration, migrations, Celery/Redis orchestration, and backend tests.
Route the task
- For endpoint families, auth requirements, route registration, OpenAPI/docs navigation, and API-change checklists, read api-routes.md.
- For data models, repositories, service layer patterns, schemas, summaries/events/timeseries flow, sync status, seed data, and outgoing webhook internals, read data-model-and-services.md.
- For concrete backend commands, local Docker/uv workflows, migrations, seeding, targeted pytest selection, and endpoint implementation steps, read workflows.md.
- For PostgreSQL/Redis/testcontainers, auth/API-key, Svix, AWS, Celery, OpenAPI, pagination/date, and migration failures, read troubleshooting.md.
- When a checkout is available, run the safe static checker before or after backend edits:
python skills/disco/open-wearables/sub-skills/backend-core/scripts/check_backend_core.py --repo-root .. Add--import-openapionly when backend dependencies and config are ready; it still avoids network and writes.
Boundaries
This sub-skill owns generic backend/API behavior. Route provider-specific OAuth, provider factory registration, coverage constants, vendor workout parsing, provider webhook parsing, historical backfill internals, and provider-specific import normalization to provider-integrations. Route React portal pages, API hooks, query keys, runtime frontend config, and UI presentation to frontend-portal. Route FastMCP tools, assistant configs, and MCP REST-client behavior to mcp-server.
When work crosses boundaries, keep the shared endpoint contract, auth, database schema, service/repository changes, migrations, and external API docs navigation here; ask the owning sibling sub-skill to handle provider internals or frontend/MCP callers.
Non-negotiable backend rules
- Preserve the route hierarchy: module routers are prefix-free, the v1 router attaches prefixes/tags, the head router attaches the API version prefix, and
app.mainincludes the head router. - Do not use trailing slash route roots on prefixed routers. Use
""for a prefixed router's root endpoint;"/"can create 307 redirects behind reverse proxies. - Keep route handlers thin. Validate/parse request inputs, call services, and return Pydantic response models; do not call repositories directly from routes.
- Keep repositories database-only and model-only. Pydantic schemas and business decisions belong in services or route schemas, not repository methods.
- Use SQLAlchemy 2.0
Mapped[...]model fields and the existingapp.mappingsaliases for IDs, FKs, constrained strings, dates, decimals, JSON, and relationships. - Use Pydantic v2 schema style with
ConfigDict(from_attributes=True)for ORM reads and schema defaults for generated IDs/timestamps where appropriate. - Protect public/external data APIs with
ApiKeyDepunless the route is intentionally token/SDK/OAuth/system-specific; protect dashboard/admin routes withDeveloperDep. - If you add, remove, rename, or retag an endpoint tagged
External: *, update the API Reference navigation indocs/docs.jsonin the same change. - Treat credentials as secrets. Never log API keys, JWTs, application secrets, provider OAuth tokens, Svix tokens, AWS keys, or master encryption material.
- Run focused backend quality checks after changes when dependencies are available: targeted
pytest,ruff check,ruff format --checkor format, andty checkfor type-impacting work.
Fast start for future agents
- Classify the task as route/API contract, data-service/model, background/sync/webhook, migration/config, test failure, or troubleshooting.
- Read the nearest reference in this sub-skill; avoid reopening source files unless you are implementing or verifying drift.
- For endpoint changes, update the route module, schemas, service, repository/model/migration if needed, route registration/tags, tests, and external API docs navigation together.
- For data ingestion or sync changes, verify the affected data-source identity, event/timeseries upsert semantics, sync-status events, and outgoing webhook side effects.
- Prefer the smallest safe test set first, then expand to the native candidate files listed in workflows.md when the change scope requires it.
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).