.agents/skills/axios/SKILL.md
Axios - promise-based HTTP client for browser and Node.js USE WHEN: user mentions "Axios", "HTTP requests", "API calls", "interceptors", "Axios instance", asks about "how to make HTTP calls", "configure Axios", "add auth header", "handle HTTP errors" DO NOT USE FOR: Fetch API - use `http-clients` instead; ky/ofetch - use `http-clients` instead; GraphQL clients - use `graphql-codegen` instead; tRPC - use `trpc` instead
npx skillsauth add d-subrahmanyam/deno-fresh-microservices axiosInstall 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:axiosfor comprehensive documentation.
npm install axios
import axios from 'axios';
const response = await axios.get('/api/users');
const users = response.data;
// With params
const response = await axios.get('/api/users', {
params: { page: 1, limit: 10 }
});
const response = await axios.post('/api/users', {
name: 'John',
email: '[email protected]'
});
const api = axios.create({
baseURL: 'https://api.example.com',
timeout: 10000,
headers: { 'Content-Type': 'application/json' }
});
// Use instance
const users = await api.get('/users');
// Request interceptor (add auth token)
api.interceptors.request.use(
(config) => {
const token = localStorage.getItem('token');
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
},
(error) => Promise.reject(error)
);
// Response interceptor (handle errors)
api.interceptors.response.use(
(response) => response,
(error) => {
if (error.response?.status === 401) {
// Handle unauthorized
window.location.href = '/login';
}
return Promise.reject(error);
}
);
interface User {
id: number;
name: string;
email: string;
}
const response = await api.get<User[]>('/users');
const users: User[] = response.data;
try {
const response = await api.get('/users');
} catch (error) {
if (axios.isAxiosError(error)) {
console.error('API Error:', error.response?.data);
console.error('Status:', error.response?.status);
}
}
http-clients skill)http-clients skill)graphql-codegen skill)trpc skill)| Anti-Pattern | Why It's Bad | Solution |
|--------------|--------------|----------|
| No timeout configured | Requests hang indefinitely | Set timeout in axios.create() |
| Hardcoded base URLs | Environment coupling | Use env variables for baseURL |
| No error interceptor | Inconsistent error handling | Add response error interceptor |
| Not typing responses | Loses type safety | Use generics: axios.get<User>() |
| Duplicating auth logic | Maintenance burden | Use request interceptor |
| Ignoring response status | Silent failures | Check response.status or use validateStatus |
| No request cancellation | Memory leaks on unmount | Use AbortController |
| Logging sensitive data | Security risk | Redact tokens/passwords from logs |
| Issue | Possible Cause | Solution | |-------|----------------|----------| | CORS errors | Server not allowing origin | Configure CORS on server, check preflight | | 401 Unauthorized | Missing or invalid token | Check interceptor, verify token | | Network Error | Server unreachable, CORS | Check baseURL, server status, CORS config | | Timeout errors | Request taking too long | Increase timeout or optimize endpoint | | Request canceled | AbortController triggered | Check component lifecycle, don't cancel needed requests | | Type errors | Response shape mismatch | Verify API response matches type definition | | Interceptor not firing | Interceptor added after request | Add interceptors during client setup | | Memory leaks | Not canceling requests on unmount | Use cleanup in useEffect |
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