agentleFS
violacaseviolacase/Nuxt4-test/.claude/skills/new-composable/SKILL.md

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.

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
  1. Very specific:

    Always prefix with use: useMyComposable

    line 9
  2. Very specific:

    Place in composables/ — Nuxt auto-imports everything here

    line 11
  3. Distinctive:

    Ask: what does this composable do?

    line 75
  4. Very specific:

    If GQL: also generate the matching .graphql operation file (use /new-gql-operation)

    line 76
  5. Very specific:

    If it has side effects (event listeners, intervals), add onUnmounted cleanup

    line 78

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 onUnmounted if 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

  1. Ask: what does this composable do? Does it fetch GQL data?
  2. If GQL: also generate the matching .graphql operation file (use /new-gql-operation)
  3. Generate following the correct template above
  4. If it has side effects (event listeners, intervals), add onUnmounted cleanup

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.