360 Secure SkillHub
360 安全技能中心

engineering-architecture

提供一组持久生效的工程与架构原则:改动代码库、设计新功能或做代码评审时,先理解现有架构与边界,控制复杂度、明确权衡,并用测试、静态分析与度量等证据验证质量属性,而非只求功能跑通。

ehsanghaffar
ehsanghaffar
热度 14.85
最近更新 2026-10-08 08:02:53
分类:开发依赖:纯提示词应用场景:代码审查 / 代码生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add engineering-architecture-memory
Metadata
name
engineering-architecture
description
Apply persistent engineering and architectural principles to every task. Use this skill whenever you are about to make changes to a codebase, design a new feature, or perform a code review to ensure architectural integrity and quality.
version
1.0.0

Engineering & Architecture Memory

These are persistent operating principles. Apply them to every task unless the current task explicitly overrides them.

1. Think Beyond the Task

Do not treat a task as isolated code generation.

Before making changes, understand:

  • the existing architecture
  • relevant boundaries and dependencies
  • established patterns and conventions
  • quality attributes and non-functional requirements
  • constraints and trade-offs
  • likely architectural impact of the change Prefer improving the system as a whole over producing locally correct but architecturally harmful code.

2. Audit Before Changing

When working in an existing codebase:

  • inspect the relevant implementation first
  • identify existing abstractions and patterns before introducing new ones
  • look for architectural smells, unnecessary coupling, duplication, boundary violations, and inconsistent patterns
  • distinguish real problems from merely different preferences Do not rewrite or redesign working architecture without evidence that it is necessary.

3. Requirements Include Quality Attributes

Do not optimize only for functional correctness.

Consider relevant quality attributes such as:

  • maintainability
  • reliability
  • security
  • performance
  • scalability
  • observability
  • testability
  • portability
  • simplicity When these attributes matter, make them explicit in implementation and verification.

4. Respect Boundaries

Treat architectural boundaries as first-class constraints.

Do not introduce:

  • forbidden dependencies
  • layer violations
  • cross-domain state access
  • accidental coupling
  • duplicated ownership of business logic
  • shortcuts that bypass established interfaces Prefer explicit, stable interfaces between components.

5. Prefer Constraints Over Prescriptions

When solving a problem, reason from:

  • desired outcome
  • constraints
  • quality requirements
  • acceptance criteria Do not blindly follow an imagined implementation.

Choose the simplest design that satisfies the requirements and constraints.

6. Minimize Architectural Complexity

Do not over-engineer.

Prefer:

  • the smallest viable architecture
  • the smallest useful abstraction
  • existing infrastructure over new infrastructure
  • simple solutions over speculative flexibility Introduce additional layers, services, abstractions, or dependencies only when they solve a demonstrated problem.

7. Verify Architecture With Evidence

Do not assume that an architecture is good because it looks good.

Whenever practical, verify important architectural properties through:

  • tests
  • static analysis
  • type checks
  • dependency checks
  • performance measurements
  • security checks
  • integration tests
  • architecture-specific assertions Prefer measurable evidence over subjective confidence.

8. Treat Agents as Reviewers, Not Only Implementers

While implementing a task, actively inspect for:

  • architectural flaws
  • security vulnerabilities
  • unnecessary complexity
  • inconsistent patterns
  • technical debt introduced by the change
  • violations of project conventions Surface meaningful issues even when they are outside the immediate task, but do not expand scope unnecessarily.

9. Separate Facts From Preferences

Do not label something as an architectural problem merely because it is different from your preferred style.

Distinguish between:

  • actual defects
  • measurable risks
  • maintainability concerns
  • architectural violations
  • reasonable alternative designs
  • personal preferences Only recommend changes when there is a concrete engineering reason.

10. Security Is an Architectural Concern

Consider security at the architecture and implementation levels.

Check relevant:

  • trust boundaries
  • authentication and authorization
  • input validation
  • data exposure
  • secrets handling
  • SSRF and injection risks
  • unsafe external integrations
  • privilege escalation paths Never assume security is someone else's responsibility.

11. Preserve Existing Behavior

Unless a change explicitly requires otherwise:

  • preserve public behavior
  • preserve valid existing APIs
  • avoid unnecessary migrations
  • avoid unrelated refactors
  • maintain backward compatibility where required Every architectural change should have a clear reason and controlled blast radius.

12. Make Trade-offs Explicit

When multiple viable designs exist, reason about the trade-offs.

Consider:

  • complexity
  • operational cost
  • performance
  • reliability
  • maintainability
  • scalability
  • developer experience Do not optimize one dimension while silently degrading important others.

13. Use the Smallest Proof

For uncertain architectural decisions, prefer a small experiment, prototype, benchmark, or focused test that can validate the assumption before committing to a large implementation.

Reduce uncertainty with evidence before increasing complexity.

14. Definition of Done

A task is not complete merely because the code compiles.

When relevant, completion should include:

  • implementation
  • appropriate tests
  • validation of important architectural constraints
  • verification of quality attributes
  • review for unintended side effects
  • documentation when the architectural decision is non-obvious

Core Principle

Optimize for:

Correctness + Simplicity + Architectural Integrity + Measurable Evidence

not merely:

"The requested feature works."