Skip to content

docs: add KNOWLEDGE.md with codebase patterns and conventions#174

Open
shazzar00ni wants to merge 6 commits into
mainfrom
feature/knowledge-patterns-conventions
Open

docs: add KNOWLEDGE.md with codebase patterns and conventions#174
shazzar00ni wants to merge 6 commits into
mainfrom
feature/knowledge-patterns-conventions

Conversation

@shazzar00ni

@shazzar00ni shazzar00ni commented Apr 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds KNOWLEDGE.md documenting 12 key patterns and conventions from the codebase
  • Covers architecture, testing, UI components, theme system, accessibility, and dev setup
  • Captures knowledge that wasn't formally documented (follows AGENTS.md PR workflow)

Changes

  • New file: KNOWLEDGE.md with patterns including:
    1. Centralized content management
    2. CSS class utility (cn())
    3. Lazy loading strategy
    4. UI component library
    5. Theme system architecture
    6. Testing patterns and mocks
    7. Analytics integration
    8. Custom color palette & animations
    9. Environment variable conventions
    10. Error & state patterns
    11. Accessibility patterns
    12. Dev server configuration

Testing Steps

  • Open the project in your editor and verify KNOWLEDGE.md renders correctly
  • Confirm all 12 sections are present and accurate
  • Review for completeness and clarity

Open in Devin Review

Copilot AI review requested due to automatic review settings April 30, 2026 12:41
@vercel

vercel Bot commented Apr 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docugen Ready Ready Preview, Comment May 4, 2026 9:51am

@coderabbitai

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@shazzar00ni has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 4 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3049e3cf-dc3b-4683-8dba-bab0c74dc645

📥 Commits

Reviewing files that changed from the base of the PR and between 249a38c and 4def0ce.

📒 Files selected for processing (1)
  • KNOWLEDGE.md

Walkthrough

Adds a new KNOWLEDGE.md documenting established implementation conventions: content sourcing and exports, cn() classname usage, eager/lazy route/component loading, shared UI prop APIs, theme provider behavior, testing/mocking patterns, Plausible analytics injection, Tailwind extensions, env var rules, error boundary/FAQ patterns, accessibility notes, and dev/E2E URLs. (50 words)

Changes

Cohort / File(s) Summary
Documentation
KNOWLEDGE.md
New markdown file capturing project-wide conventions: content/export patterns, className composition with cn(), eager vs. lazy loading and Suspense fallback, shared UI component prop/variant expectations, theme provider persistence and Tailwind dark toggle, global test co-location and mocks, conditional Plausible script via VITE_PLAUSIBLE_DOMAIN, Tailwind color/animation/font extensions, import.meta.env VITE_ client env rule, error boundary & FAQ state patterns, accessibility attribute guidance, and dev/E2E URLs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Poem

📚 Conventions inked, the roadmap clear,
Small truths of code for all to hear,
Themes and tests and className song,
A single file to guide along,
✨ Knowledge kept for those who steer

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main change: adding KNOWLEDGE.md with codebase patterns and conventions.
Description check ✅ Passed The description is clearly related to the changeset, providing a structured summary of the new documentation file with 12 key patterns and testing steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/knowledge-patterns-conventions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 56 minutes and 4 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production

codacy-production Bot commented Apr 30, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

