Skip to content

(chore) Add comprehensive agent guides and update development documentation [DA-393]#320

Merged
Mr-Quin merged 3 commits intomasterfrom
claude/document-for-agents-nblDM
Mar 7, 2026
Merged

(chore) Add comprehensive agent guides and update development documentation [DA-393]#320
Mr-Quin merged 3 commits intomasterfrom
claude/document-for-agents-nblDM

Conversation

@Mr-Quin
Copy link
Owner

@Mr-Quin Mr-Quin commented Mar 7, 2026

Summary

This PR adds comprehensive AI agent guides (CLAUDE.md and per-package AGENTS.md files) and updates the main development guidelines to provide clear context for developers and AI assistants working on the Danmaku Anywhere codebase.

Key Changes

New Files

  • CLAUDE.md — Top-level agent guide covering:
    • Project overview (extension, web app, backend, shared packages)
    • Complete monorepo structure with descriptions
    • Quick reference for common commands
    • Tech stack breakdown by area
    • Key patterns and conventions (code style, TypeScript, React, Angular, backend, error handling)
    • Build order and dependency graph
    • Git hooks and CI information
    • Testing strategy
    • Common pitfalls

Updated Files

  • .junie/guidelines.md — Expanded and reorganized:

    • Added prerequisites (Node.js v24+, pnpm 10.11.0)
    • Added setup instructions and key scripts table
    • Expanded project structure with all packages and their purposes
    • Added tooling section (Biome, pnpm, Lefthook, testing, CI)
    • Reorganized TypeScript, React, Angular, and backend sections with more detail
    • Added error handling section with Result type guidance
    • Improved formatting and clarity
  • packages/danmaku-anywhere/AGENTS.md — Expanded with:

    • Purpose and tech stack details
    • Complete directory structure explanation
    • Scripts table with all available commands
    • Workspace dependencies list
    • License information (AGPL-3.0)
  • app/web/AGENTS.md — Expanded with:

    • Purpose and tech stack details
    • Key areas with file/directory descriptions
    • Scripts table with all commands
    • Workspace dependencies
    • Angular conventions reference
    • Detailed component, UI, state, and template guidelines
  • packages/danmaku-provider/AGENTS.md — Expanded with:

    • Purpose and key areas
    • Provider directory structure
    • Exports (subpath) documentation
    • Scripts table
    • Consumers and workspace dependencies
    • Update guidance
  • backend/proxy/AGENTS.md — Expanded with:

    • Purpose and tech stack
    • Key areas with file descriptions
    • Scripts table for dev, test, deploy, and migration commands
    • Workspace dependencies
    • Update guidance
  • packages/bangumi-api/AGENTS.md — Expanded with:

    • Purpose and key areas
    • Exports (subpath) documentation
    • Scripts table
    • Consumers and workspace dependencies
  • packages/danmaku-engine/AGENTS.md — Expanded with:

    • Purpose and key areas
    • Scripts table
    • Consumers and workspace dependencies
  • packages/web-scraper/AGENTS.md — Expanded with:

    • Purpose and key areas
    • Scripts table
    • Consumers and workspace dependencies
  • packages/danmaku-converter/AGENTS.md — Expanded with:

    • Purpose and key areas
    • Scripts table
    • Consumers and workspace dependencies
  • packages/integration-policy/AGENTS.md — Expanded with:

    • Purpose and key areas
    • Scripts table
    • Consumers and workspace dependencies
  • packages/result/AGENTS.md — Expanded with:

    • Purpose and key areas
    • Scripts table
    • Consumers and workspace dependencies
  • .cursor/rules/project-overview.mdc — Updated with:

    • Corrected package names and structure
    • Updated Angular version (21+)
    • Added Hono, Drizzle, Better Auth to backend stack
    • Added Dexie, Inversify, i18next, React Hook Form to React stack
    • Added key commands section
    • Improved formatting
  • .cursor/rules/angular-standards.mdc — Minor formatting fix (BOM removal)

Notable Implementation Details

  • All AGENTS.md files follow a consistent structure: Purpose, Tech stack/Key areas, Scripts, Consumers,

https://claude.ai/code/session_019sKaEkZzkjWxfWWc1ZCaWY

