Agent Skills › CanyonCodeCoreAI/canyonos › python-systems

python-systems

GitHub

指导Python服务、CLI及分布式系统的正确设计,涵盖并发处理、重试机制、中断恢复及进程生命周期管理。强调利用现有平台原语而非引入新框架,确保状态持久化、幂等性及明确的错误边界。

.agents/skills/python-systems/SKILL.md CanyonCodeCoreAI/canyonos

Trigger Scenarios

设计或重构Python后端服务 开发Python CLI工具 处理分布式系统中的并发与重试逻辑 审查Python代码的健壮性与恢复能力

Install

npx skills add CanyonCodeCoreAI/canyonos --skill python-systems -g -y
More Options

Non-standard path

npx skills add https://github.com/CanyonCodeCoreAI/canyonos/tree/main/.agents/skills/python-systems -g -y

Use without installing

npx skills use CanyonCodeCoreAI/canyonos@python-systems

指定 Agent (Claude Code)

npx skills add CanyonCodeCoreAI/canyonos --skill python-systems -a claude-code -g -y

安装 repo 全部 skill

npx skills add CanyonCodeCoreAI/canyonos --all -g -y

预览 repo 内 skill

npx skills add CanyonCodeCoreAI/canyonos --list

SKILL.md

Frontmatter
{
    "name": "python-systems",
    "description": "Design, change, or review Python services, workers, CLIs, and distributed runtime behavior. Use for process lifecycles, shared state, concurrency, recovery, configuration, and operational boundaries."
}

Python Systems

Make the system correct when work is concurrent, retried, interrupted, or run in more than one process. Prefer ordinary synchronous Python and the platform's existing primitives over a new framework or local coordination scheme.

Choose the owner before writing code

Ask in this order:

  1. Which process or boundary owns the decision, lifecycle, and recovery?
  2. Can the database, queue, lock, supervisor, or existing service make the invariant durable?
  3. Is a request-path change necessary, or can asynchronous coordination own it?

Keep request paths small. Put bookkeeping, reconciliation, aggregation, and cleanup in the durable owner rather than every request handler. Do not introduce an in-process cache, thread, identifier scheme, or retry loop when an existing owner can be extended.

Design for interruption and retries

  • Treat process memory as one replica's view. Put shared state and transitions in a durable system with an atomic operation, uniqueness constraint, or lock when they can race.
  • A multi-system operation can partially succeed. Define ordering, idempotency, and a way to recover or converge before claiming it is atomic.
  • Bound network calls and retries. Retry only transient operations that are safe to repeat; preserve the original failure when recovery is not possible.
  • Give background work explicit ownership, shutdown behavior, failure logging, and cleanup. A loop must not silently die after one failed iteration.

Keep contracts local and explicit

  • Validate input at the boundary; keep domain rules near the domain contract. Reuse authoritative schemas, configuration, logging, and process-management utilities rather than duplicating them.
  • Catch errors only to recover or translate a boundary failure. Do not turn failures into success-shaped defaults or log secrets and full request bodies.
  • Make CLI output and public errors actionable: identify the failed operation and the safe next step without exposing implementation internals.

Verify the actual boundary

Exercise the changed command, worker, service, or integration with failure and restart conditions relevant to the change. Report the checks that ran and the ones that require unavailable infrastructure.

For CanyonOS Python changes, read the repository reference before editing: it contains maintained module owners, package constraints, and area-specific commands.

Version History

  • 49e9bd0 Current 2026-11-13 18:19

Same Skill Collection

.agents/skills/api-dev/SKILL.md
.agents/skills/architecture/SKILL.md
.agents/skills/cc-pr-review/SKILL.md
.agents/skills/code-review/SKILL.md
.agents/skills/diagnosing-bugs/SKILL.md
.agents/skills/testing/SKILL.md
.agents/skills/ui-dev/SKILL.md
skills/converting-to-canyonos/SKILL.md
skills/prompt-management/SKILL.md
skills/scaling-agents/SKILL.md

Metadata

Files
0
Version
49e9bd0
Hash
f2c26144
Indexed
2026-11-13 18:19

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-15 14:32
浙ICP备14020137号-1