agentleFS
inversifyinversify/monorepo/AGENTS.md

monorepo

AGENTS.md302 starsChanged 12 days agoMITView on GitHub

This is the InversifyJS monorepo - a TypeScript dependency injection library ecosystem. The repository contains multiple packages organized into categories: The project follows a comprehensive testing strategy with multiple test types: Standard structure: - src/ - TypeScript source code - lib/ - ES Module build output ("type": "module") - vitest.config.mjs - Test configuration - Standard scripts: build, test, lint, format

  • Installs packages

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

24 rules. About 0 are common, 16 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈16

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Testing: Use Vitest with extensive unit and integration test coverage

    line 66
  2. Distinctive:

    Follow the structured testing patterns documented in:

    line 82
  3. Very specific:

    Vitest mocking: Use vitest.fn() and vitest.mock() for external dependencies

    line 88
  4. Distinctive:

    Fixture classes: Create reusable test fixtures with static methods

    line 89
  5. Distinctive:

    Clear naming: Use descriptive test names with "when called, and [condition]" pattern

    line 90
  6. Distinctive:

    All packages use workspace protocol for internal dependencies

    line 156
  7. Distinctive:

    No known security vulnerabilities in production dependencies

    line 158
  8. Distinctive:

    Branch Naming: Use descriptive feature branch names

    line 163
  9. Distinctive:

    Commit Messages: Follow conventional commit format

    line 164
  10. Distinctive:

    Testing: All changes must include appropriate tests

    line 165
  11. Very specific:

    Build: Ensure pnpm run build passes

    line 166
  12. Very specific:

    Linting: Ensure pnpm run lint passes

    line 167
  13. Distinctive:

    Documentation: Update relevant docs for public API changes

    line 169
  14. Distinctive:

    Create package directory following existing structure

    line 178
  15. Distinctive:

    Add appropriate tsconfig files

    line 181
  16. Distinctive:

    Add to Turbo build pipeline if needed

    line 183
  17. Distinctive:

    Check Turbo cache: builds are cached by input file hashes

    line 186
  18. Distinctive:

    Verify TypeScript configurations for target output format

    line 187
  19. Distinctive:

    Ensure all workspace dependencies are properly declared

    line 188
  20. Very specific:

    Use --filter flag to isolate specific package issues

    line 189
  21. Very specific:

    Use workspace:* protocol for internal dependencies

    line 192
  22. Very specific:

    Run pnpm install after adding new dependencies

    line 193
  23. Very specific:

    Check knip output for unused dependencies: pnpm run unused

    line 194
  24. Very specific:

    Read docs/README.md inside that installed package first, then read the relevant pages from its docs/ directory before changing Turborepo …

    line 202

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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
AGENTS.md

AGENTS.md

Project Overview

This is the InversifyJS monorepo - a TypeScript dependency injection library ecosystem. The repository contains multiple packages organized into categories:

  • Framework packages: Core framework and HTTP functionality
  • Container packages: DI container implementation, plugins, and examples
  • Foundation packages: Shared tooling (ESLint, Prettier, TypeScript configs)
  • Documentation packages: Code examples and website services
  • Logger package: Logging utilities
  • JSON Schema packages: Schema validation utilities
  • Open API packages: OpenAPI integration

Build and Test Commands

Setup

# Install dependencies
pnpm install

# Build all packages
pnpm run build

# Run all tests
pnpm test

Development Workflow

# Format code
pnpm run format

# Lint code
pnpm run lint

# Run tests for a specific package
pnpm run --filter "@inversifyjs/package-name" test

# Run only unit tests
pnpm run test:unit

# Run only integration tests  
pnpm run test:integration

# Run tests with coverage
pnpm run test:coverage

Working with Specific Packages

# Build a specific package
pnpm run --filter "@inversifyjs/package-name" build

# Test a specific package
pnpm run --filter "@inversifyjs/package-name" test

# Format a specific package
pnpm run --filter "@inversifyjs/package-name" format

Code Style Guidelines

  • TypeScript: Strict mode enabled across all packages
  • Testing: Use Vitest with extensive unit and integration test coverage
  • Mocking: External modules are mocked using vitest.fn()
  • Formatting: Prettier configuration shared via @inversifyjs/foundation-prettier-config
  • Linting: ESLint configuration shared via @inversifyjs/foundation-eslint-config

Testing Instructions

The project follows a comprehensive testing strategy with multiple test types:

Test Types

  • Unit Tests (*.spec.ts): Test individual functions/classes in isolation
  • Integration Tests (*.int.spec.ts): Test component interactions
  • End-to-End Tests: Full system tests (some packages)
  • Type Tests (*.spec-d.ts): TypeScript type checking tests

Test Structure

Follow the structured testing patterns documented in:

  • Unit Testing Guidelines
  • Test Fixtures Guidelines

Key Testing Principles

  1. Four-layer describe structure: Class → Method → Input → Flow scopes
  2. Vitest mocking: Use vitest.fn() and vitest.mock() for external dependencies
  3. Fixture classes: Create reusable test fixtures with static methods
  4. Clear naming: Use descriptive test names with "when called, and [condition]" pattern

Running Tests

# Run all tests
pnpm test

# Run only unit tests
pnpm run test:unit

# Run only integration tests
pnpm run test:integration

# Run tests for uncommitted changes
pnpm run test:uncommitted

# Run with coverage
pnpm run test:coverage

Package Types and Structure

Core Library Packages

Main implementation packages with ESM-only builds:

  • /packages/framework/core/ - Framework core
  • /packages/container/libraries/ - Container implementations
  • /packages/logger/ - Logging utilities

Standard structure:

  • src/ - TypeScript source code
  • lib/ - ES Module build output ("type": "module")
  • vitest.config.mjs - Test configuration
  • Standard scripts: build, test, lint, format

Example Packages

Demonstration packages (usually no tests):

  • /packages/container/examples/ - Usage examples
  • /packages/docs/tools/ - Code examples for documentation

Foundation Packages

Shared tooling and configuration:

  • /packages/foundation/tools/ - Shared configs (ESLint, Prettier, TypeScript, etc.)

Documentation Services

Docusaurus-based documentation sites:

  • /packages/docs/services/ - Documentation websites

Monorepo Architecture

Workspace Configuration

  • Package Manager: pnpm with workspaces
  • Build Tool: Turbo for task orchestration
  • Dependency Management: Workspace protocol for internal dependencies

Build System

  • TypeScript: tsc compiles directly to lib/ as ESM ("type": "module")
  • SWC: Fast TypeScript compilation for tests
  • Turbo: Cached, parallelized builds

Quality Assurance

  • Pre-commit Hooks: Husky with lint-staged
  • Commitlint: Conventional commit messages
  • Changesets: Version management and changelogs

Security Considerations

  • All packages use workspace protocol for internal dependencies
  • Development dependencies are pinned to specific versions
  • No known security vulnerabilities in production dependencies
  • Type-safe dependency injection prevents runtime injection attacks

Pull Request Guidelines

  1. Branch Naming: Use descriptive feature branch names
  2. Commit Messages: Follow conventional commit format
  3. Testing: All changes must include appropriate tests
  4. Build: Ensure pnpm run build passes
  5. Linting: Ensure pnpm run lint passes
  6. Coverage: Maintain or improve test coverage
  7. Documentation: Update relevant docs for public API changes

Performance Considerations

  • Turbo caching significantly speeds up repeated builds

Common Tasks

Adding a New Package

  1. Create package directory following existing structure
  2. Add to pnpm-workspace.yaml
  3. Configure package.json with standard scripts
  4. Add appropriate tsconfig files
  5. Configure Vitest, ESLint, and Prettier
  6. Add to Turbo build pipeline if needed

Debugging Build Issues

  • Check Turbo cache: builds are cached by input file hashes
  • Verify TypeScript configurations for target output format
  • Ensure all workspace dependencies are properly declared
  • Use --filter flag to isolate specific package issues

Working with Dependencies

  • Use workspace:* protocol for internal dependencies
  • Run pnpm install after adding new dependencies
  • Check knip output for unused dependencies: pnpm run unused
<!-- BEGIN:turborepo-agent-rules -->

This is NOT the Turborepo you know

Turborepo configuration, task behavior, and CLI commands can vary between installed versions and may differ from your training data. Resolve the turbo package from this file's directory or relevant workspace; in monorepos, it may not be visible from the repository root. For example, run node -p "require.resolve('turbo/package.json')" from a workspace that depends on turbo.

Read docs/README.md inside that installed package first, then read the relevant pages from its docs/ directory before changing Turborepo configuration or commands. Heed deprecation notices. These bundled docs match the installed package version and are available without network access.

This block is written and re-added by turbo before repository-scoped commands when an AI agent is detected. In the Turborepo source repository, its template is defined in crates/turborepo-cli/src/cli/agent_guidance.rs. Removing the managed block while updates are enabled means a later qualifying invocation will add it again. Set "agentGuidance": false in the root turbo.json or turbo.jsonc to opt out; this does not remove an existing block. Keep the block committed with your work to avoid an uncommitted change on the next agent invocation.

<!-- END:turborepo-agent-rules -->

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.