Add comprehensive CLAUDE.md at repo root for Claude Code and other AI
agents. Update all per-package AGENTS.md files with detailed context
including tech stacks, key areas, scripts, dependencies, and conventions.
Fix outdated/corrupted content in .cursor/rules and .junie/guidelines.md.

https://claude.ai/code/session_019sKaEkZzkjWxfWWc1ZCaWY
@Mr-Quin Mr-Quin self-assigned this Mar 7, 2026
Copilot AI review requested due to automatic review settings March 7, 2026 04:26
@Mr-Quin
Copy link
Owner Author

Mr-Quin commented Mar 7, 2026

Task linked: DA-393 Add better documentation for agents

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's documentation by introducing dedicated guides for AI agents and comprehensively updating existing development guidelines. The changes aim to provide clearer context, setup instructions, and best practices for both human developers and AI assistants, fostering better understanding and consistency across the monorepo. The updates cover project structure, technology stacks, tooling, and specific conventions for different parts of the application, streamlining the onboarding and development process.

Highlights

  • Comprehensive AI Agent Guides: Introduced a new top-level CLAUDE.md file providing a holistic overview of the project for AI agents, covering monorepo structure, tech stack, key patterns, build order, and common pitfalls. Additionally, all per-package AGENTS.md files were significantly expanded to offer detailed, consistent context for each module.
  • Enhanced Development Guidelines: The main development guidelines in .junie/guidelines.md were substantially updated and reorganized. This includes new sections on prerequisites, setup instructions, key scripts, tooling, and more detailed best practices for TypeScript, React, Angular, backend development, and error handling.
  • Updated Project Overview and Standards: The .cursor/rules/project-overview.mdc file was updated to reflect the current monorepo structure, package names, and technology stack, including new dependencies and key commands. A minor formatting correction was also applied to .cursor/rules/angular-standards.mdc.
  • Standardized Per-Package Documentation: All AGENTS.md files across various packages (app/web, backend/proxy, packages/bangumi-api, packages/danmaku-anywhere, packages/danmaku-converter, packages/danmaku-engine, packages/danmaku-provider, packages/integration-policy, packages/result, packages/web-scraper) were expanded to include consistent sections like purpose, tech stack, key areas, scripts, consumers, and workspace dependencies, ensuring comprehensive and uniform documentation.
