nestjs-oop-design-patterns
Refactor NestJS Code with Pragmatic Design Patterns
Unclear responsibilities and unnecessary abstractions make NestJS code difficult to change and test. This skill guides evidence-based object design, pattern selection, and behavior-preserving refactoring.
使用我的智能体安装
将此请求复制给你的智能体,其中包含权威 Skill 页面和清单。
Review the Skillstore skill "nestjs-oop-design-patterns" from https://skillstore.io/skills/amirtaherkhani-nestjs-oop-design-patterns.md and its manifest at https://skillstore.io/api/skills/amirtaherkhani-nestjs-oop-design-patterns/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智能体仍应展示其计划,并按安全策略请求必要确认。
Agent 可读资源
当 AI Agent、爬虫或脚本需要干净上下文,而不是读取完整页面时,请使用这些链接。
测试它
正在使用“nestjs-oop-design-patterns”。 A checkout service validates orders, calls a payment SDK, and maps database rows.
预期结果:
- Role: The checkout use case coordinates order placement.
- Evidence: Vendor payment details and persistence mapping change for different reasons.
- Recommendation: Keep coordination in the use case and move vendor translation into an application-owned payment adapter.
- Trade-off: The adapter adds a boundary and requires contract tests.
- Verification: Preserve payment errors, order invariants, and provider wiring with focused tests.
正在使用“nestjs-oop-design-patterns”。 Should a service with one stable pricing rule use Strategy?
预期结果:
- Evidence: Only one pricing algorithm exists, with no accepted requirement for another.
- Recommendation: Keep the direct implementation rather than adding interchangeable policy classes.
- Verification: Test pricing behavior and invariants through the public operation.
正在使用“nestjs-oop-design-patterns”。 Does an in-process event guarantee publication after a database commit?
预期结果:
- Finding: In-process notification does not provide durable delivery across crashes or replicas.
- Recommendation: Consider a transactional outbox when external consumers must reliably observe committed changes.
- Trade-off: A relay requires retries, retention, ordering decisions, and idempotent consumers.
安全审计
安全All 25 static findings are false positives involving ordinary design guidance, Markdown identifiers, or headings. Backticks mark inline code, and the reconnaissance matches contain no system enumeration instructions. No evidence found of prompt injection, credential theft, unauthorized execution, or data exfiltration in the reviewed passages and surrounding files.
风险因素
分享与引用此报告
分享版本化评估报告、中性徽章、嵌入卡片和引用。Skillstore 只报告证据,不判断该 Skill 是否安全。
复制报告链接
https://skillstore.io/skills/amirtaherkhani-nestjs-oop-design-patterns/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/amirtaherkhani-nestjs-oop-design-patterns?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/amirtaherkhani-nestjs-oop-design-patterns?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/amirtaherkhani-nestjs-oop-design-patterns/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/amirtaherkhani-nestjs-oop-design-patterns.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学术引用 (APA · BibTeX · CFF)
APA 引用
amirtaherkhani. (2026). nestjs-oop-design-patterns security audit report (audit version 1) [Author version 1.0.2]. Skillstore. https://skillstore.io/skills/amirtaherkhani-nestjs-oop-design-patterns/audits/1BibTeX 引用
@techreport{amirtaherkhani-amirtaherkhani-nestjs-oop-design-patterns-2026,
author = {amirtaherkhani},
title = {nestjs-oop-design-patterns security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/amirtaherkhani-nestjs-oop-design-patterns/audits/1},
note = {Author version 1.0.2}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "nestjs-oop-design-patterns security audit report (audit version 1)"
version: "1.0.2"
type: report
authors:
- name: "amirtaherkhani"
date-released: "2026-10-04"
url: "https://skillstore.io/skills/amirtaherkhani-nestjs-oop-design-patterns/audits/1"
identifiers:
- type: other
value: "skillstore:amirtaherkhani-nestjs-oop-design-patterns:audit:1"
description: "Skillstore immutable audit report identifier"
Skillstore 评分
评分依据 证据置信度: 中你能构建什么
Review an overloaded service
Identify unrelated responsibilities and propose a small refactor that preserves behavior and public contracts.
Choose a provider integration pattern
Compare direct integration, Adapter, and Strategy using vendor coupling, variation, and substitution requirements.
Plan contract-focused verification
Define tests for invariants, adapter substitution, Nest provider wiring, and transport behavior before refactoring.
试试这些提示
Review [class] and its callers. Explain its role, responsibilities, and one concrete design concern without editing files.
Compare a direct solution, Strategy, and Factory for [observed variation]. Recommend one using repository evidence and explain its testing cost.
Refactor [service] to separate [misplaced responsibility]. Preserve public behavior and user changes, add focused tests, and verify Nest provider wiring.
Review [workflow] for adapter substitution, transaction boundaries, and event delivery guarantees. Compare direct coordination with outbox or saga designs and specify contract tests.
最佳实践
- Inspect callers, tests, module wiring, and repository conventions before selecting a pattern.
- State the concrete problem, simpler alternative, and added cost before introducing an abstraction.
- Preserve behavior with focused tests and verify contracts and provider wiring after refactoring.
避免
- Adding interfaces, factories, repositories, or class hierarchies without real variation or a useful boundary.
- Judging design only by line counts or applying fixed size limits as mandatory rules.
- Assuming CQRS dispatch, in-process events, or pattern names provide durability or scalability.
常见问题
Which projects does this skill target?
Does every class need an interface?
Will it always recommend a design pattern?
Are the related NestJS skills required?
Which tests should accompany a refactor?
Does a Nest event bus guarantee durable delivery?
开发者详情
许可证
MIT
作者版本
v1.0.2
Skillstore 修订
r1
引用
c97a1862d1bc82763903ee068cd15acab35d638c
维护新鲜度
2026/10/5
使用量
0 次下载 · 0 次浏览