.agents/skills/angular-http/SKILL.md
Angular HttpClient with interceptors, error handling, retry, and caching patterns. Covers functional interceptors and typed responses. USE WHEN: user mentions "HttpClient", "Angular HTTP", "interceptors", "API calls", "Angular REST", "HTTP error handling", "auth interceptor" DO NOT USE FOR: Axios - use `axios` skill, Fetch API directly, backend HTTP frameworks
npx skillsauth add d-subrahmanyam/deno-fresh-microservices angular-httpInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:angular, topic:httpfor comprehensive documentation.
// app.config.ts
import { provideHttpClient, withInterceptors } from '@angular/common/http';
import { authInterceptor } from './core/interceptors/auth.interceptor';
import { errorInterceptor } from './core/interceptors/error.interceptor';
export const appConfig: ApplicationConfig = {
providers: [
provideHttpClient(withInterceptors([authInterceptor, errorInterceptor])),
]
};
// Auth interceptor
import { HttpInterceptorFn } from '@angular/common/http';
import { inject } from '@angular/core';
export const authInterceptor: HttpInterceptorFn = (req, next) => {
const token = inject(AuthService).getToken();
if (token) {
req = req.clone({
setHeaders: { Authorization: `Bearer ${token}` },
});
}
return next(req);
};
// Error interceptor
export const errorInterceptor: HttpInterceptorFn = (req, next) => {
return next(req).pipe(
catchError((error: HttpErrorResponse) => {
if (error.status === 401) {
inject(Router).navigate(['/login']);
}
return throwError(() => error);
})
);
};
// Loading interceptor
export const loadingInterceptor: HttpInterceptorFn = (req, next) => {
const loading = inject(LoadingService);
loading.show();
return next(req).pipe(finalize(() => loading.hide()));
};
@Injectable({ providedIn: 'root' })
export class UserService {
private http = inject(HttpClient);
private baseUrl = '/api/users';
getUsers(): Observable<User[]> {
return this.http.get<User[]>(this.baseUrl).pipe(
retry({ count: 2, delay: 1000 }),
catchError(this.handleError),
);
}
create(user: CreateUserDto): Observable<User> {
return this.http.post<User>(this.baseUrl, user).pipe(
catchError(this.handleError),
);
}
private handleError(error: HttpErrorResponse): Observable<never> {
let message = 'An error occurred';
if (error.status === 0) {
message = 'Network error';
} else if (error.status === 404) {
message = 'Resource not found';
}
return throwError(() => new Error(message));
}
}
// With observe: 'response' for full response
getWithHeaders(): Observable<HttpResponse<User[]>> {
return this.http.get<User[]>(this.baseUrl, { observe: 'response' });
}
// With params
search(query: string, page: number): Observable<PaginatedResult<User>> {
const params = new HttpParams()
.set('q', query)
.set('page', page.toString());
return this.http.get<PaginatedResult<User>>(this.baseUrl, { params });
}
| Anti-Pattern | Why It's Bad | Correct Approach |
|--------------|--------------|------------------|
| Class-based interceptors | Verbose, deprecated | Use functional HttpInterceptorFn |
| Not typing responses | No compile-time checks | Use http.get<Type>() |
| Subscribing in services | Tight coupling | Return observables, subscribe in components |
| No error handling | Silent failures | Use catchError in service |
| Issue | Likely Cause | Solution |
|-------|--------------|----------|
| HTTP call not firing | Forgot to subscribe | Subscribe to the observable |
| Interceptor not running | Not in providers | Add to withInterceptors() |
| CORS error | Backend config | Configure CORS on server |
| Wrong content type | Missing header | HttpClient sets JSON by default |
development
Guidelines for building high-performance APIs with Fastify and TypeScript, covering validation, Prisma integration, and testing best practices
development
FastAPI modern Python web framework. Covers routing, Pydantic models, dependency injection, and async support. Use when building Python APIs. USE WHEN: user mentions "fastapi", "pydantic", "async python api", "python rest api", asks about "dependency injection python", "python openapi", "python swagger", "async endpoints", "python api validation", "fastapi middleware" DO NOT USE FOR: Django apps - use `django` instead, Flask apps - use `flask` instead, synchronous Python APIs without type hints, GraphQL-only APIs
tools
FastAPI integration testing specialist. Covers synchronous TestClient, async httpx AsyncClient, dependency injection overrides, auth testing (JWT, OAuth2, API keys), WebSocket testing, file uploads, background tasks, middleware testing, and HTTP mocking with respx, responses, and pytest-httpserver. USE WHEN: user mentions "FastAPI test", "TestClient", "httpx async test", "dependency override test", "respx mock", asks about testing FastAPI endpoints, authentication in tests, or HTTP client mocking. DO NOT USE FOR: Django - use `pytest-django`; pytest internals - use `pytest`; Container infrastructure - use `testcontainers-python`
development
Expert in FastAPI Python development with best practices for APIs and async operations