mf-dashboard
AGENTS.md426 starsChanged 39 days agoMITView on GitHub
Use this file for durable repository conventions, commands, constraints, and completion criteria. This repository is a monorepo built with pnpm workspaces and Turborepo. Money Forward may expose the same cash movement both as a transfer and as a normal income or expense on the transfer target account. Never include personally identifiable information in tests, Storybook stories, comments, or documentation. Use only the semantic classes defined in apps/web/src/app/globals.css. Do not define custom colors for monetary values.
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
- crawler-scraperSkill
- db-schema-changeSkill
- drizzle-erdSkill
- ui-componentSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
41 rules. About 0 are common, 15 are distinctive, and 26 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
26
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 3
Use this file for durable repository conventions, commands, constraints, and completion criteria.
- Distinctive: line 20
Use pnpm. Do not use npm or yarn.
- Very specific: line 21
Treat AGENTS.md and .agents/skills as the canonical shared agent guidance.
- Very specific: line 22
Do not run pnpm build during development.
- Distinctive: line 23
Keep changes scoped to the request and preserve unrelated work in the worktree.
- Very specific: line 24
Import directly from source files.
- Very specific: line 25
Put debug scripts in the package's debug/ directory.
- Very specific: line 31
Every table must include createdAt: text("created_at").notNull().
- Very specific: line 33
Every foreign key must specify onDelete (cascade or set null).
- Very specific: line 34
When adding or modifying schema, update docs/architecture/database-schema.md to match the current structure.
- Very specific: line 40
When calculating income, expenses, balances, forecasts, or recurring transactions from raw transactions, use the shared mirror-detection …
- Distinctive: line 41
If a transfer and a normal transaction have the same transfer target account, date, and amount, treat the normal transaction as …
- Distinctive: line 43
Add tests covering mirrored records and transfer-only records whenever a feature introduces a new cash-flow calculation path.
- Very specific: line 47
Every component under components/ must have a corresponding *.stories.tsx file.
- Very specific: line 48
Keep chart UI and data fetching separate: pure UI belongs in charts/.
- Distinctive: line 53
Never include personally identifiable information in tests, Storybook stories, comments, or documentation.
- Very specific: line 55
Do not use real names or nicknames.
- Distinctive: line 56
Do not use real addresses, phone numbers, email addresses, account numbers, or card numbers.
- Very specific: line 57
Use placeholder email addresses such as user-a@example.com.
- Distinctive: line 58
Do not include personal names in code comments.
- Very specific: line 59
Never use data/moneyforward.db as a source for test or Storybook data because it contains personal information.
- Very specific: line 63
Use only the semantic classes defined in apps/web/src/app/globals.css.
- Distinctive: line 75
All text colors must meet the WCAG 2.1 minimum contrast ratio of 4.5:1 against a white background.
- Very specific: line 76
When changing colors in globals.css, run pnpm --filter @mf-dashboard/web test:storybook to verify accessibility compliance.
- Distinctive: line 80
Use the logger functions according to their intended visibility:
- Very specific: line 90
Import these functions from ./logger.js.
- Very specific: line 94
If an orchestrator or LLM agent starts Docker Compose for validation, it must run docker compose down --remove-orphans before finishing, …
- Very specific: line 95
Do not pass --volumes unless the user explicitly authorizes deletion of persistent data.
- Very specific: line 96
Start one-off validation containers with docker run --rm, or explicitly remove them afterward.
- Very specific: line 106
Use the following priority for crawler tests.
- Distinctive: line 108
Test post-extraction parsing, transformation, comparison, and decision logic as DOM-independent unit tests using anonymous strings or …
- Distinctive: line 109
Test selectors, navigation, and HTML/DOM structure against the authenticated real service with read-only crawler E2E tests.
- Distinctive: line 110
Use embedded HTML fixtures only for failure branches that cannot be represented safely and deterministically in read-only E2E.
- Distinctive: line 118
Add unit tests for new logic.
- Very specific: line 119
After adding or changing Storybook stories, run pnpm --filter @mf-dashboard/web test:storybook.
- Distinctive: line 120
Run checks relevant to the files changed.
- Very specific: line 157
Run the web app with demo data using pnpm --filter @mf-dashboard/web dev.
- Very specific: line 166
When an LLM agent runs scraping, use dev:scrape.
- Very specific: line 167
If data/auth-state.json exists, it is used automatically.
- Very specific: line 173
If data/moneyforward.db exists, month mode re-fetches the current and previous accounting periods so delayed transactions and category …
- Very specific: line 174
If it does not exist, history mode fetches from January of the previous year through the current accounting period.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.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
mf-dashboard Agent Guide
Use this file for durable repository conventions, commands, constraints, and completion criteria.
Repository Overview
This repository is a monorepo built with pnpm workspaces and Turborepo.
| Path | Purpose |
.agents/skills | Shared repository-specific agent workflows |
apps/crawler | Money Forward scraper |
apps/web | Next.js dashboard |
packages/analytics | Shared financial analysis and tool definitions |
packages/db | Shared database schema and repositories |
packages/meta | Shared category definitions and URLs |
Working Agreements
- Use pnpm. Do not use npm or yarn.
- Treat
AGENTS.mdand.agents/skillsas the canonical shared agent guidance.CLAUDE.mdand.claude/skillsare compatibility symlinks for Claude. - Do not run
pnpm buildduring development. Build the Next.js app only when the user explicitly requests it. - Keep changes scoped to the request and preserve unrelated work in the worktree.
- Import directly from source files. Do not create barrel files (
index.tsfiles that re-export modules). - Put debug scripts in the package's
debug/directory. Do not create temporarydebug-*.tsortest-*.tsfiles undersrc/.
Mandatory Engineering Rules
Database Schema
- Every table must include
createdAt: text("created_at").notNull(). - Every table must include
updatedAt: text("updated_at").notNull(). - Every foreign key must specify
onDelete(cascadeorset null). - When adding or modifying schema, update
docs/architecture/database-schema.mdto match the current structure.
Cash Flow Transfers
Money Forward may expose the same cash movement both as a transfer and as a normal income or expense on the transfer target account.
- When calculating income, expenses, balances, forecasts, or recurring transactions from raw transactions, use the shared mirror-detection utilities in
packages/db/src/shared/transfer.ts. Do not implement feature-local transfer deduplication. - If a transfer and a normal transaction have the same transfer target account, date, and amount, treat the normal transaction as authoritative and exclude the mirrored transfer-side cash flow.
- Preserve both raw records in the database. Deduplication belongs in cash-flow interpretation, not crawler persistence.
- Add tests covering mirrored records and transfer-only records whenever a feature introduces a new cash-flow calculation path.
Components
- Every component under
components/must have a corresponding*.stories.tsxfile. - Keep chart UI and data fetching separate: pure UI belongs in
charts/; data-fetching components belong ininfo/. - An
info/component must be a Server Component that fetches data. Add a.client.tsxcomponent only when interactivity requires it.
Personal Information
Never include personally identifiable information in tests, Storybook stories, comments, or documentation.
- Do not use real names or nicknames. Use anonymous labels such as
User A,User B,Group A, orTest User. - Do not use real addresses, phone numbers, email addresses, account numbers, or card numbers.
- Use placeholder email addresses such as
user-a@example.com. - Do not include personal names in code comments.
- Never use
data/moneyforward.dbas a source for test or Storybook data because it contains personal information. Usedata/demo.dbinstead.
Monetary Colors
Use only the semantic classes defined in apps/web/src/app/globals.css. Do not define custom colors for monetary values.
| Meaning | Class |
| Actual income | text-income |
| Actual expense | text-expense |
| Positive difference, evaluation, or balance | text-balance-positive |
| Negative difference, evaluation, or balance | text-balance-negative |
Decision rule: if money actually moved, use text-income or text-expense. For comparisons, changes, balances, and unrealized gains or losses, use text-balance-positive or text-balance-negative.
- Liability balances use
text-balance-negative. - All text colors must meet the WCAG 2.1 minimum contrast ratio of 4.5:1 against a white background.
- When changing colors in
globals.css, runpnpm --filter @mf-dashboard/web test:storybookto verify accessibility compliance.
Crawler Logging
Use the logger functions according to their intended visibility:
| Function | Local | CI | Purpose |
info() | Yes | Yes | Important progress that must be visible in CI |
log() | Yes | No | Detailed local-development information |
debug() | With DEBUG=true | No | Debug-only information |
warn() | Yes | Yes | Warnings |
error() | Yes | Yes | Errors |
Import these functions from ./logger.js.
Docker Cleanup
- If an orchestrator or LLM agent starts Docker Compose for validation, it must run
docker compose down --remove-orphansbefore finishing, including after failures. - Do not pass
--volumesunless the user explicitly authorizes deletion of persistent data. - Start one-off validation containers with
docker run --rm, or explicitly remove them afterward.
QA and Test Design
- For QA, use the
ISO/IEC 25010:2023quality model as a reference. Select the quality characteristics relevant to the change and its risks, then define verification points and acceptance criteria. Do not apply every quality characteristic uniformly. - Select appropriate ISTQB test techniques based on the specification, risks, and quality characteristics under test. Techniques include equivalence partitioning, boundary value analysis, decision table testing, state transition testing, statement testing, branch testing, exploratory testing, checklist-based testing, and error guessing.
- In QA plans and PR descriptions, document the selected quality characteristics, test techniques, primary test conditions, and any significant risks left out of scope. Do not apply techniques as a box-checking exercise; be able to explain why each technique was selected and what coverage it is expected to provide.
Crawler Test Layering
Use the following priority for crawler tests. See .agents/skills/crawler-scraper/SKILL.md for implementation details and commands.
- Test post-extraction parsing, transformation, comparison, and decision logic as DOM-independent unit tests using anonymous strings or objects.
- Test selectors, navigation, and HTML/DOM structure against the authenticated real service with read-only crawler E2E tests.
- Use embedded HTML fixtures only for failure branches that cannot be represented safely and deterministically in read-only E2E. Keep the markup minimal and record the reason for the exception in a nearby test comment.
Crawler tests must not assert or log real names, balances, account identifiers, or other personal values. E2E assertions may verify only navigation and structural properties such as the presence and shape of headings, tables, rows, cells, attributes, and links.
Bound structure-only E2E navigation independently from production crawl coverage. When production must inspect every account for correctness, an E2E may inspect at most one representative detail page and skip when no suitable candidate exists; document that scope difference in the test and pull request.
Validation and Completion
- Add unit tests for new logic.
- After adding or changing Storybook stories, run
pnpm --filter @mf-dashboard/web test:storybook. - Run checks relevant to the files changed. Before finishing, confirm the requested behavior, review the diff for regressions, and report which checks ran and any that were not run.
Validation Commands
| Check | Command |
| All tests | pnpm test |
| Type checking | pnpm turbo typecheck |
| Lint | pnpm lint |
| Unused code | pnpm knip |
| Format | pnpm format |
| Format check | pnpm format:check |
| Web unit tests | pnpm --filter @mf-dashboard/web test:unit |
| Web Storybook tests | pnpm --filter @mf-dashboard/web test:storybook |
| Web E2E tests | pnpm --filter @mf-dashboard/web test:e2e |
| Storybook | pnpm --filter @mf-dashboard/web storybook |
Common Commands
Dependencies
pnpm install
pnpm --filter <package> add <dependency>Database
The SQLite database is stored at data/moneyforward.db.
pnpm --filter @mf-dashboard/db exec drizzle-kit generate
pnpm --filter @mf-dashboard/db exec drizzle-kit migrate
pnpm --filter @mf-dashboard/db studio
pnpm --filter @mf-dashboard/db build:demoRun the web app with demo data using pnpm --filter @mf-dashboard/web dev.
Crawler
pnpm --filter @mf-dashboard/crawler start
pnpm --filter @mf-dashboard/crawler dev:scrape- When an LLM agent runs scraping, use
dev:scrape. - If
data/auth-state.jsonexists, it is used automatically. - Save crawler screenshots in
apps/crawler/debug/. - To log in with saved auth state, use
loginWithAuthStatefromapps/crawler/src/auth/login.ts.
Scraping mode is inferred from database existence:
- If
data/moneyforward.dbexists,monthmode re-fetches the current and previous accounting periods so delayed transactions and category updates are incorporated. - If it does not exist,
historymode fetches from January of the previous year through the current accounting period. - For testing, set
SCRAPE_MODE=historyorSCRAPE_MODE=monthto override detection. - To remove groups no longer present in Money Forward, run with
CLEANUP_GROUPS=true. Otherwise, groups are only upserted and never deleted.
To re-fetch historical data, delete data/moneyforward.db, then start the crawler. Confirm the database is the intended target before deleting it.
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.

