agentleFS
aws-powertoolsaws-powertools/powertools-lambda-python/AGENTS.md

powertools-lambda-python

AGENTS.md3.3k starsChanged 2 days agoMIT-0View on GitHub

Short guide for anyone, human or coding agent, changing this repository. It points to the sources of truth instead of repeating them. Read CONTRIBUTING.md for the process and docs/adr for the premises behind the rules below. Do not run the full suite with pytest -n auto; collection differs between workers and it fails for reasons unrelated to your change.

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

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    Do not run the full suite with pytest -n auto.

    line 23
  2. Very specific:

    Add a runtime dependency. Optional features go behind an extra in pyproject.toml.

    line 37
  3. Distinctive:

    Import heavy modules at module level.

    line 38
  4. Distinctive:

    Use threads, background work or anything that assumes the process outlives the invocation.

    line 43
  5. Distinctive:

    Run the tests yourself and read the output.

    line 47
  6. Distinctive:

    If the change touches an AWS service integration (Parameters, Idempotency, Batch, Data Classes shapes, Event Handler payloads), validate it …

    line 48
  7. Distinctive:

    If you used an AI assistant, say so in the PR.

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 36,368 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
<!-- markdownlint-disable MD041 MD043 -->

Working on Powertools for AWS Lambda (Python)

Short guide for anyone, human or coding agent, changing this repository. It points to the sources of truth instead of repeating them. Read CONTRIBUTING.md for the process and docs/adr for the premises behind the rules below.

Before you start

  • Work from an issue that a maintainer triaged. PRs on untriaged issues usually wait or get closed.
  • One issue, one PR. Do not bundle unrelated fixes, even small ones.
  • Branch from develop. Keep the diff limited to what the issue needs; do not reformat or "improve" code you did not have to touch.

Commands

make dev                # uv sync, pre-commit hooks
make lint               # ruff format + ruff check (aws_lambda_powertools, tests, examples)
make mypy               # static typing, must pass
uv run pytest tests/unit tests/functional/<utility>      # fast loop for one utility
make test               # full unit + functional + performance, what CI runs
make pr                 # everything CI checks, run it before opening the PR

Do not run the full suite with pytest -n auto; collection differs between workers and it fails for reasons unrelated to your change.

What a PR needs to pass

  • Title follows conventional commits: fix(parameters): ..., feat(event_handler): ..., docs(...). Scope is the utility name.
  • Description contains closes #<issue> alone on its own line. Trailing text on that line breaks the related-issue check.
  • Tests for the change. A bug fix adds a test that fails on develop and passes with the fix.
  • Functional tests use the public API only, the way a customer would call it. Never test internal methods: do not call or patch private methods, do not assert on private attributes.
  • Existing tests are not modified or deleted unless the PR proves the old behaviour was a bug. Say so in the description.
  • ruff, mypy and the test suite green on Python 3.10 to 3.14. CI runs all five.
  • Behaviour changes update the docs page and its example under examples/<utility>/src/.

Things we do not do

  • Add a runtime dependency. Optional features go behind an extra in pyproject.toml; the core stays jmespath and typing-extensions. See ADR 0007.
  • Import heavy modules at module level. Cold start matters; import lazily inside the function or utility that needs it. See ADR 0002.
  • Ship boto3, botocore or their dependencies in the Lambda layer. See ADR 0004.
  • Break or change public behaviour in a minor release. If an input we accept today is wrong, warn with PowertoolsUserWarning now and raise in the next major. See ADR 0006.
  • Duplicate a code path to add a variant (async, a new event shape). Share the logic and keep the difference to the call site.
  • Change tests/events/*.json fixtures in a way that hides a bug. Add a new fixture instead.
  • Use threads, background work or anything that assumes the process outlives the invocation. See ADR 0001.

Verifying your change

  • Run the tests yourself and read the output. Do not describe runs you did not do.
  • If the change touches an AWS service integration (Parameters, Idempotency, Batch, Data Classes shapes, Event Handler payloads), validate it against the real service or a real event and say in the PR how you did it. Mocks prove the logic, not the contract.
  • If you used an AI assistant, say so in the PR. We welcome it. What we ask is the verification above, done by you.

Where things are

NeedLook at
Utility codeaws_lambda_powertools/<utility>/ or aws_lambda_powertools/utilities/<utility>/
Teststests/unit/<utility>/, tests/functional/<utility>/, tests/performance/
Sample eventstests/events/
Docs and examplesdocs/<area>/<utility>.md, examples/<utility>/src/
Project premisesdocs/adr/
Layer buildlayer_v3/
Maintainer processMAINTAINERS.md, docs/maintainers.md

Download now (ZIP)

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

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.