mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-03 15:43:31 +08:00
feat: add nestjs development patterns
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Everything Claude Code (ECC) — Agent Instructions
|
||||
|
||||
This is a **production-ready AI coding plugin** providing 38 specialized agents, 155 skills, 72 commands, and automated hook workflows for software development.
|
||||
This is a **production-ready AI coding plugin** providing 38 specialized agents, 156 skills, 72 commands, and automated hook workflows for software development.
|
||||
|
||||
**Version:** 1.9.0
|
||||
|
||||
@@ -146,7 +146,7 @@ Troubleshoot failures: check test isolation → verify mocks → fix implementat
|
||||
|
||||
```
|
||||
agents/ — 38 specialized subagents
|
||||
skills/ — 155 workflow skills and domain knowledge
|
||||
skills/ — 156 workflow skills and domain knowledge
|
||||
commands/ — 72 slash commands
|
||||
hooks/ — Trigger-based automations
|
||||
rules/ — Always-follow guidelines (common + per-language)
|
||||
|
||||
@@ -225,7 +225,7 @@ For manual install instructions see the README in the `rules/` folder. When copy
|
||||
/plugin list everything-claude-code@everything-claude-code
|
||||
```
|
||||
|
||||
**That's it!** You now have access to 38 agents, 155 skills, and 72 legacy command shims.
|
||||
**That's it!** You now have access to 38 agents, 156 skills, and 72 legacy command shims.
|
||||
|
||||
### Multi-model commands require additional setup
|
||||
|
||||
@@ -943,7 +943,7 @@ Please contribute! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
||||
### Ideas for Contributions
|
||||
|
||||
- Language-specific skills (Rust, C#, Kotlin, Java) — Go, Python, Perl, Swift, and TypeScript already included
|
||||
- Framework-specific configs (Rails, FastAPI, NestJS) — Django, Spring Boot, Laravel already included
|
||||
- Framework-specific configs (Rails, FastAPI) — Django, NestJS, Spring Boot, and Laravel already included
|
||||
- DevOps agents (Kubernetes, Terraform, AWS, Docker)
|
||||
- Testing strategies (different frameworks, visual regression)
|
||||
- Domain-specific knowledge (ML, data engineering, mobile)
|
||||
@@ -1120,7 +1120,7 @@ The configuration is automatically detected from `.opencode/opencode.json`.
|
||||
|---------|-------------|----------|--------|
|
||||
| Agents | PASS: 38 agents | PASS: 12 agents | **Claude Code leads** |
|
||||
| Commands | PASS: 72 commands | PASS: 31 commands | **Claude Code leads** |
|
||||
| Skills | PASS: 155 skills | PASS: 37 skills | **Claude Code leads** |
|
||||
| Skills | PASS: 156 skills | PASS: 37 skills | **Claude Code leads** |
|
||||
| Hooks | PASS: 8 event types | PASS: 11 events | **OpenCode has more!** |
|
||||
| Rules | PASS: 29 rules | PASS: 13 instructions | **Claude Code leads** |
|
||||
| MCP Servers | PASS: 14 servers | PASS: Full | **Full parity** |
|
||||
@@ -1229,7 +1229,7 @@ ECC is the **first plugin to maximize every major AI coding tool**. Here's how e
|
||||
|---------|------------|------------|-----------|----------|
|
||||
| **Agents** | 38 | Shared (AGENTS.md) | Shared (AGENTS.md) | 12 |
|
||||
| **Commands** | 72 | Shared | Instruction-based | 31 |
|
||||
| **Skills** | 155 | Shared | 10 (native format) | 37 |
|
||||
| **Skills** | 156 | Shared | 10 (native format) | 37 |
|
||||
| **Hook Events** | 8 types | 15 types | None yet | 11 types |
|
||||
| **Hook Scripts** | 20+ scripts | 16 scripts (DRY adapter) | N/A | Plugin hooks |
|
||||
| **Rules** | 34 (common + lang) | 34 (YAML frontmatter) | Instruction-based | 13 instructions |
|
||||
|
||||
@@ -106,7 +106,7 @@ cp -r everything-claude-code/rules/perl ~/.claude/rules/
|
||||
/plugin list everything-claude-code@everything-claude-code
|
||||
```
|
||||
|
||||
**完成!** 你现在可以使用 38 个代理、155 个技能和 72 个命令。
|
||||
**完成!** 你现在可以使用 38 个代理、156 个技能和 72 个命令。
|
||||
|
||||
### multi-* 命令需要额外配置
|
||||
|
||||
|
||||
@@ -128,3 +128,4 @@ Keep this file detailed for only the current sprint, blockers, and next actions.
|
||||
- 2026-04-02: Adapted the design-quality reminder from `#1127` into the current ECC hook architecture with a local `scripts/hooks/design-quality-check.js`, Claude `hooks/hooks.json` wiring, Cursor `after-file-edit.js` wiring, and dedicated hook coverage in `tests/hooks/design-quality-check.test.js`.
|
||||
- 2026-04-02: Fixed `#1141` on `main` in `16e9b17`. The observer lifecycle is now session-aware instead of purely detached: `SessionStart` writes a project-scoped lease, `SessionEnd` removes that lease and stops the observer when the final lease disappears, `observe.sh` records project activity, and `observer-loop.sh` now exits on idle when no leases remain. Targeted validation passed with `bash -n`, `node tests/hooks/observer-memory.test.js`, `node tests/integration/hooks.test.js`, `node scripts/ci/validate-hooks.js hooks/hooks.json`, and `node scripts/ci/check-unicode-safety.js`.
|
||||
- 2026-04-02: Fixed the remaining Windows-only hook regression behind `#1070` by making `scripts/lib/utils.js#getHomeDir()` honor explicit `HOME` / `USERPROFILE` overrides before falling back to `os.homedir()`. This restores test-isolated observer state paths for hook integration runs on Windows. Added regression coverage in `tests/lib/utils.test.js`. Targeted validation passed with `node tests/lib/utils.test.js`, `node tests/integration/hooks.test.js`, `node tests/hooks/observer-memory.test.js`, and `node scripts/ci/check-unicode-safety.js`.
|
||||
- 2026-04-02: Direct-ported NestJS support for `#1022` into `main` as `skills/nestjs-patterns/SKILL.md` and wired it into the `framework-language` install module. Synced the repo catalog afterward (`38` agents, `72` commands, `156` skills) and updated the docs so NestJS is no longer listed as an unfilled framework gap.
|
||||
|
||||
@@ -600,7 +600,7 @@ node tests/hooks/hooks.test.js
|
||||
### 貢献アイデア
|
||||
|
||||
- 言語固有のスキル(Rust、C#、Swift、Kotlin) — Go、Python、Javaは既に含まれています
|
||||
- フレームワーク固有の設定(Rails、Laravel、FastAPI、NestJS) — Django、Spring Bootは既に含まれています
|
||||
- フレームワーク固有の設定(Rails、Laravel、FastAPI) — Django、NestJS、Spring Bootは既に含まれています
|
||||
- DevOpsエージェント(Kubernetes、Terraform、AWS、Docker)
|
||||
- テスト戦略(異なるフレームワーク、ビジュアルリグレッション)
|
||||
- 専門領域の知識(ML、データエンジニアリング、モバイル開発)
|
||||
|
||||
@@ -631,7 +631,7 @@ node tests/hooks/hooks.test.js
|
||||
### 기여 아이디어
|
||||
|
||||
- 언어별 스킬 (Rust, C#, Swift, Kotlin) — Go, Python, Java는 이미 포함
|
||||
- 프레임워크별 설정 (Rails, Laravel, FastAPI, NestJS) — Django, Spring Boot는 이미 포함
|
||||
- 프레임워크별 설정 (Rails, Laravel, FastAPI) — Django, NestJS, Spring Boot는 이미 포함
|
||||
- DevOps 에이전트 (Kubernetes, Terraform, AWS, Docker)
|
||||
- 테스팅 전략 (다양한 프레임워크, 비주얼 리그레션)
|
||||
- 도메인별 지식 (ML, 데이터 엔지니어링, 모바일)
|
||||
|
||||
@@ -441,7 +441,7 @@ Lütfen katkıda bulunun! Rehber için [CONTRIBUTING.md](../../CONTRIBUTING.md)'
|
||||
### Katkı Fikirleri
|
||||
|
||||
- Dile özel skill'ler (Rust, C#, Kotlin, Java) — Go, Python, Perl, Swift ve TypeScript zaten dahil
|
||||
- Framework'e özel config'ler (Rails, FastAPI, NestJS) — Django, Spring Boot, Laravel zaten dahil
|
||||
- Framework'e özel config'ler (Rails, FastAPI) — Django, NestJS, Spring Boot ve Laravel zaten dahil
|
||||
- DevOps agent'ları (Kubernetes, Terraform, AWS, Docker)
|
||||
- Test stratejileri (farklı framework'ler, görsel regresyon)
|
||||
- Domain'e özel bilgi (ML, data engineering, mobile)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Everything Claude Code (ECC) — 智能体指令
|
||||
|
||||
这是一个**生产就绪的 AI 编码插件**,提供 38 个专业代理、155 项技能、72 条命令以及自动化钩子工作流,用于软件开发。
|
||||
这是一个**生产就绪的 AI 编码插件**,提供 38 个专业代理、156 项技能、72 条命令以及自动化钩子工作流,用于软件开发。
|
||||
|
||||
**版本:** 1.9.0
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
```
|
||||
agents/ — 38 个专业子代理
|
||||
skills/ — 155 个工作流技能和领域知识
|
||||
skills/ — 156 个工作流技能和领域知识
|
||||
commands/ — 72 个斜杠命令
|
||||
hooks/ — 基于触发的自动化
|
||||
rules/ — 始终遵循的指导方针(通用 + 每种语言)
|
||||
|
||||
@@ -209,7 +209,7 @@ npx ecc-install typescript
|
||||
/plugin list everything-claude-code@everything-claude-code
|
||||
```
|
||||
|
||||
**搞定!** 你现在可以使用 38 个智能体、155 项技能和 72 个命令了。
|
||||
**搞定!** 你现在可以使用 38 个智能体、156 项技能和 72 个命令了。
|
||||
|
||||
***
|
||||
|
||||
@@ -927,7 +927,7 @@ node tests/hooks/hooks.test.js
|
||||
### 贡献想法
|
||||
|
||||
* 特定语言技能 (Rust, C#, Kotlin, Java) — Go、Python、Perl、Swift 和 TypeScript 已包含在内
|
||||
* 特定框架配置 (Rails, FastAPI, NestJS) — Django、Spring Boot、Laravel 已包含在内
|
||||
* 特定框架配置 (Rails, FastAPI) — Django、NestJS、Spring Boot、Laravel 已包含在内
|
||||
* DevOps 智能体 (Kubernetes, Terraform, AWS, Docker)
|
||||
* 测试策略 (不同框架、视觉回归)
|
||||
* 领域特定知识 (ML, 数据工程, 移动端)
|
||||
@@ -1096,7 +1096,7 @@ opencode
|
||||
|---------|-------------|----------|--------|
|
||||
| 智能体 | PASS: 38 个 | PASS: 12 个 | **Claude Code 领先** |
|
||||
| 命令 | PASS: 72 个 | PASS: 31 个 | **Claude Code 领先** |
|
||||
| 技能 | PASS: 155 项 | PASS: 37 项 | **Claude Code 领先** |
|
||||
| 技能 | PASS: 156 项 | PASS: 37 项 | **Claude Code 领先** |
|
||||
| 钩子 | PASS: 8 种事件类型 | PASS: 11 种事件 | **OpenCode 更多!** |
|
||||
| 规则 | PASS: 29 条 | PASS: 13 条指令 | **Claude Code 领先** |
|
||||
| MCP 服务器 | PASS: 14 个 | PASS: 完整 | **完全对等** |
|
||||
@@ -1208,7 +1208,7 @@ ECC 是**第一个最大化利用每个主要 AI 编码工具的插件**。以
|
||||
|---------|------------|------------|-----------|----------|
|
||||
| **智能体** | 38 | 共享 (AGENTS.md) | 共享 (AGENTS.md) | 12 |
|
||||
| **命令** | 72 | 共享 | 基于指令 | 31 |
|
||||
| **技能** | 155 | 共享 | 10 (原生格式) | 37 |
|
||||
| **技能** | 156 | 共享 | 10 (原生格式) | 37 |
|
||||
| **钩子事件** | 8 种类型 | 15 种类型 | 暂无 | 11 种类型 |
|
||||
| **钩子脚本** | 20+ 个脚本 | 16 个脚本 (DRY 适配器) | N/A | 插件钩子 |
|
||||
| **规则** | 34 (通用 + 语言) | 34 (YAML 前页) | 基于指令 | 13 条指令 |
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
"skills/laravel-tdd",
|
||||
"skills/laravel-verification",
|
||||
"skills/mcp-server-patterns",
|
||||
"skills/nestjs-patterns",
|
||||
"skills/perl-patterns",
|
||||
"skills/perl-testing",
|
||||
"skills/python-patterns",
|
||||
|
||||
230
skills/nestjs-patterns/SKILL.md
Normal file
230
skills/nestjs-patterns/SKILL.md
Normal file
@@ -0,0 +1,230 @@
|
||||
---
|
||||
name: nestjs-patterns
|
||||
description: NestJS architecture patterns for modules, controllers, providers, DTO validation, guards, interceptors, config, and production-grade TypeScript backends.
|
||||
origin: ECC
|
||||
---
|
||||
|
||||
# NestJS Development Patterns
|
||||
|
||||
Production-grade NestJS patterns for modular TypeScript backends.
|
||||
|
||||
## When to Activate
|
||||
|
||||
- Building NestJS APIs or services
|
||||
- Structuring modules, controllers, and providers
|
||||
- Adding DTO validation, guards, interceptors, or exception filters
|
||||
- Configuring environment-aware settings and database integrations
|
||||
- Testing NestJS units or HTTP endpoints
|
||||
|
||||
## Project Structure
|
||||
|
||||
```text
|
||||
src/
|
||||
├── app.module.ts
|
||||
├── main.ts
|
||||
├── common/
|
||||
│ ├── filters/
|
||||
│ ├── guards/
|
||||
│ ├── interceptors/
|
||||
│ └── pipes/
|
||||
├── config/
|
||||
│ ├── configuration.ts
|
||||
│ └── validation.ts
|
||||
├── modules/
|
||||
│ ├── auth/
|
||||
│ │ ├── auth.controller.ts
|
||||
│ │ ├── auth.module.ts
|
||||
│ │ ├── auth.service.ts
|
||||
│ │ ├── dto/
|
||||
│ │ ├── guards/
|
||||
│ │ └── strategies/
|
||||
│ └── users/
|
||||
│ ├── dto/
|
||||
│ ├── entities/
|
||||
│ ├── users.controller.ts
|
||||
│ ├── users.module.ts
|
||||
│ └── users.service.ts
|
||||
└── prisma/ or database/
|
||||
```
|
||||
|
||||
- Keep domain code inside feature modules.
|
||||
- Put cross-cutting filters, decorators, guards, and interceptors in `common/`.
|
||||
- Keep DTOs close to the module that owns them.
|
||||
|
||||
## Bootstrap and Global Validation
|
||||
|
||||
```ts
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, { bufferLogs: true });
|
||||
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
transform: true,
|
||||
transformOptions: { enableImplicitConversion: true },
|
||||
}),
|
||||
);
|
||||
|
||||
app.useGlobalInterceptors(new ClassSerializerInterceptor(app.get(Reflector)));
|
||||
app.useGlobalFilters(new HttpExceptionFilter());
|
||||
|
||||
await app.listen(process.env.PORT ?? 3000);
|
||||
}
|
||||
bootstrap();
|
||||
```
|
||||
|
||||
- Always enable `whitelist` and `forbidNonWhitelisted` on public APIs.
|
||||
- Prefer one global validation pipe instead of repeating validation config per route.
|
||||
|
||||
## Modules, Controllers, and Providers
|
||||
|
||||
```ts
|
||||
@Module({
|
||||
controllers: [UsersController],
|
||||
providers: [UsersService],
|
||||
exports: [UsersService],
|
||||
})
|
||||
export class UsersModule {}
|
||||
|
||||
@Controller('users')
|
||||
export class UsersController {
|
||||
constructor(private readonly usersService: UsersService) {}
|
||||
|
||||
@Get(':id')
|
||||
getById(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.usersService.getById(id);
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Body() dto: CreateUserDto) {
|
||||
return this.usersService.create(dto);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class UsersService {
|
||||
constructor(private readonly usersRepo: UsersRepository) {}
|
||||
|
||||
async create(dto: CreateUserDto) {
|
||||
return this.usersRepo.create(dto);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Controllers should stay thin: parse HTTP input, call a provider, return response DTOs.
|
||||
- Put business logic in injectable services, not controllers.
|
||||
- Export only the providers other modules genuinely need.
|
||||
|
||||
## DTOs and Validation
|
||||
|
||||
```ts
|
||||
export class CreateUserDto {
|
||||
@IsEmail()
|
||||
email!: string;
|
||||
|
||||
@IsString()
|
||||
@Length(2, 80)
|
||||
name!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEnum(UserRole)
|
||||
role?: UserRole;
|
||||
}
|
||||
```
|
||||
|
||||
- Validate every request DTO with `class-validator`.
|
||||
- Use dedicated response DTOs or serializers instead of returning ORM entities directly.
|
||||
- Avoid leaking internal fields such as password hashes, tokens, or audit columns.
|
||||
|
||||
## Auth, Guards, and Request Context
|
||||
|
||||
```ts
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles('admin')
|
||||
@Get('admin/report')
|
||||
getAdminReport(@Req() req: AuthenticatedRequest) {
|
||||
return this.reportService.getForUser(req.user.id);
|
||||
}
|
||||
```
|
||||
|
||||
- Keep auth strategies and guards module-local unless they are truly shared.
|
||||
- Encode coarse access rules in guards, then do resource-specific authorization in services.
|
||||
- Prefer explicit request types for authenticated request objects.
|
||||
|
||||
## Exception Filters and Error Shape
|
||||
|
||||
```ts
|
||||
@Catch()
|
||||
export class HttpExceptionFilter implements ExceptionFilter {
|
||||
catch(exception: unknown, host: ArgumentsHost) {
|
||||
const response = host.switchToHttp().getResponse<Response>();
|
||||
const request = host.switchToHttp().getRequest<Request>();
|
||||
|
||||
if (exception instanceof HttpException) {
|
||||
return response.status(exception.getStatus()).json({
|
||||
path: request.url,
|
||||
error: exception.getResponse(),
|
||||
});
|
||||
}
|
||||
|
||||
return response.status(500).json({
|
||||
path: request.url,
|
||||
error: 'Internal server error',
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Keep one consistent error envelope across the API.
|
||||
- Throw framework exceptions for expected client errors; log and wrap unexpected failures centrally.
|
||||
|
||||
## Config and Environment Validation
|
||||
|
||||
```ts
|
||||
ConfigModule.forRoot({
|
||||
isGlobal: true,
|
||||
load: [configuration],
|
||||
validate: validateEnv,
|
||||
});
|
||||
```
|
||||
|
||||
- Validate env at boot, not lazily at first request.
|
||||
- Keep config access behind typed helpers or config services.
|
||||
- Split dev/staging/prod concerns in config factories instead of branching throughout feature code.
|
||||
|
||||
## Persistence and Transactions
|
||||
|
||||
- Keep repository / ORM code behind providers that speak domain language.
|
||||
- For Prisma or TypeORM, isolate transactional workflows in services that own the unit of work.
|
||||
- Do not let controllers coordinate multi-step writes directly.
|
||||
|
||||
## Testing
|
||||
|
||||
```ts
|
||||
describe('UsersController', () => {
|
||||
let app: INestApplication;
|
||||
|
||||
beforeAll(async () => {
|
||||
const moduleRef = await Test.createTestingModule({
|
||||
imports: [UsersModule],
|
||||
}).compile();
|
||||
|
||||
app = moduleRef.createNestApplication();
|
||||
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
|
||||
await app.init();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
- Unit test providers in isolation with mocked dependencies.
|
||||
- Add request-level tests for guards, validation pipes, and exception filters.
|
||||
- Reuse the same global pipes/filters in tests that you use in production.
|
||||
|
||||
## Production Defaults
|
||||
|
||||
- Enable structured logging and request correlation ids.
|
||||
- Terminate on invalid env/config instead of booting partially.
|
||||
- Prefer async provider initialization for DB/cache clients with explicit health checks.
|
||||
- Keep background jobs and event consumers in their own modules, not inside HTTP controllers.
|
||||
- Make rate limiting, auth, and audit logging explicit for public endpoints.
|
||||
Reference in New Issue
Block a user