agentleFS
NishikantaRayNishikantaRay/InsightTrack/CLAUDE.md

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.

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
  1. Distinctive:

    PostgreSQL: All writes (tracking events, auth, site management)

    line 9
  2. Distinctive:

    DuckDB: All analytics reads (10-100× faster OLAP queries)

    line 10
  3. Very specific:

    NEVER use string interpolation in SQL queries: Always use parameterized queries ($1 for PG, ?

    line 16
  4. Very specific:

    Writes go to PostgreSQL only: Never insert/update/delete in DuckDB directly.

    line 17
  5. Distinctive:

    Analytics reads go to DuckDB only: Don't query PG for dashboard data.

    line 18
  6. Very specific:

    ES modules only: Use import/export, never require().

    line 20
  7. Very specific:

    Update docs/ after completing any feature: If a feature has a doc file in docs/ (e.g.

    line 23
  8. Distinctive:

    Use the grouped paths above as the only supported working locations for ongoing development and deployment.

    line 47
  9. Distinctive:

    When the skill and the code disagree, the code wins — fix the skill in the same change.

    line 78

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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

  1. NEVER use string interpolation in SQL queries. Always use parameterized queries ($1 for PG, ? for DuckDB).
  2. Writes go to PostgreSQL only. Never insert/update/delete in DuckDB directly.
  3. Analytics reads go to DuckDB only. Don't query PG for dashboard data.
  4. All API routes need authenticateToken middleware except tracking (/api/track/*) and auth (/api/auth/login, /api/auth/register).
  5. ES modules only. Use import/export, never require().
  6. All new UI must support dark mode via Tailwind dark: variants.
  7. Use useAnalytics hook for data fetching in React components, not raw useEffect + axios.
  8. Update docs/ after completing any feature. If a feature has a doc file in docs/ (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.
  9. Port every change to all three copies. The product lives in apps/ (this repo), appsv2/ (this repo), and the sibling traffic/ 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/                          → Documentation

Use 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 init

Skills

One skill holds all project knowledge — .claude/skills/insighttrack/ (see .claude/README.md):

  • SKILL.md — layout map, invariants, canonical patterns, commands
  • references/architecture.md — request lifecycle, sync engine, hot/cold storage, AI/MCP
  • references/patterns.md — implementation examples per layer + testing conventions
  • references/workflows.md — feature workflow, debugging, three-copy sync procedure
  • references/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 architecture
  • docs/hot-cold-analytics-architecture.md — DuckDB hot+cold data layer
  • docs/pg-duckdb-sync.md — PostgreSQL → DuckDB sync pipeline
  • docs/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)

Download now (ZIP)

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.