Changelog
  • .cursor/rules/angular-standards.mdc
    • Corrected a minor formatting issue by fixing a broken word in a guideline.
  • .cursor/rules/project-overview.mdc
    • Removed a Byte Order Mark (BOM) from the file.
    • Updated the project structure to include new packages like bangumi-api, result, and integration-policy, and renamed backend/ to backend/proxy/.
    • Revised the Angular tech stack to specify Angular 21+ and added Dexie for client-side storage.
    • Expanded the React tech stack with @crxjs/vite-plugin, Inversify, i18next, and React Hook Form + Zod.
    • Updated the Backend tech stack to backend/proxy/ and added Hono, Drizzle ORM, and Better Auth.
    • Added Vitest to the Core Packages tech stack.
    • Included lefthook.yml in key configuration files.
    • Introduced a new 'Key Commands' section with common pnpm scripts for building, linting, type-checking, testing, and formatting.
  • .junie/guidelines.md
    • Updated the document's introduction to include AI agents as target audience.
    • Specified Node.js v24+ and pnpm 10.11.0 as prerequisites.
    • Added a new 'Setup' section with pnpm install and pnpm build:packages commands.
    • Introduced a 'Key Scripts (root)' table detailing common build, lint, test, and format commands.
    • Expanded the 'Project Structure' section with more detailed descriptions for each package and application, including their tech stacks and licenses.
    • Added a comprehensive 'Tooling' section covering Biome, pnpm, Lefthook, testing frameworks (Vitest, Jasmine+Karma), and CI (GitHub Actions).
    • Enhanced the 'TypeScript' section with guidelines on strict mode, type inference, unknown type usage, and import type.
    • Significantly expanded the 'React' section with detailed best practices for functional components, state management (Zustand, TanStack Query), form validation, dependency injection, internationalization, and local storage.
    • Overhauled the 'Angular' section with new sub-sections for 'Component standards', 'UI and styling', 'State and data', and 'Templates', providing granular best practices for each.
    • Added a new 'Backend' section detailing the tech stack (Hono, Drizzle, Better Auth, Zod) and deployment environment.
    • Introduced a new 'Error Handling' section recommending the Result type for explicit error management.
  • CLAUDE.md
    • Added a new file providing a comprehensive guide for AI agents, detailing the project's purpose, monorepo structure, quick reference commands, tech stack by area, key patterns and conventions (code style, TypeScript, React, Angular, Backend, error handling), build order, dependencies, Git hooks, CI, testing, and common pitfalls.
  • app/web/AGENTS.md
    • Expanded the 'Purpose' section to clarify the app's role and dependency on the browser extension.
    • Added a detailed 'Tech stack' section listing Angular 21+, PrimeNG, Tailwind CSS, TanStack Angular Query, Signals, NgRx Signals, Artplayer, Dexie, and openapi-fetch.
    • Expanded 'Key areas' with more specific file and directory descriptions.
    • Introduced a 'Scripts' table with common development commands.
    • Listed 'Workspace dependencies' for the web app.
    • Added a new 'Angular conventions' section referencing .cursor/rules/angular-standards.mdc and .junie/guidelines.md, and summarizing key Angular best practices.
    • Updated the 'When changing' section to reflect new guidelines.
  • backend/proxy/AGENTS.md
    • Expanded the 'Purpose' section to detail the backend's functions.
    • Added a comprehensive 'Tech stack' section listing Cloudflare Workers, Hono, Zod OpenAPI, Drizzle ORM, D1, Better Auth, and Sentry.
    • Expanded 'Key areas' with specific file and directory descriptions.
    • Introduced a 'Scripts' table with common development, testing, deployment, and migration commands.
    • Listed 'Workspace dependencies' for the backend proxy.
    • Updated the 'When changing' section.
  • packages/bangumi-api/AGENTS.md
    • Expanded the 'Purpose' section to clarify the role of schema types.
    • Added a 'Key areas' section detailing schema files.
    • Introduced an 'Exports (subpath)' section.
    • Added a 'Scripts' table with build, schema generation, lint, and type-check commands.
    • Listed 'Consumers' and 'Workspace dependencies'.
    • Updated the 'When changing' section with guidance on regenerating schemas.
  • packages/danmaku-anywhere/AGENTS.md
    • Expanded the 'Purpose' section to describe the extension's role.
    • Added a detailed 'Tech stack' section listing React 19, TypeScript, Vite, MUI, Zustand, TanStack Query, React Hook Form, Zod, Inversify, Dexie, and i18next.
    • Expanded 'Key areas' with specific directory and file descriptions for background, content, popup, and common shared code.
    • Introduced a 'Scripts' table with various dev, build, test, lint, and i18n commands.
    • Listed 'Workspace dependencies'.
    • Added 'License' information (AGPL-3.0).
    • Updated the 'When changing' section.
  • packages/danmaku-converter/AGENTS.md
    • Expanded the 'Purpose' section to detail danmaku parsing and normalization.
    • Added a 'Key areas' section detailing canonical formats, schemas, utilities, and public API.
    • Introduced a 'Scripts' table with build, test, dev, lint, and type-check commands.
    • Listed 'Consumers' and 'Workspace dependencies'.
    • Updated the 'When changing' section.
  • packages/danmaku-engine/AGENTS.md
    • Expanded the 'Purpose' section to describe the engine's role.
    • Added a 'Key areas' section detailing renderer class, options, parser, iterator, and plugins.
    • Introduced a 'Scripts' table with build, test, dev, lint, and type-check commands.
    • Listed 'Consumers' and 'Workspace dependencies'.
    • Updated the 'When changing' section.
  • packages/danmaku-provider/AGENTS.md
    • Expanded the 'Purpose' section to detail fetching danmaku from various APIs.
    • Added a 'Key areas' section detailing individual provider directories, protobuf definitions, shared utilities, and exceptions.
    • Introduced an 'Exports (subpath)' section.
    • Added a 'Scripts' table with build, test, dev, lint, protobuf compile, and OpenAPI type generation commands.
    • Listed 'Consumers' and 'Workspace dependencies'.
    • Updated the 'When changing' section.
  • packages/integration-policy/AGENTS.md
    • Expanded the 'Purpose' section to detail integration policy schema and utilities.
    • Added a 'Key areas' section detailing schema, utilities, and migrations.
    • Introduced a 'Scripts' table with build, test, lint, and type-check commands.
    • Listed 'Consumers' and 'Workspace dependencies'.
    • Updated the 'When changing' section.
  • packages/result/AGENTS.md
    • Expanded the 'Purpose' section to detail the Result type for error handling.
    • Added a 'Key areas' section detailing Result type implementation.
    • Introduced a 'Scripts' table with build, lint, and type-check commands.
    • Listed 'Consumers' and 'Workspace dependencies'.
    • Updated the 'When changing' section.
  • packages/web-scraper/AGENTS.md
    • Expanded the 'Purpose' section to detail web scraping functions.
    • Added a 'Key areas' section detailing Kazumi rules, messaging, media extraction, Cat-Catch integration, and types.
    • Introduced a 'Scripts' table with build, lint, and type-check commands.
    • Listed 'Consumers' and 'Workspace dependencies'.
    • Updated the 'When changing' section.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant and valuable set of documentation updates, including a new comprehensive guide for AI agents (CLAUDE.md) and detailed expansions of existing development guidelines and per-package AGENTS.md files. The new documentation is well-structured, detailed, and will be a great asset for both human developers and AI assistants. I've found a few minor inconsistencies across the new documentation files regarding testing tools and package dependencies, and have left suggestions to correct them. Overall, this is an excellent contribution to the project's maintainability.

- **Linter/formatter**: Biome (not ESLint/Prettier). Config at root `biome.json`.
- **Package manager**: pnpm 10 with workspaces. Do NOT use npm or yarn.
- **Git hooks**: Lefthook — pre-commit runs Biome check on staged files
- **Testing**: Vitest (packages/backend), Jasmine+Karma (Angular web app)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The documentation about testing tools appears to be incomplete. It states that Vitest is used for packages/backend, but other packages like danmaku-anywhere, danmaku-converter, and danmaku-engine also use Vitest for testing according to their respective AGENTS.md files. To improve accuracy, this line should be updated to reflect that Vitest is used across most packages and the backend.

Suggested change
- **Testing**: Vitest (packages/backend), Jasmine+Karma (Angular web app)
- **Testing**: Vitest (packages, backend), Jasmine+Karma (Angular web app)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds AI agent guidance files (CLAUDE.md, and per-package AGENTS.md files) and updates the main developer guidelines (.junie/guidelines.md) and Cursor IDE rules (.cursor/rules/). The goal is to give AI assistants accurate, structured context when working on each part of the monorepo.

Changes:

  • New CLAUDE.md at the repo root providing a comprehensive agent guide covering structure, commands, tech stack, patterns, build order, and pitfalls.
  • Expanded all per-package AGENTS.md files from 3–5 bullet lines to structured sections (Purpose, Key areas, Scripts, Consumers, Workspace dependencies, When changing).
  • Updated .junie/guidelines.md and .cursor/rules/project-overview.mdc with corrected package lists, added tools (Hono, Drizzle, Better Auth, etc.), and added key commands.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
CLAUDE.md New top-level agent guide; contains an inaccurate build-order dependency graph
.junie/guidelines.md Expanded with setup, tooling, project structure, and error handling guidance
.cursor/rules/project-overview.mdc Corrected package names/structure, added Angular 21+, backend stack, and key commands; removed BOM
.cursor/rules/angular-standards.mdc Minor formatting fix (BOM removal, consolidated broken line)
app/web/AGENTS.md Expanded with tech stack, key areas, scripts table, dependencies, and Angular conventions
packages/danmaku-anywhere/AGENTS.md Expanded with tech stack, key areas, scripts, and dependencies (scripts use bullet list instead of table)
packages/danmaku-provider/AGENTS.md Expanded with provider structure, subpath exports, and scripts
packages/danmaku-engine/AGENTS.md Expanded with key areas, scripts table, and consumers
packages/danmaku-converter/AGENTS.md Expanded with key areas, scripts, and consumer list
packages/web-scraper/AGENTS.md Expanded with key areas, scripts, and dependencies
packages/bangumi-api/AGENTS.md Expanded with subpath exports, scripts, and consumers
packages/result/AGENTS.md Expanded with purpose, key areas, and scripts
packages/integration-policy/AGENTS.md Expanded with key areas, scripts, and consumers
backend/proxy/AGENTS.md Expanded with tech stack, key areas, scripts including deploy/migration commands

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

