InsightTrack
CLAUDE.md15 starsChanged 3 months agoMITView on GitHub
This file is read automatically by Claude when working on this project. InsightTrack — self-hosted web analytics platform with a dual-database architecture. The canonical project knowledge lives in the insighttrack skill at .claude/skills/insighttrack/SKILL.md (auto-discovered by Claude Code): repo layout map, architecture, coding patterns, workflows, and the three-copy sync procedure. Read it before non-trivial work. Usage & maintenance guide: docs/claude-skill.md. Use the grouped paths above as the only supported working locations for ongoing development and deployment. One skill holds all project…
In this repositoryOne other file it gives its agents.
- insighttrackSkill
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 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.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
PostgreSQL: All writes (tracking events, auth, site management)
- Distinctive: line 10
DuckDB: All analytics reads (10-100× faster OLAP queries)
- Very specific: line 16
NEVER use string interpolation in SQL queries: Always use parameterized queries ($1 for PG, ?
- Very specific: line 17
Writes go to PostgreSQL only: Never insert/update/delete in DuckDB directly.
- Distinctive: line 18
Analytics reads go to DuckDB only: Don't query PG for dashboard data.
- Very specific: line 20
ES modules only: Use import/export, never require().
- Very specific: line 23
Update
docs/after completing any feature: If a feature has a doc file in docs/ (e.g. - Distinctive: line 47
Use the grouped paths above as the only supported working locations for ongoing development and deployment.
- Distinctive: line 78
When the skill and the code disagree, the code wins — fix the skill in the same change.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 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.
Files
CLAUDE.md — InsightTrack Project Instructions
This file is read automatically by Claude when working on this project.
Project
InsightTrack — self-hosted web analytics platform with a dual-database architecture.
- PostgreSQL: All writes (tracking events, auth, site management)
- DuckDB: All analytics reads (10-100× faster OLAP queries)
- React 18 + Vite 5: Dashboard SPA with Zustand, Tailwind CSS, Recharts
- Express 4 + Node.js 20: API backend with JWT auth
Critical Rules
- NEVER use string interpolation in SQL queries. Always use parameterized queries (
$1for PG,?for DuckDB). - Writes go to PostgreSQL only. Never insert/update/delete in DuckDB directly.
- Analytics reads go to DuckDB only. Don't query PG for dashboard data.
- All API routes need
authenticateTokenmiddleware except tracking (/api/track/*) and auth (/api/auth/login,/api/auth/register). - ES modules only. Use
import/export, neverrequire(). - All new UI must support dark mode via Tailwind
dark:variants. - Use
useAnalyticshook for data fetching in React components, not rawuseEffect+ axios. - Update
docs/after completing any feature. If a feature has a doc file indocs/(e.g.docs/sql-editor.md,docs/custom-dashboards.md), update it to reflect the current implementation state. If no doc exists for a significant new feature, create one. - Port every change to all three copies. The product lives in
apps/(this repo),appsv2/(this repo), and the siblingtraffic/repo — keep them byte-identical after every feature (mapping:dashboard-web ⇄ analytics-dashboard,analytics-api ⇄ analytics-db). Sync procedure:.claude/skills/insighttrack/references/workflows.md.
Project Skill
The canonical project knowledge lives in the insighttrack skill at
.claude/skills/insighttrack/SKILL.md (auto-discovered by Claude Code): repo
layout map, architecture, coding patterns, workflows, and the three-copy sync
procedure. Read it before non-trivial work. Usage & maintenance guide:
docs/claude-skill.md.
Package Structure
apps/dashboard-web/ → Frontend (React, Vite, port 4173)
apps/analytics-api/ → Unified backend (Express + PostgreSQL + DuckDB)
archive/analytics-api-legacy/ → Legacy backend kept for reference
examples/demo-blog/ → Demo site with tracking script
examples/demo-website/ → Demo site with tracking script
marketing/landing-page/ → Marketing landing page
design/pencil-new.pen → Pencil design source
docs/ → DocumentationUse the grouped paths above as the only supported working locations for ongoing development and deployment.
Quick Commands
# Dev
cd apps/dashboard-web && npm run dev
cd apps/analytics-api && npm start
# Test
cd apps/dashboard-web && npm test
cd apps/analytics-api && npm test
cd apps/dashboard-web && npx playwright test
# Docker
docker-compose up --build
docker-compose down -v
# DB
cd apps/analytics-api && npm run migrate && npm run seed && npm run initSkills
One skill holds all project knowledge — .claude/skills/insighttrack/ (see .claude/README.md):
SKILL.md— layout map, invariants, canonical patterns, commandsreferences/architecture.md— request lifecycle, sync engine, hot/cold storage, AI/MCPreferences/patterns.md— implementation examples per layer + testing conventionsreferences/workflows.md— feature workflow, debugging, three-copy sync procedurereferences/review-security.md— code/PR review checklists, threat model, OWASP audit
When the skill and the code disagree, the code wins — fix the skill in the same change.
Feature Docs
Implementation guides are in docs/:
docs/sql-editor.md— SQL Editor feature guide (API, security model, schema)docs/custom-dashboards.md— Custom Dashboard builder (data model, widget catalogue, grid layout)docs/reporting-studio.md— Reporting Studio & export architecturedocs/hot-cold-analytics-architecture.md— DuckDB hot+cold data layerdocs/pg-duckdb-sync.md— PostgreSQL → DuckDB sync pipelinedocs/ai-analyst.md— Pulse (AI analyst) user guide (in-panel use, BYO key, Claude Desktop/MCP setup)docs/mcp-toolkit.md— MCP toolkit architecture & build phases (registry, assistant service, MCP server)docs/search-visibility-connector.md— Search Visibility (SerpApi × traffic correlation, MCP tools, fixture mode)docs/analyst-benchmark.md— InsightTrack Analyst Bench (Kaggle benchmark for Pulse's model; re-run its tests after changing correlationService.js, the tool registry, or the events/sessions schema)
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
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.

