agentleFS
vscarpentervscarpenter/gsd-task-manager/.github/copilot-instructions.md

gsd-task-manager

Copilot instructions26 starsChanged 2 months agoMITView on GitHub

This guide enables AI coding agents to work productively in the GSD Task Manager codebase. Follow these project-specific conventions and workflows for best results.

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

21 rules. About 0 are common, 5 are distinctive, and 16 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.

  • 16

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Next.js 16 App Router: All routes in app/. Matrix view: app/(matrix)/page.tsx.

    line 8
  2. Very specific:

    Client-side only: No server rendering. All components use "use client".

    line 9
  3. Very specific:

    Pure analytics functions: All metric calculations in lib/analytics/ are side-effect-free for testability and composability.

    line 25
  4. Very specific:

    Dialogs: All use Radix UI Dialog primitive.

    line 33
  5. Very specific:

    20 Tools: Read (7), Write (5), Analytics (5), System (3).

    line 50
  6. Very specific:

    Strict mode: Always. Next.js typed routes enabled.

    line 81
  7. Very specific:

    Imports: Use @/ alias for all internal imports (configured in tsconfig.json).

    line 83
  8. Very specific:

    Dark Mode: Use next-themes. Classes: dark:bg-gray-900 etc.

    line 87
  9. Very specific:

    Live reactivity: Use useLiveQuery() from dexie-react-hooks for real-time updates.

    line 90
  10. Very specific:

    Validation: Always validate with Zod schemas before persisting to IndexedDB.

    line 91
  11. Very specific:

    Error handling: Use try/catch with structured logging (lib/logger.ts).

    line 92
  12. Very specific:

    Toast notifications: Use toast.error() / toast.success() from sonner for user-facing messages.

    line 93
  13. Very specific:

    Circular dependencies: Always validate with wouldCreateCircularDependency() (BFS algorithm in lib/dependencies.ts) before adding …

    line 97
  14. Very specific:

    Transaction-based bulk ops: Use db.transaction('rw', [...tables], async () => { ...

    line 98
  15. Distinctive:

    Optimize for the next developer: Write code easy to maintain and understand.

    line 105
  16. Distinctive:

    YAGNI: Don't build for hypothetical future needs.

    line 110
  17. Very specific:

    Conventional Commits: Use feat:, fix:, docs:, test:, etc.

    line 130
  18. Distinctive:

    Client-side only: No server rendering or network dependencies (except optional sync).

    line 136
  19. Very specific:

    Manifest & Icons: Update public/manifest.json, icons, and public/sw.js together.

    line 137
  20. Distinctive:

    Data: All user data stays local by default.

    line 138
  21. Distinctive:

    Feedback Welcome: If any section is unclear or missing, please provide feedback to improve these instructions.

    line 150

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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
copilot-instructions.md

Copilot Instructions for GSD Task Manager

This guide enables AI coding agents to work productively in the GSD Task Manager codebase. Follow these project-specific conventions and workflows for best results.

Architecture Overview

Core Stack

  • Next.js 16 App Router: All routes in app/. Matrix view: app/(matrix)/page.tsx. Dashboard: app/(dashboard)/dashboard/page.tsx. PWA install: app/(pwa)/install/page.tsx.
  • Client-side only: No server rendering. All components use "use client".
  • Data Layer: IndexedDB via Dexie v4 (lib/db.ts, current schema v13). CRUD in lib/tasks.ts. Live queries via useTasks() hook (lib/use-tasks.ts).
  • Quadrant System: Tasks classified by urgent/important booleans → 4 quadrants. Logic in lib/quadrants.ts.
  • Schema Validation: Zod schemas in lib/schema.ts for all data types.

Database Schema (v13)

  • Tables: tasks, archivedTasks, smartViews, notificationSettings, syncQueue, syncMetadata, deviceInfo, archiveSettings, syncHistory, appPreferences
  • Task Fields: Core (id, title, description, urgent, important, quadrant, completed, completedAt, dueDate, createdAt, updatedAt) + Advanced (recurrence, tags, subtasks, dependencies, notifyBefore, snoozedUntil, estimatedMinutes, timeSpent, timeEntries)
  • Indexes: Performance-critical indexes on quadrant, completed, dueDate, completedAt, createdAt, updatedAt, *tags, *dependencies, notificationSent
  • Migrations: Schema changes always require migration in lib/db.ts. See DATABASE_ARCHITECTURE.md for full ERD.
  • Schema change checklist: Zod schema changes typically require updates in three places: lib/constants/schema.ts (add/update limits), taskDraftSchema in lib/schema.ts, and taskRecordImportSchema in lib/schema.ts (a separate definition that uses .strip() — not derived from the draft schema for validation rules).

Key Architectural Decisions

  1. PocketBase cloud sync: Optional cloud sync via self-hosted PocketBase server. Tasks stored as plaintext (user owns the server). OAuth authentication with Google/GitHub.
  2. Last-write-wins conflict resolution: Conflicts resolved using client_updated_at timestamps. BFS algorithm prevents circular dependencies in task graph.
  3. Modular components: Large files split into <300 line modules. Example: lib/sync/ has 20+ focused modules vs monolithic sync engine.
  4. Pure analytics functions: All metric calculations in lib/analytics/ are side-effect-free for testability and composability.
  5. Transaction-based batch operations: lib/bulk-operations.ts ensures atomicity (all-or-nothing) for multi-task updates.

Component Patterns

UI Components

  • Primitives (components/ui/): shadcn-style components (button, dialog, input, etc.). No size prop on buttons—use variant: "primary" | "subtle" | "ghost".
  • Domain Components: matrix-board/ (modular orchestration), matrix-column.tsx, task-card.tsx, task-form/ (modular form with validation hook).
  • Dialogs: All use Radix UI Dialog primitive. Example: import-dialog.tsx, bulk-tag-dialog.tsx.
  • Hooks: Custom hooks like useTasks(), useViewTransition(), useSmartViewShortcuts() encapsulate complex logic.

Smart Views & Command Palette

  • Smart Views: Saved filter configurations (smartViews table). Pin up to 5 in header with keyboard shortcuts (1-9, 0=clear).
  • Command Palette: Global ⌘K/Ctrl+K shortcut (command-palette.tsx). Includes quick actions, navigation, and search.
  • Settings: Single consolidated dialog (components/settings/settings-dialog.tsx) with iOS-style grouped sections (Appearance, Notifications, Cloud Sync, Archive, Data & Storage, About). Opened directly from the header gear icon — no intermediate "quick" panel.

Sync Architecture

  • Frontend: lib/sync/ with modular architecture: pb-sync-engine.ts (push/pull), pb-realtime.ts (SSE subscriptions), pb-auth.ts (OAuth), pocketbase-client.ts (SDK singleton), task-mapper.ts (field mapping), sync-coordinator.ts (orchestrator).
  • Backend: Self-hosted PocketBase server at https://api.vinny.io (AWS EC2). OAuth with Google/GitHub. API rules enforce per-user data isolation.
  • Realtime: PocketBase SSE (Server-Sent Events) for instant cross-device updates with echo filtering via device_id.
  • Device-local fields: notificationSent, lastNotificationAt, and snoozedUntil are device-local state — never overwritten from remote on sync pull. pocketBaseToTaskRecord() accepts an optional existingLocal parameter; callers must pass the existing local task to preserve these fields.

MCP Server Integration

  • Purpose: Enable Claude Desktop to access/analyze tasks via natural language.
  • Location: packages/mcp-server/ (standalone npm package, Node.js 18+).
  • 20 Tools: Read (7), Write (5), Analytics (5), System (3). All write operations support dryRun mode.
  • Config: ~/Library/Application Support/Claude/claude_desktop_config.json with GSD_POCKETBASE_URL, GSD_AUTH_TOKEN.

Developer Workflows

Essential Commands

  • bun install — Install deps (generates bun.lock)
  • bun dev — Dev server at http://localhost:3000
  • bun typecheck — TypeScript type checking (no emit)
  • bun lint — ESLint with Next.js config
  • bun run test — Vitest CI mode (not bun test — that invokes bun's built-in runner, not Vitest)
  • bun run test -- tests/data/tasks.test.ts — Run a single test file
  • bun run test -- -t "test name pattern" — Run tests matching a name pattern
  • bun run test:watch — Vitest watch mode
  • bun run test -- --coverage — Coverage report (target: ≥80% statements/lines/functions, ≥75% branches)
  • bun run build — Production build (includes typecheck)
  • bun run export — Static export for S3/CloudFront

CloudFront Deployment

  • Why: S3 doesn't auto-serve index.html for directory paths. Need CloudFront Function for SPA routing.
  • Deploy: ./scripts/deploy-cloudfront-function.sh after adding new App Router routes.
  • Full Deploy: bun run deploy (builds, syncs to S3, invalidates CloudFront)

MCP Server Development

  • Build: npm run build in packages/mcp-server/
  • Test: npm test (unit tests with dry-run validation)
  • CLI: gsd-mcp setup (interactive config), gsd-mcp validate (config validation)

Coding Conventions

TypeScript & Naming

  • Strict mode: Always. Next.js typed routes enabled.
  • Naming: PascalCase for components/types, camelCase for functions/variables, kebab-case for files/folders.
  • Imports: Use @/ alias for all internal imports (configured in tsconfig.json).

Styling

  • Tailwind: Group classes by layout → spacing → color. Shared utilities in app/globals.css.
  • Dark Mode: Use next-themes. Classes: dark:bg-gray-900 etc.

Patterns to Follow

  1. Live reactivity: Use useLiveQuery() from dexie-react-hooks for real-time updates.
  2. Validation: Always validate with Zod schemas before persisting to IndexedDB. Use .safeParse() (not .parse()) on all user-input paths.
  3. Error handling: Use try/catch with structured logging (lib/logger.ts). Sanitize secrets in logs.
  4. Toast notifications: Use toast.error() / toast.success() from sonner for user-facing messages. Do not use the legacy useToast() hook from components/ui/toast.tsx — it has a different API and is being phased out. Never use window.alert().
  5. Structured logging: createLogger() requires a value from the LogContext union type in lib/logger.ts (e.g., 'UI', 'IMPORT', 'SYNC_ENGINE', 'TASK_CRUD'). Check the type definition before adding a new logger — add a new literal to the union if needed.
  6. Keyboard shortcuts: Global shortcuts in lib/shortcuts.ts. Component-level shortcuts use useEffect with event listeners.
  7. Recurring tasks: Auto-create next instance on completion via handleRecurrence() in lib/tasks.ts.
  8. Circular dependencies: Always validate with wouldCreateCircularDependency() (BFS algorithm in lib/dependencies.ts) before adding dependencies.
  9. Transaction-based bulk ops: Use db.transaction('rw', [...tables], async () => { ... }) for atomicity.

Coding Standards & Philosophy

Core Principles

  • Favor simplicity over cleverness: Clear, readable code > complex solutions. Optimize only when needed.
  • Start minimal and iterate: Build smallest working solution first, then enhance.
  • Optimize for the next developer: Write code easy to maintain and understand.
  • Descriptive naming: Clear names that express intent (no abbreviations unless standard).
  • Small, focused functions: Each function does one thing well. Max 20-30 lines. Early returns + guard clauses.
  • Comment "why" not "what": Code should be self-documenting. Comments explain reasoning or non-obvious logic.
  • DRY, but not prematurely: Extract after seeing repetition 3+ times. Avoid over-abstraction.
  • YAGNI: Don't build for hypothetical future needs.
  • Composition over inheritance: Build functionality by combining simple pieces.

Quality Checklist

  • Can a new team member understand this code in 5 minutes?
  • Are names self-explanatory?
  • Is the happy path clear and error handling robust?
  • Is there unnecessary complexity or cleverness?
  • Does it solve the actual problem without extra features?

Testing

Test Structure

  • UI tests: tests/ui/ with @testing-library/react and @testing-library/jest-dom
  • Data tests: tests/data/ for persistence logic
  • Coverage targets: 80% statements/lines/functions, 75% branches
  • Key patterns: Mock IndexedDB with fake-indexeddb. Test keyboard shortcuts. Cover offline scenarios.

Commit & PRs

  • Conventional Commits: Use feat:, fix:, docs:, test:, etc. Reference issues (e.g., Fixes #123).
  • PRs: Explain motivation, solution, and tests. Include screenshots for UI changes. Link to spec docs (CLAUDE.md, TECHNICAL.md).
  • Rebase: Rebase before review. Wait for green lint/test/build status.

PWA & Privacy

  • Client-side only: No server rendering or network dependencies (except optional sync).
  • Manifest & Icons: Update public/manifest.json, icons, and public/sw.js together. Test with bun run export.
  • Data: All user data stays local by default. Export/import via JSON. Sync is opt-in via self-hosted PocketBase.

References

  • Product Scope: CLAUDE.md (features, architecture decisions, development notes)
  • Technical Details: TECHNICAL.md (stack, data layer, component structure, key patterns)
  • Contribution Standards: coding-standards.md (agentic behavior, solution quality, reflection)
  • Database: DATABASE_ARCHITECTURE.md (ERD, schema migrations, indexing strategy)
  • Features: GSD_FEATURES_GUIDE.md (user-facing feature guide)

Feedback Welcome: If any section is unclear or missing, please provide feedback to improve these instructions.

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.