new-composable
Skill0 starsChanged 8 months agoMITView on GitHub
Scaffold a new Nuxt auto-imported composable (useXxx). Use when the user asks to create a composable, reusable logic, a hook, or shared reactive functionality.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- design-componentSkill
- new-componentSkill
- new-gql-operationSkill
- new-migrationSkill
- new-quill-fieldSkill
- new-resolverSkill
- new-server-routeSkill
- new-settings-storeSkill
- new-storeSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Always prefix with use: useMyComposable
- Very specific: line 11
Place in composables/ — Nuxt auto-imports everything here
- Distinctive: line 75
Ask: what does this composable do?
- Very specific: line 76
If GQL: also generate the matching .graphql operation file (use /new-gql-operation)
- Very specific: line 78
If it has side effects (event listeners, intervals), add onUnmounted cleanup
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: New Composable
Rules
- Always prefix with
use:useMyComposable - Filename matches function name:
useMyComposable.ts - Place in
composables/— Nuxt auto-imports everything here - Return a plain object (not reactive) — let callers destructure
- Handle cleanup in
onUnmountedif subscribing to events - For GQL data fetching, use
useAsyncQuery(from codegen) not raw fetch - Types come from
~/types/gql— never redefine
Template (General)
// composables/useMyComposable.ts
export function useMyComposable() {
// State
const isLoading = ref(false)
const error = ref<string | null>(null)
// Logic
async function doSomething() {
isLoading.value = true
try {
// ...
} catch (e) {
error.value = e instanceof Error ? e.message : 'Unknown error'
} finally {
isLoading.value = false
}
}
// Cleanup (if needed)
// onUnmounted(() => { ... })
return {
isLoading: readonly(isLoading),
error: readonly(error),
doSomething,
}
}Template (GQL Data Fetching)
// composables/usePost.ts
import type { GetPostQuery, GetPostQueryVariables } from '~/types/gql'
import GetPostDocument from './usePost.graphql'
export function usePost(id: MaybeRef<string>) {
const { data, pending, error, refresh } = useAsyncQuery<GetPostQuery>(
GetPostDocument,
computed(() => ({ id: unref(id) }) satisfies GetPostQueryVariables)
)
const post = computed(() => data.value?.post ?? null)
return {
post,
isLoading: pending,
error,
refresh,
}
}Steps
- Ask: what does this composable do? Does it fetch GQL data?
- If GQL: also generate the matching
.graphqloperation file (use/new-gql-operation) - Generate following the correct template above
- If it has side effects (event listeners, intervals), add
onUnmountedcleanup
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

