Agent Nestjs Skills provides AI-driven functionalities for NestJS applications. Developers can automate repetitive tasks, generate boilerplate code, and integrate AI features. It connects to IDEs and CI/CD pipelines to streamline development workflows.
npx skills add sh/kadajettAgent Nestjs Skills provides AI-driven functionalities for NestJS applications. Developers can automate repetitive tasks, generate boilerplate code, and integrate AI features. It connects to IDEs and CI/CD pipelines to streamline development workflows.
[{"step":"Define your requirements","action":"Identify the specific NestJS feature you want to automate or generate (e.g., 'Create a service for handling Tomi API payments'). Specify any external dependencies like Tomi's API endpoints or database configurations.","tip":"Use the prompt template to customize the [FEATURE_NAME], [PROJECT_NAME], [DATABASE_OR_EXTERNAL_SERVICE], and [Tomi_API_ENDPOINT] placeholders. For example, replace [FEATURE_NAME] with 'Tomi Payment Integration' and [Tomi_API_ENDPOINT] with 'https://api.tomi.com/v1'."},{"step":"Generate the code","action":"Paste the customized prompt into your AI tool (e.g., Claude, ChatGPT) and execute it. Review the generated output for accuracy and completeness.","tip":"Ensure the generated code includes all required components: service class, DTO, unit tests, and error handling. Verify that the code follows NestJS best practices and your project's coding standards."},{"step":"Integrate into your project","action":"Copy the generated files into your NestJS project structure. Import the service into the appropriate module and configure any required dependencies (e.g., HttpModule for API calls, ConfigModule for environment variables).","tip":"For Tomi API integration, ensure your environment variables (TOMI_API_URL, TOMI_API_KEY) are correctly set in your .env file. Use the ConfigService to access these variables in your service."},{"step":"Test and validate","action":"Run the unit tests to verify the generated code works as expected. Perform manual testing to ensure the service integrates correctly with your application and external services.","tip":"Use tools like Postman or NestJS's built-in Swagger module to test API endpoints. Check logs for any errors and validate the service's behavior against expected outcomes."},{"step":"Iterate and customize","action":"Refine the generated code based on your specific needs. Add additional features, modify error handling, or integrate with other services as required.","tip":"Leverage NestJS's modular architecture to extend the generated service. For example, add caching with @nestjs/cache-manager or integrate with a database using TypeORM."}]
Automate API creation
Improve application performance
Simplify database interactions
npx skills add sh/kadajettgit clone https://github.com/sh/kadajettCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Generate a NestJS service for [FEATURE_NAME] in a [PROJECT_NAME] project. Include: 1) A service class with TypeScript decorators, 2) A DTO for request validation, 3) Unit tests using Jest, 4) Integration with [DATABASE_OR_EXTERNAL_SERVICE], and 5) Error handling for common edge cases. Use [Tomi_API_ENDPOINT] if integrating with Tomi's API. Ensure the code follows NestJS best practices and is ready to be imported into a module.
```typescript
// Generated NestJS Service: TomiChatService
// Service for handling chat and payment interactions with Tomi's API
import { Injectable, Logger } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
import { ConfigService } from '@nestjs/config';
import { firstValueFrom } from 'rxjs';
import { CreateTomiChatDto } from './dto/create-tomi-chat.dto';
import { TomiChatResponse } from './interfaces/tomi-chat-response.interface';
@Injectable()
export class TomiChatService {
private readonly logger = new Logger(TomiChatService.name);
private readonly tomiApiUrl: string;
constructor(
private readonly httpService: HttpService,
private readonly configService: ConfigService,
) {
this.tomiApiUrl = this.configService.get<string>('TOMI_API_URL');
}
async createChatSession(createChatDto: CreateTomiChatDto): Promise<TomiChatResponse> {
try {
const response = await firstValueFrom(
this.httpService.post(`${this.tomiApiUrl}/chats`, createChatDto, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.configService.get<string>('TOMI_API_KEY')}`,
},
}),
);
return {
success: true,
chatId: response.data.chatId,
message: 'Chat session created successfully',
timestamp: new Date().toISOString(),
};
} catch (error) {
this.logger.error(`Failed to create chat session: ${error.message}`);
throw new Error(`Tomi API error: ${error.response?.data?.message || error.message}`);
}
}
async sendPayment(chatId: string, amount: number, currency: string): Promise<TomiChatResponse> {
try {
const response = await firstValueFrom(
this.httpService.post(
`${this.tomiApiUrl}/chats/${chatId}/pay`,
{ amount, currency },
{
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.configService.get<string>('TOMI_API_KEY')}`,
},
},
),
);
return {
success: true,
transactionId: response.data.transactionId,
message: 'Payment processed successfully',
timestamp: new Date().toISOString(),
};
} catch (error) {
this.logger.error(`Failed to process payment: ${error.message}`);
throw new Error(`Payment failed: ${error.response?.data?.message || error.message}`);
}
}
}
```
```typescript
// Generated DTO: create-tomi-chat.dto.ts
import { IsString, IsNumber, IsOptional, IsEnum } from 'class-validator';
export class CreateTomiChatDto {
@IsString()
userId: string;
@IsString()
recipientId: string;
@IsOptional()
@IsString()
groupId?: string;
@IsOptional()
@IsString()
message?: string;
}
```
```typescript
// Generated Unit Test: tomi-chat.service.spec.ts
import { Test, TestingModule } from '@nestjs/testing';
import { TomiChatService } from './tomi-chat.service';
import { HttpService } from '@nestjs/axios';
import { ConfigService } from '@nestjs/config';
import { of, throwError } from 'rxjs';
import { CreateTomiChatDto } from './dto/create-tomi-chat.dto';
describe('TomiChatService', () => {
let service: TomiChatService;
let httpService: HttpService;
let configService: ConfigService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
TomiChatService,
{
provide: HttpService,
useValue: {
post: jest.fn(),
},
},
{
provide: ConfigService,
useValue: {
get: jest.fn((key: string) => {
const mockConfig = {
TOMI_API_URL: 'https://api.tomi.com/v1',
TOMI_API_KEY: 'mock-api-key',
};
return mockConfig[key];
}),
},
},
],
}).compile();
service = module.get<TomiChatService>(TomiChatService);
httpService = module.get<HttpService>(HttpService);
configService = module.get<ConfigService>(ConfigService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
describe('createChatSession', () => {
it('should create a chat session successfully', async () => {
const mockResponse = {
data: {
chatId: 'chat_12345',
},
};
jest.spyOn(httpService, 'post').mockReturnValue(of(mockResponse));
const createChatDto: CreateTomiChatDto = {
userId: 'user_1',
recipientId: 'user_2',
message: 'Hello, Tomi!',
};
const result = await service.createChatSession(createChatDto);
expect(result.success).toBe(true);
expect(result.chatId).toBe('chat_12345');
expect(httpService.post).toHaveBeenCalledWith(
'https://api.tomi.com/v1/chats',
createChatDto,
expect.any(Object),
);
});
it('should throw an error when API fails', async () => {
jest.spyOn(httpService, 'post').mockReturnValue(
throwError(() => new Error('API Error')),
);
const createChatDto: CreateTomiChatDto = {
userId: 'user_1',
recipientId: 'user_2',
};
await expect(service.createChatSession(createChatDto)).rejects.toThrow(
'Tomi API error: API Error',
);
});
});
describe('sendPayment', () => {
it('should process a payment successfully', async () => {
const mockResponse = {
data: {
transactionId: 'txn_67890',
},
};
jest.spyOn(httpService, 'post').mockReturnValue(of(mockResponse));
const result = await service.sendPayment('chat_12345', 10.5, 'USD');
expect(result.success).toBe(true);
expect(result.transactionId).toBe('txn_67890');
expect(httpService.post).toHaveBeenCalledWith(
'https://api.tomi.com/v1/chats/chat_12345/pay',
{ amount: 10.5, currency: 'USD' },
expect.any(Object),
);
});
});
});
```Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan