robyn-config-backend-best-practices

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Robyn Config Backend Best Practices

Robyn Config 后端最佳实践

Overview and intent

概述与用途

Use this skill to work effectively with
robyn-config
and production-oriented Robyn backend patterns.
This skill is optimized for four task groups:
  • scaffold a new service with
    robyn-config create
  • extend an existing service with
    robyn-config add
  • audit and improve architecture and operational readiness
  • author high-quality skill files for Robyn engineering work
Do not load every reference file by default. Load only the files required for the current task.
本skill用于指导你高效使用
robyn-config
以及面向生产环境的Robyn后端模式。
本skill针对四类任务场景优化:
  • 使用
    robyn-config create
    搭建新服务
  • 使用
    robyn-config add
    扩展现有服务
  • 审计并优化架构与运维就绪性
  • 为Robyn工程工作编写高质量skill文件
默认不要加载所有参考文件,仅加载当前任务所需的文件。

Fast triage workflow

快速分类工作流

  1. Detect project metadata in
    pyproject.toml
    :
    • [tool.robyn-config].design
      (
      ddd
      or
      mvc
      )
    • [tool.robyn-config].orm
      (
      sqlalchemy
      or
      tortoise
      )
    • [tool.robyn-config].package_manager
      (
      uv
      or
      poetry
      )
  2. Classify requested work:
    • bootstrap
    • extension
    • architecture or operations audit
    • skill authoring
  3. Select references from the routing table in this file.
  4. Produce branch-specific guidance for design, ORM, and package manager.
  5. End with a validation checklist and concrete commands.
  1. pyproject.toml
    中检测项目元数据:
    • [tool.robyn-config].design
      ddd
      mvc
    • [tool.robyn-config].orm
      sqlalchemy
      tortoise
    • [tool.robyn-config].package_manager
      uv
      poetry
  2. 对需求任务进行分类:
    • 项目初始化
    • 项目扩展
    • 架构或运维审计
    • skill文档编写
  3. 从本文档的参考路由表中选择对应参考文件。
  4. 针对所选架构、ORM和包管理器提供分支专属指导。
  5. 最终输出验证清单与具体执行命令。

Workflow A: bootstrap from
robyn-config create

工作流A:使用
robyn-config create
初始化项目

  1. Select stack options: design, ORM, package manager.
  2. Generate service:
bash
robyn-config create <service-name> --design <ddd|mvc> --orm <sqlalchemy|tortoise> --package-manager <uv|poetry> <destination>
  1. Confirm output baseline:
    • pyproject.toml
      contains
      [tool.robyn-config]
    • src/app
      layout matches selected design
    • lock file matches package manager (
      uv.lock
      or
      poetry.lock
      )
  2. Execute ORM-specific migration bootstrap before app start.
  3. Run lint, type checks, and tests, then report exact failures with file paths.
  1. 选择技术栈选项:架构、ORM、包管理器。
  2. 生成服务:
