Skip to main content
rule CX Codex

7-auth — Claude Code rule: what it does, how to install

7-auth governs how assistant code reads and saves auth credentials: lazy GitHub token lookup, tight file permissions, and delayed error handling.

MIT ★ 571 updated 2026-10-29

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/7-auth.md
Open on GitHub

What 7-auth does

This rule targets auth code in src/runtime/auth/**/*.ts and src/contexts/*/application/**/*.ts. It instructs the agent to resolve credentials via AuthReaderAdapter.resolve(), checking AIDD_TOKEN, project .aidd/auth.json, and user auth.json. The first match wins and gets memoized, so gh CLI spawns at most once. Reading via method: "external" runs gh auth token, while a dedicated "gh" method does not exist.

Credential storage requires strict access rights: 0600 on POSIX environments and icacls /inheritance:r on win32. If tightening file permissions fails, the adapter must throw an exception immediately.

Missing tokens never block commands up front. Authentication errors surface only as CatalogFetchAuthError upon receiving a 401 status, while local framework paths bypass token requirements entirely.

What it helps with

  • enforce 0600 and icacls file permissions when saving credentials
  • memoize GitHub token resolution to prevent duplicate gh calls
  • map HTTP 401 responses to CatalogFetchAuthError
  • set up credential resolution across AIDD_TOKEN and auth.json files

Example prompts for the agent

  • Implement token retrieval in AuthReaderAdapter.resolve() following our auth rule
  • Store the credential file with proper OS permissions for Windows and POSIX
  • Ensure missing auth tokens do not block local execution paths

How to install 7-auth

Manually: put the files in place

.claude/rules/7-auth.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about 7-auth

How to install 7-auth in Claude Code?

Place the rule file at .claude/rules/7-auth.md in your project root.

What does 7-auth do?

It guides code assistants on resolving tokens in order, memoizing shell lookups, and securing saved auth files on disk.

Does 7-auth halt execution if a token is absent?

No. Execution continues until an actual 401 occurs, raising CatalogFetchAuthError only when a remote request fails.

Source text

7-auth.md · MIT
---
description: Apply when a token is read, stored or checked; one GitHub token, resolved once, never checked eagerly.
paths:
  - "src/runtime/auth/**/*.ts"
  - "src/contexts/*/application/**/*.ts"
---

# Auth

## Resolution

- `AuthReaderAdapter.resolve()`: `AIDD_TOKEN`, project `.aidd/auth.json`, user `auth.json`.
- First hit wins; memoized, so `gh` spawns at most once.
- `method: "stored"` holds the token.
- `method: "external"` runs `gh auth token` at read time, at its own level.
- No `"gh"` method exists.

## Storage

- Write a credential `0600` on POSIX, `icacls /inheritance:r` on win32.
- Throw when the restriction fails.

## Not checked

- No command refuses for a missing token.
- Authorization surfaces as `CatalogFetchAuthError` on a 401.
- A local framework path needs no token.
- Full contract: `aidd_docs/memory/auth.md`.

© ai-driven-dev · MIT · ai-driven-dev/framework

Similar IDE rules

All IDE rules for Security →

From the same set80

The whole set →
1-comments 1-comments — a rule that keeps AI-written comments to facts the code cannot express and bans pointers to tickets, PRs and dates. CX Codex +1 ★ 571repo stars 01-ticket-info 01-ticket-info is a Claude Code skill that fetches ticket details from a configured issue tracker and displays its fields in the agent chat. It reads the ticket identified in the prompt or conversation context. CX Codex +1 ★ 571repo stars 0-shared-modules The 0-shared-modules rule sets a bar for moving code into shared/: callers must come from two application areas. Use it when reviewing modules under src/contexts/. CX Codex +1 ★ 571repo stars 01-hello 01-hello is a Claude Code skill that runs the greet action to confirm the aidd-ui plugin is loaded. It checks plugin availability. CX Codex +1 ★ 571repo stars 0-error-handling The 0-error-handling rule gives TypeScript failures one path: a typed exception moves outward and is handled at the command boundary. CX Codex +1 ★ 571repo stars 00-onboard 00-onboard walks a project through AIDD: reads the repo, picks the next step, shows it on screen, then acts on your reply. CX Codex +1 ★ 571repo stars 04-skill-generate 04-skill-generate generates router-based skills across AI tools through structured scoping and validation. Use it to scaffold new skills, turn manual workflows into skills, or refactor existing ones. CX Codex +1 ★ 571repo stars 03-context-generate The 03-context-generate skill routes requests to create skills, rules, agents, commands, or hooks to the matching generator. If you leave out the artifact type, it asks which one you mean. CX Codex +1 ★ 571repo stars

Project sponsors

Companies that keep this analytics open