跳转到正文
报告库
用途分类 / 开发辅助

Architecture Patterns Skill 安全审计

作者说它能做什么(原文)

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.

第三方安全检查结论

发现安全风险

已检查文件
3
发现的风险
2
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
低风险

依赖检查步骤要求安装未固定版本的第三方 Python 包

原文依据:1 处
发现了什么

引用文件明确让用户运行 pip install pydeps,但没有固定版本、哈希或隔离环境。安装会从所配置的软件源取得并执行包的安装过程。

为什么需要注意

若软件源、包版本或其依赖发生问题,可能改变当前 Python 环境,或执行并非用户预期的第三方安装代码。

该内容位于参考文档的 fenced bash 示例中,是供用户手动执行的检查步骤,不会由 Skill 自动运行。它明确建议执行未固定版本和哈希的 `pip install pydeps`;若用户照做,pip 会从其配置的软件源获取并安装包,风险取决于软件源、环境隔离和当时解析出的版本。用户可要求作者固定并校验版本,或将安装限制在一次性虚拟环境/容器中,并先核验软件源与包来源。

references/advanced-patterns.md:385来自说明文档打开原文件
Visual dependency check — run this and look for any arrow pointing outward:```bash# Install: pip install pydepspydeps app --max-bacon=4 --cluster --rankdir=BT# Expected: domain has no outgoing edges to adapters or infrastructure```
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。未发现风险
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。发现 1 项风险
中风险

支付示例可能在订单保存前完成真实扣款,重试还可能重复收费

原文依据:2 处
发现了什么

下单流程先调用支付网关扣款,随后才标记并保存订单。Stripe 适配器直接调用真实的 Charge.create,且示例没有传递幂等键或展示失败补偿。

为什么需要注意

若保存订单或发送通知在扣款后失败,客户可能已付款但系统没有完整订单;调用方重试同一请求时,可能再次扣款。

这是“worked examples”中的示例代码,不会仅因安装 Skill 而自动执行;但如果用户把该流程用于生产,`place_order` 会先调用支付端口扣款,之后才标记并保存订单,而生产适配器会调用 Stripe 的 `Charge.create`。所示代码未展示幂等键、扣款失败后的持久化处理或保存失败后的退款补偿,因此保存失败或重试时可能出现已扣款但无订单、或重复收费。用户可要求作者补充幂等支付、事务边界及补偿方案,并限制示例在这些保障完成前连接真实支付凭据。

references/details.md:207来自说明文档打开原文件
    async def place_order(self, order: Order) -> OrderResult:        if not order.is_valid():            return OrderResult(success=False, error="Invalid order")        payment = await self.payments.charge(amount=order.total, customer=order.customer_id)        if not payment.success:            return OrderResult(success=False, error="Payment failed")        order.mark_as_paid()        saved_order = await self.orders.save(order)        await self.notifications.send(            to=order.customer_email,            subject="Order confirmed",            body=f"Order {order.id} confirmed",        )        return OrderResult(success=True, order=saved_order)
查看另外 1 个位置
references/details.md:239来自说明文档打开原文件
# Production adapter: Stripeclass StripePaymentAdapter(PaymentGatewayPort):    def __init__(self, api_key: str):        import stripe        stripe.api_key = api_key        self._stripe = stripe    async def charge(self, amount: Money, customer: str) -> PaymentResult:        try:            charge = self._stripe.Charge.create(                amount=amount.cents, currency=amount.currency, customer=customer            )            return PaymentResult(success=True, transaction_id=charge.id)

Skill 逻辑拆解

7 个说明模块

该 Skill 是架构指导材料,目标是为后端服务生成分层结构、依赖规则、接口和测试边界;主文件还要求在需要更多细节时阅读两个引用文件。

