From ai-skills
Specialist for TypeScript backend development including Node.js servers, NestJS applications, APIs, databases (PostgreSQL, MongoDB, Redis), authentication, testing, deployment, server-side code, microservices, database queries, migrations, controllers, services, repositories, and middleware. Use for ANY work involving .ts backend files, server-side architecture, performance optimization, and backend security.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ai-skills:backend-developerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill provides expertise in TypeScript backend development with Node.js, NestJS, and modern server-side technologies. Apply this skill when building APIs, implementing database integrations, fixing backend bugs, optimizing performance, or ensuring backend security.
This skill provides expertise in TypeScript backend development with Node.js, NestJS, and modern server-side technologies. Apply this skill when building APIs, implementing database integrations, fixing backend bugs, optimizing performance, or ensuring backend security.
Essential Setup:
Layered Architecture:
Consistent Usage:
Controller and Service Separation:
Example Implementation:
// ✅ Good - Single Responsibility
@Controller('users')
export class UsersController {
constructor(private readonly userService: UserService) {}
@Post()
async create(@Body() dto: CreateUserDto) {
return this.userService.create(dto);
}
}
@Injectable()
export class UserService {
constructor(private readonly userRepository: IUserRepository) {}
async create(dto: CreateUserDto) {
return this.userRepository.create(dto);
}
}
// ✅ Good - Dependency Inversion
@Module({
providers: [
{ provide: 'UserRepository', useClass: TypeOrmUserRepository }
],
})
export class UsersModule {}
Best Practices:
Schema Definition:
Example:
@Entity('users')
export class UserEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
email: string;
@BeforeInsert()
@BeforeUpdate()
validateData() {
// Validation logic here
if (!this.email.includes('@')) {
throw new Error('Invalid email');
}
}
}
Data Access Encapsulation:
Example:
@Injectable()
export class CustomUserRepository extends Repository<UserEntity> {
async findActiveUsers(): Promise<UserEntity[]> {
return this.createQueryBuilder('user')
.where('user.isActive = :isActive', { isActive: true })
.orderBy('user.createdAt', 'DESC')
.getMany();
}
}
Critical Pattern:
When multiple independent async operations can run concurrently, use Promise.all() to parallelize them for significant performance gains (15-40% latency reduction).
Example:
// ✅ Good - Parallelized independent operations (~40% faster)
async searchByAccount(account: Account): Promise<ContactData[]> {
const startTime = Date.now();
// Parallelize independent operations that don't depend on each other
const [domainResult, keywordsResult] = await Promise.all([
// Operation 1: Domain lookup
this.domainService.findDomain(account.domain).then(result => {
this.logger.log(`Domain lookup completed in ${Date.now() - startTime}ms`);
return result;
}),
// Operation 2: Keywords generation
this.keywordService.generateKeywords(account).then(result => {
this.logger.log(`Keywords generation completed in ${Date.now() - startTime}ms`);
return result;
})
]);
// Use results for subsequent operations
return this.processContactData(domainResult, keywordsResult);
}
// ❌ Bad - Sequential operations (unnecessary wait time)
async searchByAccount(account: Account): Promise<ContactData[]> {
const domainResult = await this.domainService.findDomain(account.domain);
const keywordsResult = await this.keywordService.generateKeywords(account);
return this.processContactData(domainResult, keywordsResult);
}
Key Benefits:
Comprehensive Metrics: Always measure and monitor performance improvements with proper metrics.
// ✅ Good - Comprehensive timing metrics for parallel operations
async getInitialContactData(params: SearchParams): Promise<ContactData> {
const overallStart = Date.now();
const salesforceStart = Date.now();
const providerStart = Date.now();
const [salesforceContacts, providerContacts] = await Promise.all([
this.salesforceService.searchContacts(params).then(result => {
this.metricsService.gauge('salesforce_search.latency', Date.now() - salesforceStart);
return result;
}),
this.providerService.searchContacts(params).then(result => {
this.metricsService.gauge('provider_search.latency', Date.now() - providerStart);
return result;
})
]);
this.metricsService.gauge('parallel_contact_search.latency', Date.now() - overallStart);
return this.mergeContactData(salesforceContacts, providerContacts);
}
// Track performance improvement metrics
this.metricsService.histogram('contact_discovery.latency_reduction', reductionPercentage);
| Scenario | Optimization Technique | Expected Improvement |
|---|---|---|
| Independent async operations | Promise.all() parallelization | 15-40% latency reduction |
| Sequential API calls | Concurrent requests with error handling | 20-50% improvement |
| Heavy computations | Caching with Redis/in-memory | Variable based on computation |
| Large data sets | Pagination, lazy loading | Dramatic API responsiveness |
| External service calls | Request deduplication, intelligent caching | Reduces redundant network calls |
| Database queries | Indexing, query optimization, connection pool | 50-90% query time reduction |
Key Insight: Always analyze operation dependencies before optimization - independent operations are prime candidates for parallelization.
Query Performance:
Connection Management:
Best Practices:
Comprehensive Strategy:
Input Sanitization:
Implementation:
Essential Measures:
Configuration:
Health Checks:
Comprehensive Testing:
Best Practices:
Automation:
API Documentation:
When applying this skill to backend development tasks:
Architecture:
Performance:
Security:
Error Handling:
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub benjaming/ai-skills --plugin ai-skills