bash
robyn-config create <service-name> --design <ddd|mvc> --orm <sqlalchemy|tortoise> --package-manager <uv|poetry> <destination>
  1. 确认输出基线:
    • pyproject.toml
      中包含
      [tool.robyn-config]
      配置
    • src/app
      目录结构与所选架构匹配
    • 锁文件与所选包管理器一致(
      uv.lock
      poetry.lock
  2. 在启动应用前执行ORM专属的迁移初始化操作。
  3. 运行代码检查、类型校验与测试,并附带文件路径报告具体失败项。

Workflow B: evolve project with
robyn-config add

工作流B:使用
robyn-config add
演进项目

  1. Ensure target project is a
    robyn-config
    project by checking
    [tool.robyn-config]
    .
  2. Read optional path overrides under
    [tool.robyn-config.add]
    .
  3. Add module:
bash
robyn-config add <entity-name> <project-path>
  1. Verify generated updates:
    • new files in expected layer paths
    • route registration inserted in the right registry file
    • repository exports and tables updated
    • no duplicate symbols or broken imports
  2. Regenerate migrations if schema changed.
  3. Run checks and confirm command rollback behavior if failures occur.
  1. 通过检查
    [tool.robyn-config]
    配置确认目标项目是
    robyn-config
    项目。
  2. 读取
    [tool.robyn-config.add]
    下的可选路径覆盖配置。
  3. 添加模块:
bash
robyn-config add <entity-name> <project-path>
  1. 验证生成的更新内容:
    • 新文件位于预期的分层路径中
    • 路由注册已插入正确的注册表文件
    • 仓库导出与数据表已更新
    • 无重复符号或无效导入
  2. 若数据库 schema 变更则重新生成迁移文件。
  3. 运行检查,并确认失败时的命令回滚行为。

Workflow C: review and improve architecture and ops readiness

工作流C:评审与优化架构及运维就绪性

  1. Validate architecture boundaries for selected design.
  2. Validate runtime safety:
    • settings and env overrides
    • auth, session, CORS behavior
    • transaction boundaries and error mapping
  3. Validate operations:
    • migration startup order
    • compose and local parity
    • logging and debug posture
  4. Prioritize recommendations:
    • P0 correctness and security
    • P1 reliability and consistency
    • P2 maintainability and performance
  5. Provide file-targeted, diff-ready changes.
  1. 验证所选架构的边界合规性。
  2. 验证运行时安全性:
    • 配置与环境变量覆盖逻辑
    • 认证、会话、CORS行为
    • 事务边界与错误映射
  3. 验证运维就绪性:
    • 迁移启动顺序
    • Docker Compose与本地环境一致性
    • 日志与调试模式
  4. 对建议进行优先级排序:
    • P0:正确性与安全性
    • P1:可靠性与一致性
    • P2:可维护性与性能
  5. 提供针对具体文件、可直接生成diff的修改建议。

Workflow D: author and update skill files for Robyn engineering

工作流D:编写与更新Robyn工程相关的skill文件

  1. Keep
    SKILL.md
    concise and procedural.
  2. Put deep detail into
    references/
    and load on demand.
  3. Write frontmatter with explicit trigger contexts.
  4. Reuse rule patterns from
    react-best-practices
    where useful.
  5. Validate skill structure before delivering:
    • no placeholder markers
    • all referenced files exist
    • no extra docs such as README or changelog inside skill folder
  1. 保持
    SKILL.md
    简洁且流程化。
  2. 将详细内容放入
    references/
    目录,按需加载。
  3. 编写包含明确触发场景的前置元数据。
  4. 在适用场景下复用
    react-best-practices
    中的规则模式。
  5. 交付前验证skill文件结构:
    • 无占位符标记
    • 所有引用文件均存在
    • skill目录内无README或变更日志等额外文档

Reference routing table

参考路由表

Open only the file needed for the task:
  • references/robyn-config-src-analysis.md
    • Use for
      robyn-config
      internals and generation/injection behavior.
  • references/robyn-backend-best-practices.md
    • Use for prioritized engineering guidance and review criteria.
  • references/robyn-config-workflows.md
    • Use for operator playbooks and command sequences.
  • references/architecture-ddd-vs-mvc.md
    • Use for architecture selection and refactor planning.
  • references/orm-sqlalchemy-vs-tortoise.md
    • Use for ORM tradeoffs and migration/session behavior.
  • references/skill-authoring-patterns.md
    • Use for writing and validating high-quality skill markdown.
  • references/react-style-rule-system.md
    • Use for reusable rule-library design patterns and taxonomy.
仅打开当前任务所需的文件:
  • references/robyn-config-src-analysis.md
    • 用于了解
      robyn-config
      内部实现与生成/注入逻辑。
  • references/robyn-backend-best-practices.md
    • 用于获取优先级排序的工程指导与评审标准。
  • references/robyn-config-workflows.md
    • 用于获取运维操作手册与命令序列。
  • references/architecture-ddd-vs-mvc.md
    • 用于架构选型与重构规划。
  • references/orm-sqlalchemy-vs-tortoise.md
    • 用于分析ORM选型权衡与迁移/会话行为。
  • references/skill-authoring-patterns.md
    • 用于编写与验证高质量的skill文档。
  • references/react-style-rule-system.md
    • 用于复用规则库设计模式与分类体系。

Output requirements

输出要求

Always:
  1. Include concrete executable commands.
  2. Include design and ORM branch-specific instructions.
  3. Include package-manager-aware instructions (
    uv
    and
    poetry
    ).
  4. Include a validation checklist covering structure, behavior, and checks.
  5. State assumptions explicitly when repository context is incomplete.
必须满足以下要求:
  1. 包含可直接执行的具体命令。
  2. 包含针对所选架构与ORM分支的专属说明。
  3. 包含适配包管理器的说明(
    uv
    poetry
    )。
  4. 包含覆盖结构、行为与检查项的验证清单。
  5. 当仓库上下文不完整时,明确说明假设条件。