coderabbitai[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new KNOWLEDGE.md document to capture key architectural patterns and conventions used across the DocuGen codebase, aiming to centralize tribal knowledge and align with the repo’s documented workflow.

Changes:

  • Introduces KNOWLEDGE.md documenting patterns across content organization, UI components, theme, testing, analytics, a11y, and dev setup.
  • Provides concrete references to existing files (e.g., src/data/content.ts, src/App.tsx, src/lib/ThemeContext.tsx, tailwind.config.js).
  • Records dev/test conventions and configuration expectations (ports, env vars, test setup).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread KNOWLEDGE.md Outdated
Comment thread KNOWLEDGE.md Outdated
Comment on lines +102 to +107
**Location:** `src/lib/ThemeContext.tsx`

### Components

- `ThemeProvider` - wraps app, manages state
- `useTheme()` - hook for components (throws if used outside provider)

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useTheme() hook is not defined in src/lib/ThemeContext.tsx; it lives in src/lib/useTheme.ts and imports ThemeContext from ThemeContext.tsx. Please update this section’s “Location”/component breakdown so readers can find the hook in the correct file.

Suggested change
**Location:** `src/lib/ThemeContext.tsx`
### Components
- `ThemeProvider` - wraps app, manages state
- `useTheme()` - hook for components (throws if used outside provider)
**Locations:**
- `src/lib/ThemeContext.tsx` - `ThemeProvider`, `ThemeContext`, `Theme` type
- `src/lib/useTheme.ts` - `useTheme()` hook for components (throws if used outside provider)
### Components
- `ThemeProvider` - wraps app, manages state
- `ThemeContext` - shared context consumed by the hook
- `useTheme()` - hook for components

Copilot uses AI. Check for mistakes.
Comment thread KNOWLEDGE.md Outdated

```typescript
// Environment variable
VITE_PLAUSIBLE_DOMAIN = your - domain.com;

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable example is formatted like JavaScript/TypeScript and includes spaces/semicolon (VITE_PLAUSIBLE_DOMAIN = your - domain.com;), which is not a valid .env entry and is easy to copy/paste incorrectly. Please change it to a correct .env example (e.g. VITE_PLAUSIBLE_DOMAIN=your-domain.com).

Suggested change
VITE_PLAUSIBLE_DOMAIN = your - domain.com;
VITE_PLAUSIBLE_DOMAIN=your-domain.com

Copilot uses AI. Check for mistakes.
Comment thread KNOWLEDGE.md Outdated
Comment thread KNOWLEDGE.md Outdated
Comment on lines +228 to +229
- Preview command serves production build on same port
- E2E tests target `http://localhost:5173` (Playwright default)

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The port details here are internally inconsistent with the repo configuration: vite.config.ts sets the dev server to 3000, but playwright.config.ts configures webServer.port/baseURL as 5173. Also, vite preview does not use server.port by default (it has its own preview port unless configured). Please update this section to reflect the actual ports being used, or adjust the configs so dev/e2e/preview are aligned.

Suggested change
- Preview command serves production build on same port
- E2E tests target `http://localhost:5173` (Playwright default)
- `vite preview` does **not** automatically reuse `server.port`; its preview port must be configured separately if you want it to match dev
- E2E tests currently target `http://localhost:5173` (per Playwright configuration), so dev and E2E are not using the same port

Copilot uses AI. Check for mistakes.
@shazzar00ni shazzar00ni self-assigned this Apr 30, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
KNOWLEDGE.md (2)

161-164: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix invalid .env example syntax on Line 163.

VITE_PLAUSIBLE_DOMAIN = your - domain.com; is not a valid .env assignment and is error-prone for copy/paste setup.

Proposed fix
- VITE_PLAUSIBLE_DOMAIN = your - domain.com;
+ VITE_PLAUSIBLE_DOMAIN=your-domain.com
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@KNOWLEDGE.md` around lines 161 - 164, The .env example for
VITE_PLAUSIBLE_DOMAIN is invalid; replace the current token
`VITE_PLAUSIBLE_DOMAIN = your - domain.com;` with a proper .env assignment by
removing spaces and the semicolon and using a single equals with a placeholder
domain (e.g., VITE_PLAUSIBLE_DOMAIN=your-domain.com) so `VITE_PLAUSIBLE_DOMAIN`
is a valid environment variable in KNOWLEDGE.md.

228-230: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Resolve contradictory port guidance between dev server and E2E target.

Line 228 says local dev runs on 3000, while Line 230 says E2E targets 5173. Clarify context (e.g., configured app URL vs Playwright default) so developers don’t run tests against the wrong host.

Proposed wording
- - E2E tests target `http://localhost:5173` (Playwright default)
+ - E2E tests should target the app base URL configured in Playwright (do not assume `5173` if Vite is configured for `3000`)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@KNOWLEDGE.md` around lines 228 - 230, Text in KNOWLEDGE.md contradicts ports:
it states Vite dev server runs on port 3000 (configured in vite.config.ts) but
says E2E tests target http://localhost:5173 (Playwright default); update the
wording to clarify that the app's configured dev/preview URL comes from
vite.config.ts (port 3000) and that Playwright by default uses 5173 unless
overridden, and instruct developers to set Playwright's baseURL or the test
target to match the configured dev server (or run the dev server on 5173) so
tests point to the correct host.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@KNOWLEDGE.md`:
- Line 234: Update the "Last updated" date string in KNOWLEDGE.md by replacing
the existing "_Last updated: 2026-04-24_" text with "_Last updated: 2026-04-30_"
so the file reflects the PR creation date; locate the exact string "_Last
updated: 2026-04-24_" and change only the date portion.

---

Duplicate comments:
In `@KNOWLEDGE.md`:
- Around line 161-164: The .env example for VITE_PLAUSIBLE_DOMAIN is invalid;
replace the current token `VITE_PLAUSIBLE_DOMAIN = your - domain.com;` with a
proper .env assignment by removing spaces and the semicolon and using a single
equals with a placeholder domain (e.g., VITE_PLAUSIBLE_DOMAIN=your-domain.com)
so `VITE_PLAUSIBLE_DOMAIN` is a valid environment variable in KNOWLEDGE.md.
- Around line 228-230: Text in KNOWLEDGE.md contradicts ports: it states Vite
dev server runs on port 3000 (configured in vite.config.ts) but says E2E tests
target http://localhost:5173 (Playwright default); update the wording to clarify
that the app's configured dev/preview URL comes from vite.config.ts (port 3000)
and that Playwright by default uses 5173 unless overridden, and instruct
developers to set Playwright's baseURL or the test target to match the
configured dev server (or run the dev server on 5173) so tests point to the
correct host.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2caab3e8-f466-4dc8-bdfd-0c1693641daf

📥 Commits

Reviewing files that changed from the base of the PR and between 82e90ec and 249a38c.

📒 Files selected for processing (1)
  • KNOWLEDGE.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Codacy Security Scan
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: shazzar00ni/docugen PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T16:01:51.517Z
Learning: Applies to src/data/content.ts : Use developer-focused tone: confident, technical, no marketing fluff
📚 Learning: 2026-02-17T16:01:51.517Z
Learnt from: CR
Repo: shazzar00ni/docugen PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T16:01:51.517Z
Learning: Applies to src/data/content.ts : Use developer-focused tone: confident, technical, no marketing fluff

Applied to files:

  • KNOWLEDGE.md
📚 Learning: 2026-02-17T16:01:51.517Z
Learnt from: CR
Repo: shazzar00ni/docugen PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T16:01:51.517Z
Learning: Applies to src/components/**/*.tsx : Place all text copy and site configuration in `src/data/content.ts`; never hardcode text in components

Applied to files:

  • KNOWLEDGE.md
📚 Learning: 2026-02-17T16:01:51.517Z
Learnt from: CR
Repo: shazzar00ni/docugen PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T16:01:51.517Z
Learning: Applies to src/data/content.ts : Avoid lorem ipsum; use realistic placeholder text

Applied to files:

  • KNOWLEDGE.md
📚 Learning: 2026-02-17T16:01:51.517Z
Learnt from: CR
Repo: shazzar00ni/docugen PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T16:01:51.517Z
Learning: Applies to src/data/content.ts : Use 'you/your' for direct address in copy

Applied to files:

  • KNOWLEDGE.md
📚 Learning: 2026-02-17T16:01:51.517Z
Learnt from: CR
Repo: shazzar00ni/docugen PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T16:01:51.517Z
Learning: Applies to src/components/**/*.tsx : Use PascalCase for component files and component names (e.g., `HeroSection`, `PricingCard`)

Applied to files:

  • KNOWLEDGE.md
📚 Learning: 2026-02-17T16:01:51.517Z
Learnt from: CR
Repo: shazzar00ni/docugen PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T16:01:51.517Z
Learning: Applies to src/**/*.{ts,tsx,js,jsx} : Use SCREAMING_SNAKE_CASE for constants (e.g., `SITE_CONFIG`)

Applied to files:

  • KNOWLEDGE.md
📚 Learning: 2026-02-17T16:01:51.517Z
Learnt from: CR
Repo: shazzar00ni/docugen PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T16:01:51.517Z
Learning: Applies to src/components/**/*.tsx : Avoid arbitrary Tailwind values (`[...]`); extend theme instead

Applied to files:

  • KNOWLEDGE.md

Comment thread KNOWLEDGE.md

---

_Last updated: 2026-04-24_

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the “Last updated” date to match this PR change date.

Line 234 shows 2026-04-24, but this PR was created on 2026-04-30.

Proposed fix
- _Last updated: 2026-04-24_
+ _Last updated: 2026-04-30_
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@KNOWLEDGE.md` at line 234, Update the "Last updated" date string in
KNOWLEDGE.md by replacing the existing "_Last updated: 2026-04-24_" text with
"_Last updated: 2026-04-30_" so the file reflects the PR creation date; locate
the exact string "_Last updated: 2026-04-24_" and change only the date portion.

devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 new potential issues.

Open in Devin Review

Comment thread KNOWLEDGE.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 KNOWLEDGE.md placed at root rather than docs/ directory

AGENTS.md prescribes docs/ as the directory for "Documentation files" and lists ARCHITECTURE.md, DEVELOPMENT.md, etc. there. KNOWLEDGE.md covers similar content (architectural patterns, conventions) and could arguably belong in docs/. However, there's existing precedent for root-level markdown files (DEPLOYMENT.md, ISSUES.md, SECURITY.md, CODE_OF_CONDUCT.md) that aren't in docs/ either. The distinction seems to be project governance/meta files at root vs. detailed technical docs in docs/. KNOWLEDGE.md straddles this line - it's a meta file about how to work in the codebase (like AGENTS.md) but also contains detailed technical documentation (like ARCHITECTURE.md). Not flagged as a rule violation since the AGENTS.md file organization section is descriptive of existing structure rather than an explicit prohibition on root-level docs.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread KNOWLEDGE.md Outdated
Comment thread KNOWLEDGE.md
Comment on lines +1 to +3
# Knowledge: DocuGen Patterns & Conventions

This document captures architectural decisions, patterns, and conventions that are implemented in the codebase but not formally documented elsewhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Significant content overlap with docs/ARCHITECTURE.md

KNOWLEDGE.md covers topics that substantially overlap with docs/ARCHITECTURE.md: lazy loading strategy (section 3), component architecture (section 4), theme system (section 5), and more. For example, both documents describe the lazy loading pattern in App.tsx, the theme context system, and the centralized content management approach. This creates a maintenance burden where changes need to be reflected in two places. The KNOWLEDGE.md intro says it captures things "not formally documented elsewhere" but much of it IS documented in ARCHITECTURE.md.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants