agentleFS
sagarithmsagarithm/sagarithm-kit/CLAUDE.md

sagarithm-kit

CLAUDE.md17 starsChanged 12 days agoApache-2.0View on GitHub

  • Reads credentials

The file

Show its rules and text

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

34 rules. About 0 are common, 17 are distinctive, and 17 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 17

    Very specific

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

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

    Distinguish Symptoms from Root Cause: Do not apply superficial band-aids (e.g.

    line 28
  2. Distinctive:

    Mandatory Regression Test: Write an automated unit or integration test that reproduces the exact bug scenario.

    line 34
  3. Distinctive:

    Execute Test Runner: Run the test and confirm that it fails against the existing unpatched codebase with the reported error.

    line 35
  4. Distinctive:

    Invariant Check: If the test passes before the fix is applied, the test does not reproduce the bug.

    line 36
  5. Distinctive:

    No Opportunistic Refactors: Do not rewrite unrelated methods, rename variables, or alter untouched code.

    line 42
  6. Distinctive:

    Verify Target Fix: Run the reproducing test and confirm it now passes (Green).

    line 48
  7. Distinctive:

    Static Analysis & Types: Run linter and typecheckers to ensure syntax and contract integrity.

    line 50
  8. Very specific:

    Commit Message Discipline: Use Conventional Commits (fix(scope): concise description).

    line 56
  9. Very specific:

    Changelog Entry: Add an entry under [Unreleased] in CHANGELOG.md.

    line 61
  10. Distinctive:

    Inspect Existing Code: Search the repository for existing modules, types, and utilities handling similar domain logic.

    line 72
  11. Distinctive:

    Verify Existing Conventions: Check existing styling, naming conventions, test frameworks, and error-handling patterns.

    line 73
  12. Very specific:

    If introducing a significant architectural boundary, draft an ADR using documentation.architectural-decision-records.

    line 86
  13. Very specific:

    Dependency Admission: Do not add third-party packages if language standard libraries suffice (policy.dependency-management).

    line 95
  14. Distinctive:

    Inspect Terminal Output: Verify that all new feature tests pass with exit code 0.

    line 101
  15. Very specific:

    Static Analysis & Linting: Run project type checker and linter (tsc, npm run lint).

    line 102
  16. Distinctive:

    Zero Assumed Success: Never claim the feature works without inspecting verified passing terminal output.

    line 103
  17. Distinctive:

    Living Docs Sync: Update API specifications or developer guides affected by the change.

    line 108
  18. Very specific:

    Changelog Entry: Add an entry under [Unreleased] in CHANGELOG.md following Conventional Commits format.

    line 109
  19. Very specific:

    Atomic Commit: Commit changes with a descriptive message (feat(scope): add description).

    line 110
  20. Distinctive:

    The Invariant: Never refactor code that is currently failing tests.

    line 120
  21. Distinctive:

    Execute Baseline Suite: Run existing tests covering the target component.

    line 121
  22. Distinctive:

    Verify Public Contracts: Ensure public API signatures, return types, and exceptions remain strictly identical.

    line 128
  23. Distinctive:

    Preserve Compatibility: If moving public functions, provide temporary deprecated aliases to avoid breaking downstream consumers.

    line 135
  24. Very specific:

    Architectural Invariant Check: Run architectural fitness functions (architecture.system-design) to confirm no circular dependencies were …

    line 142
  25. Very specific:

    Diff Inspection: Verify with git diff that no external behavior or unintended files were modified (policy.change-scope).

    line 143
  26. Very specific:

    ADR Update: If the refactor changed package boundaries or module structures, update or create an ADR in docs/adr/.

    line 148
  27. Very specific:

    Conventional Commit: Commit with refactor(scope): describe internal improvement.

    line 149
  28. Very specific:

    Validate Deprecation Cycles: Verify that any breaking changes were preceded by a formal deprecation period …

    line 164
  29. Distinctive:

    Verify that migrations do not lock production tables or drop columns in active use.

    line 171
  30. Very specific:

    Environment Variable Audit: Check if new mandatory environment variables are introduced and documented in .env.example.

    line 172
  31. Very specific:

    Bump Version: Update version fields across project metadata files (package.json, Cargo.toml, pyproject.toml).

    line 177
  32. Very specific:

    Assemble Build Bundles: Run production build commands (npm run build, cargo build --release).

    line 179
  33. Very specific:

    Dependency Audit: Run dependency security scan (npm audit, pip-audit) ensuring zero high/critical CVEs.

    line 185
  34. Distinctive:

    Confirm Rollback Plan: Document the rollback procedure (e.g.

    line 196

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.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
CLAUDE.md
<!-- SAGARITHM:START - DO NOT EDIT DIRECTLY -->

CLAUDE.md — Sagarithm Engineering Guidelines

Core Philosophy

  • Understand before modifying; inspect before creating; minimal necessary change.
  • Zero assumed success: always execute tests and verify terminal output before completing tasks.

Repository Policies

  • Change Scope & Blast Radius Containment [error]: Confines code modifications strictly to the files and functions directly required to fulfill the user request.
  • Dependency Management & Supply Chain Control [error]: Restricts the introduction of third-party dependencies. Requires evaluation of native standard libraries and lockfile integrity.
  • Directory Creation & Structural Sprawl Prevention [error]: Strictly forbids the unauthorized creation of arbitrary directories, generic utility folders, or parallel folder hierarchies.
  • Documentation & ADR Synchronization [warn]: Requires synchronization of documentation, API specs, and ADRs whenever code architecture or interfaces change.
  • File Creation & Abstraction Deduplication [error]: Prevents creation of redundant files, duplicate helper abstractions, and mislocated source files.
  • Security Boundary & Secrets Containment [error]: Prohibits committing credentials, raw SQL concatenation, untrusted shell executions, and unvalidated perimeter inputs.
  • Testing Enforcement & Zero Assumed Success [error]: Mandates real terminal execution of automated tests, zero test failures, and regression tests for bug fixes.

Task Workflows

Bug Fix Workflow

Bug Fix Workflow

Overview

This workflow governs the investigation, reproduction, and resolution of software defects. It ensures bugs are permanently resolved by requiring a reproducing automated test before any fix is applied.


Phase 1: Understand & Root-Cause Diagnosis

  1. Understand Reported Defect: Analyze error logs, stack traces, expected behavior, and actual behavior.
  2. Distinguish Symptoms from Root Cause: Do not apply superficial band-aids (e.g. adding if (x) return; to silence null errors) without understanding why x was null.
  3. Trace Data Flow: Inspect callers, state transitions, and boundary inputs that led to the invalid state.

Phase 2: Reproduce with a Failing Test (Red Phase)

  1. Mandatory Regression Test: Write an automated unit or integration test that reproduces the exact bug scenario.
  2. Execute Test Runner: Run the test and confirm that it fails against the existing unpatched codebase with the reported error.
  3. Invariant Check: If the test passes before the fix is applied, the test does not reproduce the bug. Refine the test until it reliably reproduces the failure.

Phase 3: Minimal Surgical Fix (Green Phase)

  1. Minimal Necessary Change: Implement the minimal code change required to address the root cause (policy.change-scope).
  2. No Opportunistic Refactors: Do not rewrite unrelated methods, rename variables, or alter untouched code.
  3. Preserve Error Boundaries: Fix the logic while maintaining explicit typing and domain error models.

Phase 4: Verification Gate (Mandatory)

  1. Verify Target Fix: Run the reproducing test and confirm it now passes (Green).
  2. Verify Regression Suite: Execute the broader project test suite to guarantee the fix did not introduce regressions elsewhere.
  3. Static Analysis & Types: Run linter and typecheckers to ensure syntax and contract integrity.
  4. Zero Assumed Success: Inspect terminal output to confirm exit code 0.

Phase 5: Documentation & Review

  1. Commit Message Discipline: Use Conventional Commits (fix(scope): concise description).
  2. Explain Root Cause: In the commit message body, document:
    • What the root cause was.
    • How the patch fixes it.
    • What test verifies the resolution.
  3. Changelog Entry: Add an entry under [Unreleased] in CHANGELOG.md.

Feature Development Workflow

Feature Development Workflow

Overview

This workflow governs how an AI coding agent or engineer takes a user requirement from initial concept to verified production-ready code.


Phase 1: Understand & Inspect

  1. Clarify Acceptance Criteria: Break down the feature request into testable, unambiguous acceptance criteria and edge cases.
  2. Inspect Existing Code: Search the repository for existing modules, types, and utilities handling similar domain logic.
  3. Verify Existing Conventions: Check existing styling, naming conventions, test frameworks, and error-handling patterns.
  4. Enforce Policy: Apply policy.directory-creation and policy.file-creation to locate where the feature belongs in the existing hierarchy.

Phase 2: Plan & Design

  1. Determine Risk Tier:
    • Low: Localized UI tweaks, text updates.
    • Medium: Isolated internal component or utility.
    • High: Database schema change, new endpoint, third-party integration.
    • Critical: Payment processing, authentication, credentials, data deletion.
  2. Formulate Architecture:
    • Define data shapes, DTOs, and interface contracts.
    • If introducing a significant architectural boundary, draft an ADR using documentation.architectural-decision-records.
  3. Outline Test Strategy: Determine required unit tests, boundary validations, and integration tests before writing code.

Phase 3: Minimal Implementation

  1. Strictly Confine Scope: Modify only files directly required for the feature (policy.change-scope).
  2. Perimeter Validation: Validate all external inputs with schema parsers (policy.security-boundary).
  3. Strict Typing: No any or untyped objects (quality.coding-standards).
  4. Dependency Admission: Do not add third-party packages if language standard libraries suffice (policy.dependency-management).

Phase 4: Verification Gate (Mandatory)

  1. Execute Test Runner: Dispatch the test command in the terminal (npm test, pytest, cargo test).
  2. Inspect Terminal Output: Verify that all new feature tests pass with exit code 0.
  3. Static Analysis & Linting: Run project type checker and linter (tsc, npm run lint).
  4. Zero Assumed Success: Never claim the feature works without inspecting verified passing terminal output.

Phase 5: Documentation & Review

  1. Living Docs Sync: Update API specifications or developer guides affected by the change.
  2. Changelog Entry: Add an entry under [Unreleased] in CHANGELOG.md following Conventional Commits format.
  3. Atomic Commit: Commit changes with a descriptive message (feat(scope): add description).

Refactoring Workflow

Refactoring Workflow

Overview

Refactoring improves the internal design, readability, or performance of code without altering its observable behavior. This workflow ensures refactoring remains safe, incremental, and verifiable.


Phase 1: Baseline Verification

  1. The Invariant: Never refactor code that is currently failing tests.
  2. Execute Baseline Suite: Run existing tests covering the target component.
  3. Verify Baseline: Confirm tests pass with 100% success before making any code modifications. If coverage is inadequate, add characterization tests first.

Phase 2: Plan & Boundary Invariants

  1. Identify the Smell / Goal: Clearly define why the refactoring is occurring (e.g., reduce cyclomatic complexity, decouple database logic, remove code duplication).
  2. Verify Public Contracts: Ensure public API signatures, return types, and exceptions remain strictly identical.
  3. No Concurrent Feature Work: Refactoring and feature development must never be blended in the same task or commit.

Phase 3: Incremental Transformation

  1. Small Steps: Make transformations in small, isolated steps (e.g. Extract Method, Move Class, Introduce Parameter Object).
  2. Preserve Compatibility: If moving public functions, provide temporary deprecated aliases to avoid breaking downstream consumers.
  3. Adhere to Code Quality: Apply quality.coding-standards to all rewritten segments.

Phase 4: Verification Gate (Mandatory)

  1. Run Full Test Suite: Execute the test suite and confirm that all existing tests pass without modification.
  2. Architectural Invariant Check: Run architectural fitness functions (architecture.system-design) to confirm no circular dependencies were introduced.
  3. Diff Inspection: Verify with git diff that no external behavior or unintended files were modified (policy.change-scope).

Phase 5: Documentation & Review

  1. ADR Update: If the refactor changed package boundaries or module structures, update or create an ADR in docs/adr/.
  2. Conventional Commit: Commit with refactor(scope): describe internal improvement.

Release Workflow

Release Workflow

Overview

This workflow governs the preparation, verification, and deployment of software releases according to Semantic Versioning and operational safety standards.


Phase 1: Scope & SemVer Evaluation

  1. Audit Unreleased Changes: Review all commits and pull requests accumulated under [Unreleased] in CHANGELOG.md.
  2. Determine SemVer Level:
    • MAJOR: Contains any breaking API changes, dropped database columns, or altered contracts.
    • MINOR: Contains new features, new endpoints, or backward-compatible capabilities.
    • PATCH: Contains bug fixes, performance optimizations, and security patches only.
  3. Validate Deprecation Cycles: Verify that any breaking changes were preceded by a formal deprecation period (constitution/08-release-standards.md).

Phase 2: Migration & Backward-Compatibility Verification

  1. Database Schema Auditing:
    • Confirm all database migrations strictly follow the phased Expand/Contract pattern.
    • Verify that migrations do not lock production tables or drop columns in active use.
  2. Environment Variable Audit: Check if new mandatory environment variables are introduced and documented in .env.example.

Phase 3: Release Artifact Preparation

  1. Bump Version: Update version fields across project metadata files (package.json, Cargo.toml, pyproject.toml).
  2. Finalize Changelog: Move items from [Unreleased] to a versioned section [X.Y.Z] - YYYY-MM-DD in CHANGELOG.md.
  3. Assemble Build Bundles: Run production build commands (npm run build, cargo build --release).

Phase 4: Release Verification Gate (Mandatory)

  1. Full Test Suite Execution: Execute all unit, integration, and contract test suites.
  2. Dependency Audit: Run dependency security scan (npm audit, pip-audit) ensuring zero high/critical CVEs.
  3. Smoke Test Build Artifacts: Inspect generated binaries, docker containers, or bundles to confirm they launch cleanly without missing assets.
  4. Zero Assumed Success: Verified passing terminal output is required before proceeding to tagging.

Phase 5: Tagging & Rollback Readiness

  1. Create Annotated Git Tag:
    git tag -a vX.Y.Z -m "Release vX.Y.Z"
  2. Confirm Rollback Plan: Document the rollback procedure (e.g. downward database rollback script, previous container image tag).
  3. Publish Release Notes: Publish tagged release notes to repository release feeds.
<!-- SAGARITHM:END -->

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.