查看原文
SKILL.md:10来自说明文档打开原文件
**Given:** a service boundary or module to architect.**Produces:** layered structure with clear dependency rules, interface definitions, and test boundaries.
SKILL.md:70来自说明文档打开原文件
## Detailed patterns and worked examplesDetailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
SKILL.md:153来自说明文档打开原文件
## Advanced PatternsFor detailed DDD bounded context mapping, full multi-service project trees, Anti-Corruption Layer implementations, and Onion Architecture comparisons, see:- [`references/advanced-patterns.md`](references/advanced-patterns.md)

大部分内容是说明和示例代码;测试部分明确使用内存存储库,避免真实数据库、Docker 和网络。

查看原文
SKILL.md:74来自说明文档打开原文件
## Testing — In-Memory AdaptersThe hallmark of correctly applied Clean Architecture is that every use case can be exercised in a plain unit test with no real database, no Docker, and no network:
SKILL.md:105来自说明文档打开原文件
async def test_create_user_succeeds():    repo = InMemoryUserRepository()    use_case = CreateUserUseCase(user_repository=repo)    response = await use_case.execute(CreateUserRequest(email="alice@example.com", name="Alice"))

引用材料也包含连接外部系统的生产型示例,包括通过可配置 URL 发起 HTTP 请求、创建 PostgreSQL 连接池和调用 Stripe 收款;这些片段本身不会自动运行。

查看原文
references/advanced-patterns.md:166来自说明文档打开原文件
    def __init__(self, base_url: str, http_client: httpx.AsyncClient):        self._base_url = base_url        self._http = http_client    async def get_product_snapshot(self, sku: str) -> ProductSnapshot:        response = await self._http.get(f"{self._base_url}/products/{sku}")        response.raise_for_status()        data = response.json()
references/advanced-patterns.md:244来自说明文档打开原文件
@lru_cachedef get_settings() -> Settings:    return Settings()async def get_db_pool() -> asyncpg.Pool:    settings = get_settings()    return await asyncpg.create_pool(settings.database_url)
references/details.md:239来自说明文档打开原文件
# Production adapter: Stripeclass StripePaymentAdapter(PaymentGatewayPort):    def __init__(self, api_key: str):        import stripe        stripe.api_key = api_key        self._stripe = stripe    async def charge(self, amount: Money, customer: str) -> PaymentResult:        try:            charge = self._stripe.Charge.create(                amount=amount.cents, currency=amount.currency, customer=customer            )            return PaymentResult(success=True, transaction_id=charge.id)
从这里开始 · 工作说明SKILL.md
architecture-patterns
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。

文件引用关系图

2 处引用
哪些文件发起引用引用了什么
连线表示真实的文件引用,不是运行顺序。点击节点可高亮相关连线,并查看具体文件和原文位置。虚线表示还有文件需要定位。
文件与检查记录3 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文
  • references/advanced-patterns.md已纳入全文
  • references/details.md已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明
  • references/advanced-patterns.md配套文件
  • references/details.md配套文件

代码和说明中提到的操作

读取文件
SKILL.md:72来自说明文档打开原文件
Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
连接外部网站
references/advanced-patterns.md:166来自说明文档打开原文件
    def __init__(self, base_url: str, http_client: httpx.AsyncClient):        self._base_url = base_url
运行命令
references/advanced-patterns.md:387来自说明文档打开原文件
```bash# Install: pip install pydeps
安装其他软件包
references/advanced-patterns.md:388来自说明文档打开原文件
```bash# Install: pip install pydepspydeps app --max-bacon=4 --cluster --rankdir=BT
读取密钥或账号配置
references/details.md:241来自说明文档打开原文件
class StripePaymentAdapter(PaymentGatewayPort):    def __init__(self, api_key: str):        import stripe
references/details.md:243来自说明文档打开原文件
        import stripe        stripe.api_key = api_key        self._stripe = stripe
读取了多少行
893
文件校验值(用于核对版本)
f70b8d622613f0e6eeed0a5d8cd75c3f0aa5d548dbc304a12f6e1f74c17faf7d