Agent skill
nuxt-repositories
Repository pattern for API access with automatic model hydration. Use when creating repositories for API resources, configuring model hydration, adding custom API methods, or registering repositories in app config.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/design/nuxt-repositories-leeovery-claude-nuxt
SKILL.md
Nuxt Repositories
Data access layer with CRUD operations and automatic model hydration.
Core Concepts
repositories.md - Complete repository patterns, registration, custom methods
Basic Repository
// app/repositories/PostRepository.ts
import { BaseRepository } from '#layers/base/app/repositories/base-repository'
import { ModelHydrator } from '#layers/base/app/repositories/hydrators/model-hydrator'
import Post from '~/models/Post'
export default class PostRepository extends BaseRepository<Post> {
protected resource = '/api/posts'
protected hydration = true
protected hydrator = new ModelHydrator(Post)
// Custom method
async listByAuthor(authorUlid: string) {
return this.jsonGet(`/api/authors/${authorUlid}/posts`)
}
}
Registration
// app/app.config.ts
export default defineAppConfig({
repositories: {
posts: PostRepository,
authors: AuthorRepository,
},
})
Usage
// Get typed repository instance
const postApi = useRepository('posts')
// CRUD operations (returns hydrated models)
const { data: posts } = await postApi.list()
const { data: post } = await postApi.get('ulid123')
const { data: newPost } = await postApi.create({ title: 'Hello' })
await postApi.update('ulid123', { title: 'Updated' })
await postApi.delete('ulid123')
// With query params
const { data: posts } = await postApi.list({
include: 'author,comments',
filter: { status: 'published' },
})
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?