adding-activity-logging

adding-activity-logging is a skill for Claude Code, Codex from PostHog/posthog-foss. It costs 153 tokens per session (1,761 once invoked), scanned A, original, MIT.

A guide for adding an activity log, also called an audit trail, to Django model changes. Django is a Python web framework, and the guide covers recording who changed data and what changed.

In plain words
What is it for?
Use it when adding activity history to a Django model, handling different write paths, describing changes, or excluding unimportant fields from the log.
Why use it?
It prevents important updates from disappearing from the history, especially when code changes data through bulk operations, webhooks, background tasks, or direct database queries. It helps produce a more complete record of changes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when adding activity history to a Django model, handling different write paths, describing changes, or excluding unimportant fields from the log.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/posthog/posthog-foss/adding-activity-logging
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add PostHog/posthog-foss --skill adding-activity-logging
Clone the repo
git clone --depth 1 https://github.com/PostHog/posthog-foss

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for adding-activity-logging

README.md
[![agentmods](https://agentmods.dev/badge/skills/posthog/posthog-foss/adding-activity-logging/github.svg)](https://agentmods.dev/skills/posthog/posthog-foss/adding-activity-logging)
Your own site
<a href="https://agentmods.dev/skills/posthog/posthog-foss/adding-activity-logging"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/adding-activity-logging/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for adding-activity-logging

Your own site · 80×15
<a href="https://agentmods.dev/skills/posthog/posthog-foss/adding-activity-logging"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/adding-activity-logging.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 153 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,761 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00153 $0.01761
Opus 5.5 $0.00061 $0.00704
Sonnet 5.5 $0.00031 $0.00352
Haiku 4.5 $0.00015 $0.00176

Measured 2d ago against content hash 68349e3f4155, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

adding-activity-logging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/adding-activity-logging/SKILL.md · 135 lines

How it starts

The opening of the file, as written. The whole thing — 135 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Adding activity logging

Read docs/internal/activity-logging.md first. It carries the pipeline, the file locations, and the reasons. This skill carries the workflow and the gates.

Reference implementation: products/feature_flags/backend/activity_logging.py with its apps.py. Separate-database reference: products/stamphog/backend/activity_logging.py.

Step 1 - Find every write path before you touch the model

The mixin hooks save() and delete(). It does not see QuerySet.update(), bulk_create(), bulk_update(), or raw SQL. A receiver that logs only the API path gives an audit trail that says nobody changed a row a webhook changed.

rg -n "Thing\.objects|Thing\.all_teams" products/<name>/ --type py | rg -v "tests/"
rg -n "\.update\(|bulk_create\(|bulk_update\(" products/<name>/backend --type py

Write the list down: which paths call save() (the mixin covers them) and which do bulk writes (you log those by hand in step 5). Include tasks, Temporal activities, webhook handlers, and management commands.

Step 2 - Model and scope

  • Add ModelActivityMixin first in the bases: class Thing(ModelActivityMixin, TeamScopedRootMixin, ...).
  • Set activity_logging_on_delete = True only when a hard delete must show in the log.
  • Add the class name to ActivityScope in posthog/models/activity_logging/activity_log.py.
  • Add the same string to the ActivityScope enum in frontend/src/types.ts.
  • Run hogli build:openapi (needs the dev stack) because the API scope filter enum is generated from the Literal.

No migration is needed. The mixin adds no field.

Step 3 - Receiver module

Create products/<name>/backend/activity_logging.py. One @mutable_receiver(model_activity_signal, sender=Thing) per model. The receiver calls changes_between and log_activity; nothing else.

Keep the module import-light. It must not import a viewset, a serializer, or a query runner. ready() imports it at django.setup() in every process.

Read the full file on GitHub · 135 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago Changed 68349e3f4155
  2. 3d ago Changed · -1 lines 45e6cc0a9482
  3. 10d ago Changed · -2 lines fd45177dbce8
  4. 15d ago Changed · +21 lines f7e738c13e26
  5. 3mo ago First seen · 117 lines · 153 tokens per session scan A 5233c4312671

Subscribe to this mod's changes

adding-activity-logging is a skill published in the GitHub repository PostHog/posthog-foss (736 stars, last pushed today), licensed MIT. It adds 153 tokens to every session and 1,761 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

adding-activity-logging compared with skills from other repositories

adding-activity-logging next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
adding-activity-loggingPostHog/posthog-fossSkill736todayMITA153Claude Code, Codex
event-store-designwshobson/agentsSkill43kyesterdayMITA33Claude Code
durable-objectsfcakyon/claude-codex-settingsSkill1.2kyesterdayApache-2.0A22Claude Code
platform-custom-field-generateforcedotcom/sf-skillsSkill1.2k6d agoApache-2.0A139Claude Code
field-service-sobject-create-configureforcedotcom/sf-skillsSkill1.2k6d agoApache-2.0A74Claude Code
nornicdb-grpcorneryd/NornicDBSkill936todayMITA98Claude Code, Codex
firebaseericrisco/rsc-harnessSkill707yesterdayMITA77Claude Code, Codex