Skip to content

docs: Consolidate coding rules and strengthen test policy#3291

Merged
KATO-Hiro merged 2 commits into
stagingfrom
#3290
Mar 20, 2026
Merged

docs: Consolidate coding rules and strengthen test policy#3291
KATO-Hiro merged 2 commits into
stagingfrom
#3290

Conversation

@KATO-Hiro
Copy link
Copy Markdown
Collaborator

@KATO-Hiro KATO-Hiro commented Mar 20, 2026

close #3290

  • coding-style.md: Add No Hard-Coded Values, Function Ordering, and Svelte 5 docs sections
  • coding-style.md: Absorb content from svelte-docs.md (now redundant)
  • svelte-docs.md: Delete (merged into coding-style.md)
  • testing.md: Add 'Tests Ship with the Implementation' section

Summary by CodeRabbit

  • Documentation
    • Updated development guidelines: no hard-coded values, prescribed function ordering, and guidance to consult official Svelte 5 docs when behavior is unclear.
    • Removed a now-obsolete Svelte docs metadata file and reorganized how Svelte references are handled.
  • Tests
    • New rule: tests must be included with the implementing commit; “add tests later” is disallowed for non-trivial logic.

- coding-style.md: Add No Hard-Coded Values, Function Ordering, and Svelte 5 docs sections
- coding-style.md: Absorb content from svelte-docs.md (now redundant)
- svelte-docs.md: Delete (merged into coding-style.md)
- testing.md: Add 'Tests Ship with the Implementation' section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e74469fc-441f-4cb2-b74a-8c19055ef8f5

📥 Commits

Reviewing files that changed from the base of the PR and between 6070f55 and 7b8e05e.

📒 Files selected for processing (1)
  • .claude/rules/coding-style.md
✅ Files skipped from review due to trivial changes (1)
  • .claude/rules/coding-style.md

Walkthrough

Three documentation files under .claude/rules/ were changed: coding-style.md was expanded with three new sections, svelte-docs.md was removed, and testing.md gained a requirement that tests be committed alongside their implementation.

Changes

Cohort / File(s) Summary
Coding Style Guidelines
​.claude/rules/coding-style.md
Inserted three new sections: "No Hard-Coded Values" (extract magic numbers/strings into named constants with examples), "Function Ordering" (prescribed in-file declaration order: exported APIs first, then helpers), and "Svelte 5: Prefer Official Docs Over Training Knowledge" (instructs using WebFetch to consult official Svelte docs with a URL pattern).
Documentation Removal
​.claude/rules/svelte-docs.md
Deleted the file that previously documented Svelte official docs metadata and example WebFetch URL mappings for Svelte 5 guidance.
Testing Requirements
​.claude/rules/testing.md
Added a rule requiring tests be included in the same commit as the implementation; explicitly disallows deferring tests and mandates tests for non-trivial logic even when not specified in tasks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐇 I hopped through rules with nimble paws,
Pulled magic numbers from secret laws,
Lined up functions tidy and neat,
Paired tests with code — no skipped-beat feat,
Svelte docs guide my careful claws.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: consolidating coding rules (merging svelte-docs.md into coding-style.md) and strengthening the test policy.
Linked Issues check ✅ Passed The PR successfully addresses issue #3290 by updating coding-style.md with new sections, absorbing and deleting svelte-docs.md, and enhancing testing.md policy.
Out of Scope Changes check ✅ Passed All changes are directly related to consolidating rules and strengthening test policy as described in the PR objectives and linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 #3290
📝 Coding Plan
  • Generate coding plan for human review comments

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

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.claude/rules/testing.md (1)

16-20: Clear policy, but "non-trivial logic" could use examples.

The requirement to ship tests with implementation is well-stated and aligns with best practices. However, "non-trivial logic" on line 20 is subjective. Consider adding brief examples to help developers consistently determine when tests are required.

📝 Suggested clarification
 ## Tests Ship with the Implementation
 
 Tests must be included in the same commit as the implementation they cover. "Add tests later" is not acceptable — a feature or fix is not done until its tests pass.
 
-If a task description does not mention tests, add them anyway for any non-trivial logic.
+If a task description does not mention tests, add them anyway for any non-trivial logic (e.g., calculations, conditionals, data transformations, API calls). Trivial pass-through code (simple getters, type definitions) may be exempt.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/rules/testing.md around lines 16 - 20, The guideline "Tests Ship
with the Implementation" is clear but the phrase "non-trivial logic" is
ambiguous; update the section (header "## Tests Ship with the Implementation"
and the sentence containing "non-trivial logic") to include 2–3 short concrete
examples (e.g., business rules, data transformation functions, API handlers,
performance-sensitive code) that illustrate when tests are required, and add a
one-line rule-of-thumb (e.g., "if code affects customer-visible behavior, shared
libraries, or complex algorithms, include tests") so readers can consistently
determine when to add tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/rules/coding-style.md:
- Around line 89-97: The "Function Ordering" section is ambiguous about whether
helpers are interleaved with or separated from exports; update the text under
the "Function Ordering" heading to explicitly choose and describe Option A
(interleaved): state that exported functions/classes should appear in public API
order and each exported symbol's internal helpers should follow immediately
(e.g., exportFoo → helperFoo1, helperFoo2 → exportBar → helperBar1), remove or
replace the numbered list that implies all exports first, and add one short
example sentence clarifying that helpers must not be collected at the end of the
file.

---

Nitpick comments:
In @.claude/rules/testing.md:
- Around line 16-20: The guideline "Tests Ship with the Implementation" is clear
but the phrase "non-trivial logic" is ambiguous; update the section (header "##
Tests Ship with the Implementation" and the sentence containing "non-trivial
logic") to include 2–3 short concrete examples (e.g., business rules, data
transformation functions, API handlers, performance-sensitive code) that
illustrate when tests are required, and add a one-line rule-of-thumb (e.g., "if
code affects customer-visible behavior, shared libraries, or complex algorithms,
include tests") so readers can consistently determine when to add tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a97d8e4-de24-4da4-9c58-edaf2202ff47

📥 Commits

Reviewing files that changed from the base of the PR and between 26117af and 6070f55.

📒 Files selected for processing (3)
  • .claude/rules/coding-style.md
  • .claude/rules/svelte-docs.md
  • .claude/rules/testing.md
💤 Files with no reviewable changes (1)
  • .claude/rules/svelte-docs.md

Comment thread .claude/rules/coding-style.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator Author

@KATO-Hiro KATO-Hiro left a comment

Choose a reason for hiding this comment

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

LGTM

@KATO-Hiro KATO-Hiro merged commit eab9938 into staging Mar 20, 2026
3 checks passed
@KATO-Hiro KATO-Hiro deleted the #3290 branch March 20, 2026 05:51
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.

[Docs] rules を直近のタスクをベースに更新しましょう

1 participant