agentleFS
Atlas-AuthorizationAtlas-Authorization/atlas-claude-skills/skills/atlas-fga/SKILL.md

atlas-fga

Skill0 starsChanged 42 days agoMITView on GitHub

Add fine-grained / relationship-based authorization (ReBAC, Zanzibar-style) to an app with Atlas (atlasauth.net) FGA — the OpenFGA-compatible surface. Write an authorization model, write relationship tuples, and run check / batch-check / list-objects / expand. Use the @atlasauth/fga-js, atlas-fga-go, or atlas-fga (Python) client, or the stock @openfga/sdk pointed at /v1/openfga. Use when the user needs per-object permissions, "can user X do Y to resource Z", sharing/roles on documents, or OpenFGA against Atlas.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All calls authenticate with the instance secret key sk_… (server-side only).

    line 12

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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

Atlas FGA — fine-grained authorization

Atlas's FGA engine is OpenFGA-shaped: the same model DSL/JSON, the same user / relation / object tuple vocabulary, and the same operations. Two surfaces:

  • Native /v1/fga (recommended) — full feature set incl. list-objects, read, expand; Atlas response envelopes. Use @atlasauth/fga-js / atlas-fga-go / atlas-fga (Python).
  • OpenFGA wire-compatible mirror /v1/openfga — point the stock @openfga/sdk here (apiUrl https://api.atlasauth.net/v1/openfga, ApiToken = your sk_…). Covers check / write / stores / models only.

All calls authenticate with the instance secret key sk_… (server-side only). Base URL defaults to https://api.atlasauth.net.

1. Client (@atlasauth/fga-js)

import { AtlasFga } from '@atlasauth/fga-js';
const fga = new AtlasFga({
  secretKey: process.env.ATLAS_SECRET_KEY!,
  storeId: process.env.ATLAS_FGA_STORE_ID!,     // default store for every call
});

Env config also works: ATLAS_SECRET_KEY, ATLAS_FGA_STORE_ID, ATLAS_FGA_MODEL_ID, ATLAS_FGA_URL. new AtlasFga() with no args works when those are set.

2. Create a store + authorization model

const store = await fga.stores.create('my-app');   // POST /v1/fga/stores
const model = await fga.models.create(store.id, {
  schema_version: '1.1',
  type_definitions: [
    { type: 'user' },
    {
      type: 'doc',
      relations: { viewer: { this: {} }, editor: { this: {} } },
      metadata: { relations: {
        viewer: { directly_related_user_types: [{ type: 'user' }] },
        editor: { directly_related_user_types: [{ type: 'user' }] },
      } },
    },
  ],
});
// pin the store + model so every call uses them
const fgaPinned = new AtlasFga({ storeId: store.id, authorizationModelId: model.id });

3. Write relationship tuples

await fga.writeTuples([
  { user: 'user:alice', relation: 'viewer', object: 'doc:readme' },
  { user: 'user:bob',   relation: 'editor', object: 'doc:readme' },
]);
// delete: fga.deleteTuples([...]); or fga.write({ writes, deletes });

4. Ask access questions

const { allowed } = await fga.check({ user: 'user:alice', relation: 'viewer', object: 'doc:readme' }); // true
const { objects } = await fga.listObjects({ user: 'user:alice', relation: 'viewer', type: 'doc' });   // ['doc:readme']
await fga.batchCheck({ checks: [ /* ... */ ] });
await fga.expand({ object: 'doc:readme', relation: 'viewer' });
await fga.read({ user: 'user:alice' });   // list tuples (paged: { data, has_more })

Operation → route map

MethodRoute
checkPOST /v1/fga/stores/:store/check
batchCheckPOST /v1/fga/stores/:store/batch-check
write / writeTuples / deleteTuplesPOST /v1/fga/stores/:store/write
readPOST /v1/fga/stores/:store/read
listObjectsPOST /v1/fga/stores/:store/list-objects
expandPOST /v1/fga/stores/:store/expand
stores.list/create/get/delete/v1/fga/stores
models.list/create/get/v1/fga/stores/:store/authorization-models

Other languages

  • Go — go get github.com/Atlas-Authorization/atlas-fga-go; atlasfga.New("sk_live_...", atlasfga.WithStore("store_123")).
  • Python — pip install atlas-fga; from atlas_fga import AtlasFga → AtlasFga(secret_key="sk_live_...", store_id="store_123").

Errors

Non-2xx throws AtlasFgaError carrying the { errors: [...] } envelope with a stable code (e.g. store_id_not_found). Pattern: run check() on every protected read/write and 403 on allowed === false.

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.