[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Resource](https://evolu.dev/docs/api-reference/common/Resource) › createSharedResourceByKeyWithClaims

```ts
function createSharedResourceByKeyWithClaims<K, C, T, D, LK, LC>(
  create: (key: K) => Task<T, never, D>,
  __namedParameters?: SharedResourceByKeyWithClaimsOptions<K, C, T, LK, LC>,
): Task<SharedResourceByKeyWithClaims<K, C, T>, never, D>;
```

Defined in: [packages/common/src/Resource.ts:1169](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Resource.ts#L1169)

Creates [SharedResourceByKeyWithClaims](https://evolu.dev/docs/api-reference/common/Resource/interfaces/SharedResourceByKeyWithClaims).

The `create` callback is called with a resource key when that resource must
be created. The returned Task must not fail. Its dependencies are captured
when the registry is created; later claim calls do not require or replace
them.

Transition callbacks represent semantic claim-resource pair changes and are
not called when this registry or its Run tree drains claims during disposal.
They must not throw. If a first-claim callback defects after earlier
callbacks in the same claim completed, matching last-claim callbacks
compensate those completed transitions in reverse order before cleanup.
Relation reads during compensation still include the failed claim. Callback
defects panic the owner Run after claim metadata and resource ownership are
cleaned up.

Transition callbacks may synchronously read relation state. They must not
call `claim`, release a [ClaimLease](https://evolu.dev/docs/api-reference/common/Resource/interfaces/ClaimLease) owned by this registry, or dispose
this registry.

Transition callbacks do not report actual resource disposal. Disposal can
happen later when `idleDisposeAfter` is configured.