Comment on lines +130 to +135
→ danmaku-converter (depends on result)
→ danmaku-engine
→ danmaku-provider (depends on converter, result)
→ web-scraper (depends on converter, provider)
→ danmaku-anywhere (extension, depends on all above)
→ app/web (depends on converter, provider, web-scraper, bangumi-api)
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The build order dependency graph contains two inaccuracies:

  1. danmaku-converter is listed as "(depends on result)", but packages/danmaku-converter/package.json has no dependency on @danmaku-anywhere/result. It is a leaf package with only xml-js and zod as dependencies.

  2. The arrow notation implies danmaku-provider depends on danmaku-engine (since danmaku-engine appears as a step between danmaku-converter and danmaku-provider). In reality, danmaku-provider does NOT depend on danmaku-engine — they are parallel branches that both depend on danmaku-converter.

A more accurate representation would be:

  • result, integration-policy, bangumi-apidanmaku-converter (leaf, no internal deps)
  • danmaku-converterdanmaku-engine (depends on converter)
  • danmaku-converter, resultdanmaku-provider (depends on converter + result, NOT on engine)
  • danmaku-converter, danmaku-providerweb-scraper
Suggested change
→ danmaku-converter (depends on result)
→ danmaku-engine
→ danmaku-provider (depends on converter, result)
→ web-scraper (depends on converter, provider)
→ danmaku-anywhere (extension, depends on all above)
→ app/web (depends on converter, provider, web-scraper, bangumi-api)
danmaku-converter (no internal deps; used by downstream packages)
→ danmaku-engine (depends on converter)
danmaku-converter, result
→ danmaku-provider (depends on converter, result; not on engine)
danmaku-converter, danmaku-provider
→ web-scraper (depends on converter, provider)
result, integration-policy, bangumi-api, danmaku-converter, danmaku-engine, danmaku-provider, web-scraper
→ danmaku-anywhere (extension, depends on all above)
danmaku-converter, danmaku-provider, web-scraper, bangumi-api
→ app/web (depends on converter, provider, web-scraper, bangumi-api)
integration-policy

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +39
- `pnpm dev` — Dev mode (Chrome)
- `pnpm dev:firefox` — Dev mode (Firefox)
- `pnpm build` — Production build (Chrome)
- `pnpm build:firefox` — Production build (Firefox)
- `pnpm test` — Run Vitest tests
- `pnpm lint` — Type-check + Biome lint
- `pnpm type-check` — TypeScript only
- `pnpm i18n:check` — Verify i18n keys
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The Scripts section in packages/danmaku-anywhere/AGENTS.md uses a bullet list format, while all other AGENTS.md files in the repository (e.g., packages/danmaku-engine/AGENTS.md, packages/danmaku-converter/AGENTS.md, packages/danmaku-provider/AGENTS.md, etc.) use a markdown table format for their Scripts sections. For consistency with the established convention across all other AGENTS.md files, this section should use a markdown table.

Suggested change
- `pnpm dev` — Dev mode (Chrome)
- `pnpm dev:firefox` — Dev mode (Firefox)
- `pnpm build` — Production build (Chrome)
- `pnpm build:firefox` — Production build (Firefox)
- `pnpm test` — Run Vitest tests
- `pnpm lint` — Type-check + Biome lint
- `pnpm type-check` — TypeScript only
- `pnpm i18n:check` — Verify i18n keys
| Script | Description |
| -------------------- | ------------------------- |
| `pnpm dev` | Dev mode (Chrome) |
| `pnpm dev:firefox` | Dev mode (Firefox) |
| `pnpm build` | Production build (Chrome) |
| `pnpm build:firefox` | Production build (Firefox)|
| `pnpm test` | Run Vitest tests |
| `pnpm lint` | Type-check + Biome lint |
| `pnpm type-check` | TypeScript only |
| `pnpm i18n:check` | Verify i18n keys |

Copilot uses AI. Check for mistakes.
Mr-Quin and others added 2 commits March 6, 2026 20:32
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 7, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
danmaku-anywhere-ui-preview 462944d Commit Preview URL

Branch Preview URL
Mar 07 2026, 04:34 AM

@Mr-Quin Mr-Quin merged commit 1344f96 into master Mar 7, 2026
10 of 11 checks passed
@Mr-Quin Mr-Quin deleted the claude/document-for-agents-nblDM branch March 7, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants