agentleFS
galz10galz10/pickle-rick-extension/cli/AGENTS.md

pickle-rick-extension / cli

AGENTS.md454 starsChanged 9 months agoApache-2.0View on GitHub

This file provides guidance for agentic coding agents working in this repository.

The file

Show its rules and text

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

19 rules. About 1 is common, 14 are distinctive, and 4 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    TypeScript: All code must be TypeScript with strict mode enabled

    line 30
  2. Very specific:

    ESM: Use ES modules with .js extensions for imports (not .ts)

    line 31
  3. Distinctive:

    Async/Await: Prefer async/await over Promise chains

    line 32
  4. Distinctive:

    Error Handling: Use try/catch with proper error typing and messages

    line 33
  5. Distinctive:

    Zod: Use Zod schemas for all external data validation

    line 58
  6. Distinctive:

    Strict Types: Always define explicit return types and parameter types

    line 59
  7. Very specific:

    Error Types: Use unknown for catch blocks, then narrow with instanceof

    line 60
  8. Very specific:

    Barrel Exports: Use index.ts files for clean public APIs

    line 86
  9. Distinctive:

    Renderables: All UI components extend renderable classes

    line 92
  10. Distinctive:

    Event Handling: Use proper event listener patterns with cleanup

    line 93
  11. Distinctive:

    State Management: Keep UI state in controller classes, not renderables

    line 94
  12. Very specific:

    Theme: Use centralized theme constants from ./theme.js

    line 95
  13. Distinctive:

    Framework: Use Bun's built-in test runner

    line 98
  14. Distinctive:

    Coverage: Test public interfaces, not implementation details

    line 100
  15. Distinctive:

    State Persistence: All state must be serializable to JSON via Zod schemas

    line 124
  16. Distinctive:

    Cleanup: Always clean up resources (worktrees, processes, event listeners)

    line 125
  17. Distinctive:

    Streaming: Use streaming APIs for CLI output and large data

    line 129
  18. Common:

    No Secrets: Never commit API keys, tokens, or sensitive data

    line 135
  19. Distinctive:

    Command Injection: Use parameterized arrays for exec commands

    line 137

≈ “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

This file provides guidance for agentic coding agents working in this repository.

Build & Development Commands

# Install dependencies
bun install

# Run in development mode (TUI dashboard)
bun run dev

# Build production executable
bun run build

# Type check without emitting
bun run check

# Run tests
bun test

# Run single test file
bun test src/path/to/file.test.ts

Code Style Guidelines

General Principles

  • TypeScript: All code must be TypeScript with strict mode enabled
  • ESM: Use ES modules with .js extensions for imports (not .ts)
  • Async/Await: Prefer async/await over Promise chains
  • Error Handling: Use try/catch with proper error typing and messages

Import Organization

// 1. Node.js built-ins
import { readFile } from "node:fs/promises";
import { join } from "node:path";

// 2. External dependencies
import { Command } from "commander";
import { z } from "zod";

// 3. Internal modules (relative imports with .js)
import { SessionState } from "./config/types.js";
import { GeminiEngine } from "./engines/gemini.js";

Naming Conventions

  • Files: kebab-case for files (e.g., dashboard-controller.ts)
  • Classes: PascalCase (e.g., DashboardController, GeminiEngine)
  • Functions/Variables: camelCase (e.g., createSession, sessionDir)
  • Constants: UPPER_SNAKE_CASE for exports (e.g., GLOBAL_SESSIONS_DIR)
  • Interfaces: PascalCase with I prefix only for React-like props (e.g., DashboardUI)

Type Safety

  • Zod: Use Zod schemas for all external data validation
  • Strict Types: Always define explicit return types and parameter types
  • Error Types: Use unknown for catch blocks, then narrow with instanceof
// Good
async function loadState(sessionDir: string): Promise<SessionState | null> {
  try {
    const content = await readFile(path, "utf-8");
    const json = JSON.parse(content);
    return SessionStateSchema.parse(json);
  } catch (e) {
    console.error("Failed to load state:", e);
    return null;
  }
}

// Bad
async function loadState(path) {
  try {
    return JSON.parse(await readFile(path));
  } catch (e) {
    return null;
  }
}

Code Organization

  • Barrel Exports: Use index.ts files for clean public APIs
  • Single Responsibility: Each file should export one main class/function
  • Dependencies: Inject dependencies, avoid global state
  • Constants: Define theme and configuration constants in dedicated files

TUI Components (@opentui/core)

  • Renderables: All UI components extend renderable classes
  • Event Handling: Use proper event listener patterns with cleanup
  • State Management: Keep UI state in controller classes, not renderables
  • Theme: Use centralized theme constants from ./theme.js

Testing

  • Framework: Use Bun's built-in test runner
  • Structure: Group tests with describe(), use descriptive test names
  • Coverage: Test public interfaces, not implementation details
  • Mocking: Mock external dependencies (file system, network, CLI commands)

Error Handling Patterns

// CLI commands
try {
  await executor.run();
} catch (err: unknown) {
  const msg = err instanceof Error ? err.message : String(err);
  console.error(pc.red(`💥 Execution failed: ${msg}`));
  process.exit(1);
}

// File operations
try {
  await writeFile(path, content, "utf-8");
} catch (e) {
  throw new Error(`Failed to write state to ${path}: ${e}`);
}

Git & Session Management

  • Worktrees: Sessions execute in isolated git worktrees
  • State Persistence: All state must be serializable to JSON via Zod schemas
  • Cleanup: Always clean up resources (worktrees, processes, event listeners)
  • Idempotency: Operations should be safe to retry

Performance Considerations

  • Streaming: Use streaming APIs for CLI output and large data
  • Lazy Loading: Initialize TUI components only when needed
  • Memory: Clean up event listeners and intervals in component lifecycle
  • Throttling: Rate-limit expensive operations like file system scans

Security Best Practices

  • No Secrets: Never commit API keys, tokens, or sensitive data
  • Input Validation: Validate all user input with Zod schemas
  • Command Injection: Use parameterized arrays for exec commands
  • Path Safety: Validate and sanitize file paths, prevent directory traversal

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.