AgentSkillsCN

architecture-guard

为本仓库严格执行Swift分层与边界安全规则。在源码/测试文件发生变更时、提交前、架构评审期间,或在检查重构是否引入了依赖方向违规,或是否在引擎领域代码中出现了直接的外部熵、时间或I/O使用时使用。

SKILL.md
--- frontmatter
name: architecture-guard
description: Enforce Swift layering and boundary safety rules for this repository. Use when source/test files change, before commit, during architecture reviews, or when checking whether a refactor introduced dependency-direction violations or direct external entropy/time/I/O usage in engine-domain code.

Architecture Guard

Run repository-level architecture checks with deterministic output.

Workflow

  1. Run staged checks before commit:
    • bash .codex/skills/architecture-guard/scripts/check_layering.sh --staged
  2. Fix all blockers ([ERROR]) first.
  3. Review warnings ([WARN]) and either fix or explain in PR notes.
  4. Optionally run a full scan when planning larger refactors:
    • bash .codex/skills/architecture-guard/scripts/check_layering.sh --all

What This Skill Checks

  • SwiftUI import leakage outside the presentation allowlist.
  • Direct entropy/time/I/O API usage in engine-domain candidate files:
    • Int.random, Bool.random, Date(), Date.now, UUID(), FileManager.default, URLSession, UserDefaults.standard.
  • Boundary-risk warnings:
    • Source changes without test changes in staged mode.
    • New public declarations in source files.

Scope Notes

  • --staged is the default mode and is intended for day-to-day commits.
  • --all is intentionally strict and may surface existing legacy debt.
  • Treat this skill as the enforcement tool for the architecture section in AGENTS.md.

References

  • Rule notes and migration intent: references/rules.md