adding-activity-logging
Skill by PostHog
Adds or changes activity logging, the audit trail, for a Django model in PostHog. Use it when a model's writes must appear in the Activity side panel or advanced activity logs, or when a change is missing from the log.
Install adding-activity-logging
Built from the published package, never by AI.
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.claude/skills && cp -r /tmp/posthog/.agents/skills/adding-activity-logging ~/.claude/skills/adding-activity-loggingRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install adding-activity-logging in Claude Code
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/posthog/.agents/skills/adding-activity-logging ~/.gemini/antigravity-cli/skills/adding-activity-loggingAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install adding-activity-logging in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill guides changes to activity logging, the audit trail, for a Django model in PostHog. It walks through finding every write path of a model, adding ModelActivityMixin and an ActivityScope, writing a model_activity_signal receiver module, and wiring that module into the app's ready() method. It also covers bulk writes the signal cannot see, actors outside requests, and products on a separate database.
The skill points to the internal activity logging doc and to reference implementations for feature flags and stamphog. It lists tuning options such as field exclusions, masked fields and an optional describer, plus a checklist for debugging a missing row. It is aimed at PostHog engineers who add or change audit logging for a model.
Written from the project's SKILL.md and checked against it.
What it can do
- Find write pathsLists every save, update and bulk write of a model before any code changes.
- Model and scope setupCovers ModelActivityMixin, ActivityScope in Python and TypeScript, and the OpenAPI build.
- Receiver moduleWrites one model_activity_signal receiver that calls changes_between and log_activity.
- Wiring in apps.pyImports the receiver in ready() and adds it to the setup receivers baseline.
- Bulk write loggingLogs changes from QuerySet.update and bulk_create with bulk_log_activity.
- Separate database routingPasses the writer database to log calls for products on a separate database.
- Diff tuningUses signal_exclusions, field_exclusions, field_with_masked_contents and field_name_overrides.
- Custom describerAdds an optional activityDescriber.tsx and registers it in describers.tsx.
- Missing row debuggingWorks through five distinct causes for an activity row that does not appear.
What you need
- PostHog repository with the hogli tooling
- Dev stack for running hogli build:openapi
- A Django model in the PostHog codebase
Try asking
- Add activity logging to my new Django model in PostHog
- Why is this change missing from the PostHog activity log?
- Log the bulk_create and update writes for this model in the audit trail
Good to know
- The mixin hooks save() and delete() only; bulk and raw SQL writes must be logged by hand.
- mute_selected_signals() is process-wide, so it should not wrap request paths.
- Running hogli build:openapi needs the dev stack.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/adding-activity-logging/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md6 KB
Alternatives to adding-activity-logging
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
adding-activity-logging: common questions
Does it log QuerySet.update or bulk_create writes automatically?
No. The mixin only hooks save() and delete(), so bulk writes such as QuerySet.update and bulk_create must be logged by hand with bulk_log_activity.
Where does the receiver module go?
It goes in products/<name>/backend/activity_logging.py with one mutable_receiver per model. The app's ready() method imports it so it connects in every process.
What changes for a model on a separate database?
Pass using=router.db_for_write(Model) to every log_activity and bulk_log_activity call, so the audit row is written with the product row and not before it commits.
How do I install adding-activity-logging?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is adding-activity-logging free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is adding-activity-logging safe to use?
It scores 82 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to adding-activity-logging?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
