AGENTS.md
AGENTS.mdAGENTS.mdroot
Quality
97/100
Scores the file, not the repository.Length
1,105 words
43 headings · 7 code blocksRepository
0
— · pushed 4 days agoLast changed
3 days ago
First indexed 3 days ago.1# AGENTS.md23Middle Earth AI instructions for Codex, Claude, and Cursor with equal capability parity.45## Equality rule67- Cursor, Claude, and Codex are treated as equals.8- No platform is primary for instruction definition.9- Canonical source: `.ai/`.1011## Canonical workflow12131. Edit canonical files in `.ai/`.142. Run `pnpm ai:sync` to regenerate platform adapters.153. Run `pnpm ai:check` to validate parity and links.1617## Current capability counts1819- Rules: 1120- Skills: 821- Agents/Roles: 22223## Available skills2425- `check` - Run Middle Earth quality gates (lint, test, build) without committing. Runs AI instruction checks when .ai/ files are affected.26- `commit` - Commit Changes27- `create-branch` - Create Branch28- `create-pr` - Create Pull Request29- `debug` - Structured debugging workflow for errors, test failures, build issues, and unexpected behavior in the Middle Earth monorepo.30- `finish-work` - End-to-end workflow to ship code changes as a PR. Creates branch, runs quality gates, commits changes, and creates PR.31- `review-pr` - Review pull requests for quality, correctness, and adherence to Middle Earth project standards.32- `unit-test` - Run and write Jest unit tests following Middle Earth patterns.3334## Rule mappings3536- `rule-bmad` - BMAD tool/output split and per-app artifact convention for Middle Earth37- `rule-branch-naming` - Git branch naming conventions aligned with Conventional Commits38- `rule-code-comments` - Code comment guidelines for all languages39- `rule-code-preservation` - Code preservation rules - never delete or revert code without explicit approval40- `rule-code-style` - Middle Earth code style conventions (TypeScript/JavaScript)41- `rule-commit` - Conventional Commit message standards with Middle Earth scopes42- `rule-documentation` - Markdown documentation standards43- `rule-pull-request` - Pull request workflow and quality standards44- `rule-pull-request-description` - Pull request description format and content standards45- `rule-testing` - Middle Earth testing baseline guidelines (unit tests with Jest)46- `rule-typescript` - Middle Earth TypeScript baseline guidelines (compiler, modules, best practices)4748## Agent roles4950- `debugger` - Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when you hit failures that need root-cause analysis.51- `verifier` - Validates completed work. Use after tasks are marked done to confirm implementations are functional and meet project standards.5253## Canonical references5455- `.ai/README.md`56- `.ai/DEFINITIONS.md`57- `.ai/STANDARDS.md`58- `.ai/PARITY_MATRIX.md`59- `.ai/PROJECT_CONTEXT.md`6061## Runtime adapter paths6263- Cursor: `.cursor/rules/`, `.cursor/skills/`, `.cursor/agents/`64- Claude: `.claude/settings.json`, `.claude/skills/`, `.claude/agents/`65- Codex: `.agents/skills/`, `AGENTS.md`6667## Setup commands (workspace)6869- Install deps: `pnpm install`70- Run lint (affected): `pnpm lint:affected`71- Run tests: `pnpm nx affected --target test`72- Build: `pnpm nx affected --target build`73- Validate AI instructions: `pnpm ai:check`7475# Middle Earth Project Context7677Project-specific knowledge for AI assistants working on Middle Earth. This content is appended to the generated CLAUDE.md adapter.7879## Project Overview8081Middle Earth is a monorepo for Carrot Foundation's publishable libraries. It contains shared packages consumed by other Carrot repos. There are no applications — only publishable libraries.8283- **@carrot-foundation/eslint-config-carrot** — Shared ESLint configuration84- **@carrot-foundation/web-logger** — Pino-based logger utility for web applications85- **@carrot-foundation/web-ui** — React UI component library (MUI-based, atomic design)8687## Technology Stack8889- **Monorepo**: Nx 21.6.3 workspace with pnpm 10.2.090- **Node**: 22.20.0 (see `.nvmrc`)91- **Language**: TypeScript 5.3.3 (strict mode, verbatimModuleSyntax)92- **Frontend**: React 19, Next.js 15.5.4, MUI 7.x93- **Logging**: Pino 10.x94- **Build**: SWC (swc/cli, swc/core)95- **Testing**: Jest 29.4.1 with @nx/jest96- **Linting**: ESLint 8.56.0 (Airbnb, SonarJS, Unicorn, Security, Perfectionist, Prettier)97- **Release**: Semantic Release 22.0.12 with independent versioning98- **Git Hooks**: Husky 9.x with lint-staged99- **Commit Linting**: Commitlint with cz-git100101## Architecture102103### Directory Structure104105```106libs/publishable/107 eslint-config-carrot/ # @carrot-foundation/eslint-config-carrot108 web/109 logger/ # @carrot-foundation/web-logger110 ui/ # @carrot-foundation/web-ui111 src/lib/112 atoms/ # Basic components (Button, Icons)113 molecules/ # Composed components (Share)114 theme/ # Theme configuration and providers115```116117### Path Aliases118119Defined in `tsconfig.base.json`:120121- `@middle-earth/libs/publishable/eslint-config-carrot`122- `@middle-earth/libs/publishable/web/logger`123- `@middle-earth/libs/publishable/web/ui`124125### UI Library (web-ui)126127- Follows **atomic design**: atoms, molecules, theme128- Built on **MUI 7.x** with custom theme129- Uses **React 19** features130131### Key Constraints132133- **Libraries only**: No application code — all libraries in `libs/publishable/`134- **Publishable**: All libraries are published to npm under `@carrot-foundation/`135- **Independent versioning**: Each library versioned separately via semantic-release136- **Path aliases required**: Use `@middle-earth/libs/publishable/*`, NOT relative `../../..`137138## Common Commands139140### Development141142```bash143# Build a library144pnpm nx build <project-name>145146# Run tests147pnpm nx test <project-name>148149# Run linting150pnpm nx lint <project-name>151```152153### Affected Commands154155```bash156# Lint affected projects157pnpm lint:affected # nx affected --target lint --fix158159# Test affected projects (not available — use nx directly)160pnpm nx affected --target test161162# Build affected projects (not available — use nx directly)163pnpm nx affected --target build164```165166### Utilities167168```bash169# Commitizen (guided commit message)170pnpm commit # czg171172# Validate package.json files173pnpm pkgJsonLint # npmPkgJsonLint .174175# Spell check176pnpm spellcheck # cspell (if configured)177```178179## Code Standards180181**Baseline standards**: see `.ai/rules/` for all rules.182183### TypeScript184185- **Strict mode**: `strict: true`, `verbatimModuleSyntax`, `noUnusedLocals`, `noUnusedParameters`186- **Imports**: Use path aliases (`@middle-earth/libs/publishable/*`), NOT relative `../../..`187- **No `any`**: Favor precise types and narrowing188- **Return types**: Explicit for exported functions and public APIs189- **File organization**: `*.constants.ts`, `*.helpers.ts`, `*.types.ts`190191### Testing192193- **Jest** as test runner (NOT Vitest)194- **Unit tests**: `*.spec.ts(x)` in `__tests__/` folders195- **Mocking**: `jest.mock` for modules, `jest.spyOn` for side effects196- **Table-driven tests**: `it.each` for input/output matrices197- **Coverage**: Aim for 100% where feasible198199## Commit Message Guidelines200201### Quick Reference202203- **Format**: `<type>(optional scope): <description>`204- **Types**: `feat`, `fix`, `refactor`, `docs`, `test`, `style`, `perf`, `build`, `ci`, `chore`, `revert`205- **Imperative mood**: "add", "fix", "update" (NOT "added", "fixed", "updated")206- **Lowercase**: Description starts with lowercase letter207- **No period**: Description does NOT end with a period208209### Middle Earth Scopes210211- **`config`**: Root-level configuration files (nx.json, tsconfig.base.json, ESLint, commitlint)212- **`lib`**: Libraries in `libs/publishable/`213- **`release`**: Versioning, releases, publishing214- **`ai`**: AI instructions and rules215216### Examples217218```219feat(lib): add Button component to UI library220chore(config): update ESLint rules for TypeScript files221chore(release): bump eslint-config-carrot to 0.9.0222refactor(lib): simplify logger initialization223```224225## Nx Configuration226227- **Plugins**: @nx/eslint/plugin, @nx/jest/plugin228- **Default Base**: main branch229- **Build**: `@nx/js:swc` compiler230- **Targets per library**: build, lint, test, types, package, publish, release231- **Project Tags**: `type:lib`232233## Important Notes234235- **Package Manager**: pnpm ONLY (enforced by `preinstall` script)236- **Node Version**: 22.20.0 (check `.nvmrc`)237- **Husky Hooks**: Git hooks for pre-commit linting via lint-staged238- **Renovate**: Dependency updates automated with config in `renovate.json`239- **No Docker**: Libraries only — no container builds240- **No Infrastructure**: No Terraform, no AWS resources241242## Troubleshooting243244### Clear Caches245246```bash247pnpm nx reset248```249250### Dependency Issues251252```bash253rm -rf node_modules pnpm-lock.yaml254pnpm install255```256
Also in carrot-foundation/middle-earth
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| carrot-foundation/middle-earth.cursor/rules/bmad.mdc · 0 | Cursor rules | gitdo-not | 51/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/branch-naming.mdc · 0 | Cursor rules | lint-formatstylegitdo-not | 45/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/code-comments.mdc · 0 | Cursor rules | styletypesdocs | 48/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/code-preservation.mdc · 0 | Cursor rules | do-not | 32/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/code-style.mdc · 0 | Cursor rules | lint-formatstylearchdependencies+1 | 56/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/commit.mdc · 0 | Cursor rules | testlint-formattypesgit | 58/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/documentation.mdc · 0 | Cursor rules | lint-formatstylearchdocs | 42/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/pull-request-description.mdc · 0 | Cursor rules | git | 39/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/pull-request.mdc · 0 | Cursor rules | lint-formatgitagent-behaviour | 69/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/testing.mdc · 0 | Cursor rules | teststyletesting-strategy | 73/100 | 3 days ago | |
| carrot-foundation/middle-earth.cursor/rules/typescript.mdc · 0 | Cursor rules | buildlint-formatstylearch+1 | 59/100 | 3 days ago | |
| carrot-foundation/middle-earthCLAUDE.md · 0 | CLAUDE.md | setupbuildtestlint-format+6 | 97/100 | 3 days ago |
Diff against .cursor/rules/bmad.mdc Diff against .cursor/rules/branch-naming.mdc Diff against .cursor/rules/code-comments.mdc Diff against .cursor/rules/code-preservation.mdc Diff against .cursor/rules/code-style.mdc Diff against .cursor/rules/commit.mdc Diff against .cursor/rules/documentation.mdc Diff against .cursor/rules/pull-request-description.mdc Diff against .cursor/rules/pull-request.mdc Diff against .cursor/rules/testing.mdc Diff against .cursor/rules/typescript.mdc Diff against CLAUDE.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago |
