define-architecture by mblode/agent-skills
npx skills add https://github.com/mblode/agent-skills --skill define-architecture为 TypeScript 应用定义持久耐用、易于更改的架构默认设置。
架构设置工作流。采用工作流。输出模板 生成架构简报。验证循环。仅在需要时加载参考:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
apps/ 存放可部署的界面(api、web、admin)。packages/ 存放共享库(shared、ui、icons、auth、proto)。handler:仅负责传输。service:业务编排。dao:仅负责数据库访问。mapper:数据库/协议/领域转换。constants 和 types:模块本地契约。使用基于 AsyncLocalStorage 的 RequestContext:
import { AsyncLocalStorage } from "node:async_hooks";
type RequestContext = { tenantId: string; userId: string; traceId: string }; const store = new AsyncLocalStorage<RequestContext>(); export const getContext = () => store.getStore()!; export const runWithContext = (ctx: RequestContext, fn: () => void) => store.run(ctx, fn);
在每个入口点(RPC、HTTP、作业、CLI)初始化上下文。
通过 getContext() 读取上下文;不要在业务函数中传递上下文参数。
要求每个 RPC 方法都有路由策略,并通过 registerServiceWithPolicies 注册服务。
将认证、日志记录、错误处理和上下文保留在共享中间件中。
"use client"。使用 references/stack-defaults.md 作为默认基线。仅在约束条件要求时才进行偏离。
在最终确定架构决策前运行此循环:
npm run lintnpm run check-typesnpm run test --workspace=<pkg>(或等效的针对性测试)使用此结构来撰写架构建议:
# 架构简报
## 上下文与约束
## 仓库结构
## 后端模块契约
## 请求上下文与中间件策略
## 前端边界
## 测试策略
## 发布与回滚计划
## 开放风险与后续事项
ui-audit 进行最终的 UI 质量检查。ui-animation 获取特定于动画的指导。package.json 中放置应用级依赖——每个应用应管理自己的依赖。packages/。每周安装次数
76
代码仓库
GitHub 星标数
19
首次出现
2026年1月30日
安全审计
安装于
cursor68
opencode68
gemini-cli67
codex67
github-copilot64
claude-code60
Define durable, easy-to-change architecture defaults for TypeScript apps.
Architecture setup workflow.Adoption workflow.Output template.Validation loop before finalizing.Load references only when needed:
apps/ for deployable surfaces (api, web, admin).packages/ for shared libraries (shared, ui, icons, auth, proto).Use references/stack-defaults.md as the default baseline. Deviate only when constraints require it.
Run this loop before finalizing architecture decisions:
npm run lintnpm run check-typesnpm run test --workspace=<pkg> (or equivalent targeted tests)Use this structure for architecture recommendations:
# Architecture brief
## Context and constraints
## Repo shape
## Backend module contracts
## Request context and middleware policy
## Frontend boundaries
## Testing strategy
## Rollout and rollback plan
## Open risks and follow-ups
ui-audit for final UI quality checks.ui-animation for motion-specific guidance.package.json in a monorepo — each app owns its deps.packages/.Weekly Installs
76
Repository
GitHub Stars
19
First Seen
Jan 30, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
cursor68
opencode68
gemini-cli67
codex67
github-copilot64
claude-code60
Android 整洁架构指南:模块化设计、依赖注入与数据层实现
1,400 周安装
二进制初步分析指南:使用ReVa工具快速识别恶意软件与逆向工程
69 周安装
PrivateInvestigator 道德人员查找工具 | 公开数据调查、反向搜索与背景研究
69 周安装
TorchTitan:PyTorch原生分布式大语言模型预训练平台,支持4D并行与H100 GPU加速
69 周安装
screenshot 截图技能:跨平台桌面截图工具,支持macOS/Linux权限管理与多模式捕获
69 周安装
tmux进程管理最佳实践:交互式Shell初始化、会话命名与生命周期管理
69 周安装
Git Rebase Sync:安全同步分支的Git变基工具,解决冲突与备份
69 周安装
handler: transport only.service: business orchestration.dao: database access only.mapper: DB/proto/domain transformations.constants and types: module-local contracts.Use AsyncLocalStorage-backed RequestContext:
import { AsyncLocalStorage } from "node:async_hooks";
type RequestContext = { tenantId: string; userId: string; traceId: string }; const store = new AsyncLocalStorage<RequestContext>(); export const getContext = () => store.getStore()!; export const runWithContext = (ctx: RequestContext, fn: () => void) => store.run(ctx, fn);
Initialize context in every entrypoint (RPC, HTTP, jobs, CLI).
Read context via getContext(); do not thread context params through business functions.
Require route policy per RPC method and register services through registerServiceWithPolicies.
Keep auth, logging, errors, and context in shared middleware.
"use client" only for client-only behavior.