Agent skill
frontend-angular-api-service
Use when creating API services for backend communication with proper patterns for caching, error handling, and type safety.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/angular-api-service
SKILL.md
Angular API Service Development Workflow
Use when creating/modifying API services extending PlatformApiService for backend communication.
Decision Tree
What kind of API service?
├── Standard CRUD → extend PlatformApiService + get/post/put/deleteRequest
├── With caching → + enableCache option in get() calls
├── File upload/download → + postFormData() / getBlob()
├── External API → + override getDefaultHeaders()
├── Search/autocomplete → + debounce in component, cache short-lived
└── Validation endpoint → return Observable<boolean>
Workflow
- Search existing services:
grep "{Feature}ApiService" --include="*.ts" - Read references (see Read Directives below)
- Define DTOs: request interfaces, response interfaces, command interfaces
- Create service extending
PlatformApiServicewith@Injectable({ providedIn: 'root' }) - Implement
apiUrlgetter usingenvironment.apiUrl + '/api/{Controller}' - Add query methods (get), command methods (post/put/delete), validation methods
- Verify checklist below
Key Rules
- Always extend
PlatformApiService(never useHttpClientdirectly) - Use
environment.apiUrlfor base URL (never hardcode) - All methods must have return type annotations:
Observable<T> - Define DTOs for all request/response types
- Use
{ enableCache: true, cacheKey, cacheDurationMs }for cacheable endpoints - File uploads use
postFormData(), downloads usegetBlob() - Error handling done in component via
tapResponse(), not in service
File Location
src/Frontend/libs/apps-domains/src/lib/{domain}/services/{feature}-api.service.ts
⚠️ MUST READ Before Implementation
IMPORTANT: You MUST read these files before writing any code. Do NOT skip.
- ⚠️ MUST READ
.claude/skills/shared/angular-design-system.md— platform-core imports - ⚠️ MUST READ
.claude/skills/frontend-angular-api-service/references/api-service-patterns.md— CRUD, caching, upload, search patterns - ⚠️ MUST READ target app design system:
docs/design-system/07-technical-guide.md
Anti-Patterns
constructor(private http: HttpClient)- must extendPlatformApiService- Hardcoded URLs:
this.get('https://api.example.com/...')- useenvironment - Missing return type:
getUser(id)- must begetUser(id): Observable<UserDto> - Untyped response:
this.get('/users')- must bethis.get<UserDto[]>('/users') - Error handling in service - let component handle via
tapResponse()
Verification Checklist
- Extends
PlatformApiService -
apiUrlgetter returnsenvironment.apiUrl + '/api/{Controller}' - All methods have
Observable<T>return type - DTOs defined for request/response types
- Caching configured for stable lookup endpoints
- File operations use
postFormData/getBlob -
@Injectable({ providedIn: 'root' })decorator
IMPORTANT Task Planning Notes
- Always plan and break many small todo tasks
- Always add a final review todo task to review the works done at the end to find any fix or enhancement needed
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?