Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devex): add writing-tests path-rule for /writing-tests skill (#66874)

Raúl Negrón-Oterof995863e971a
diff --git a/.claude/rules/writing-tests.md b/.claude/rules/writing-tests.md
new file mode 100644
index 000000000000..7f65d63601f1
--- /dev/null
+++ b/.claude/rules/writing-tests.md
@@ -0,0 +1,21 @@
+---
+paths:
+ - '**/test_*.py'
+ - '**/*_test.py'
+ - '**/tests.py'
+ - '**/*.test.ts'
+ - '**/*.test.tsx'
+ - '**/*.spec.ts'
+ - '**/*.spec.tsx'
+---
+
+Agents keep shipping low-value test bloat here — change-detector assertions,
+redundant near-duplicates, sleep-laden waits, zero-assertion mock choreography.
+
+If this change adds a new test or substantially alters an existing one, you MUST
+invoke the `/writing-tests` skill before writing it. It carries the value gate
+("what realistic regression does this catch that no existing test does?"), the
+"don't write it" decision tree, and the efficiency bar. Do not skip it because the
+change looks small.
+
+Touching a test file for an unrelated reason (rename, formatter, import sort) is exempt.