Skip to content

Commit 2d7e2d9

Browse files
committed
chore: add instructions for copilot
1 parent ece0e1a commit 2d7e2d9

5 files changed

Lines changed: 87 additions & 0 deletions

File tree

.agents/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Agent Instructions
2+
3+
For code review behavior, use:
4+
5+
- `.github/copilot-instructions.md`
6+
- `.github/instructions/*.instructions.md`
7+
8+
These files are the source of truth because they are also consumed by GitHub Copilot code review.

.github/copilot-instructions.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# General Code Review Standards
2+
3+
## Review Priorities
4+
5+
- Prioritize correctness, regressions, missing tests, and API design issues.
6+
- Check that the behavior scope matches the stated intent.
7+
- Verify claims about external standards, platform conventions, accessibility, and design systems against the implementation.
8+
- Avoid asking for unrelated refactors, stylistic churn, or backwards compatibility unless required by the change.
9+
10+
## Public APIs
11+
12+
- Review new or modified public APIs for visibility, naming, defaults, customizability, and extensibility.
13+
- Ensure public APIs and exported types do not leak implementation details.
14+
15+
## Tests
16+
17+
- Call out missing tests when the changed behavior is risky.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
applyTo: "**/*.{ts,tsx,js,jsx}"
3+
---
4+
5+
# TypeScript And React Review Instructions
6+
7+
## Code Quality
8+
9+
- Flag unnecessary abstractions, one-off helpers, excessive indirection, and defensive code without a real use case.
10+
- Flag comments that restate obvious code instead of explaining non-obvious intent.
11+
- Check that changes follow existing project style, structure, naming, and local patterns.
12+
13+
## TypeScript
14+
15+
- Flag uses of `any`, unsafe `as` assertions, and non-null assertions (`!`) unless clearly justified.
16+
- Avoid broad types such as `object`, `Function`, `{}`, and `Record<string, unknown>` unless the broadness is intentional.
17+
- Do not accept `@ts-ignore`.
18+
- Only accept `@ts-expect-error` when it has a comment explaining why the error is expected and cannot be resolved.
19+
- Prefer simple types over complex conditional types, overloads, or type logic when simpler approaches work.
20+
- Prefer `type` aliases over `interface` unless there is a specific reason to use `interface`.
21+
22+
## React
23+
24+
- Check that hooks follow the Rules of Hooks.
25+
- Check dependency arrays for unstable values.
26+
- Ensure components do not perform side effects during rendering.
27+
- Avoid storing values in state when they can be derived from props or existing state.
28+
- Avoid multiple sources of truth for the same state.
29+
- Avoid `React.Children`, `cloneElement`, and reading React elements directly unless there is a strong justification.
30+
- Treat memoization as something that needs a reason: expensive calculation, stable identity requirement, or measured performance need.
31+
- Check async effects for cancellation or race conditions when relevant.
32+
- Check accessibility: labels, roles, focus order, keyboard interactions, disabled states, and loading states.
33+
34+
## Animations And Layout
35+
36+
- Check for unnecessary layout shifts.
37+
- Prefer animating only `transform` and `opacity` unless another property is required.
38+
- For layout transitions, verify the approach handles rapid state changes, gestures, interruption, and cancellation.
39+
- Check that duration and easing feel appropriate for the platform and interaction.
40+
- Verify text and UI elements do not overlap or overflow at supported screen sizes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
applyTo: "**/*.{md,mdx}"
3+
---
4+
5+
# Documentation Review Instructions
6+
7+
- Verify examples match the actual API.
8+
- Check changed heading hierarchy for consistency.
9+
- Check changed internal links and anchors for consistency.
10+
- Check that documentation explains public behavior, not implementation details.
11+
- Check that examples are self-contained and demonstrate only the relevant behavior instead of mixing multiple behaviors.
12+
- Check that migration guide examples show diff or before/after code snippets when relevant.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
applyTo: "**/*.{test,spec}.{ts,tsx,js,jsx}"
3+
---
4+
5+
# Test Review Instructions
6+
7+
- Check that tests verify public behavior, not implementation details.
8+
- Check that test titles describe user-facing behavior.
9+
- Check coverage of happy paths, edge cases, and error states.
10+
- Flag unnecessary mocking.

0 commit comments

Comments
 (0)