` alone. To
explain the background or reason for a change, add a body — and footers as
needed — after a blank line.
```text Summary only theme={null}
fix: correct the boundary handling in the date filter
```
```text With a body theme={null}
refactor: extract date formatting into a shared function
The formatting logic duplicated across screens had drifted apart in three
places, so it is consolidated into a shared function.
```
```text With Semantic Versioning theme={null}
major-feat: change the notification list API response to a paginated format
Returning every notification in a single response cannot keep up with the
growth of notifications, so the response is changed to a paginated format.
BREAKING CHANGE: the top level of the response changes from an array to an
object, so clients must read notifications from the items array.
```
## Titles
A PR title is a one-line summary of the change. Titles appear in PR lists,
notifications, and the history after merging, so standardize a style that lets
readers identify the change without opening the description.
Base the title on the commit messages, using the same Conventional Commits and
Semantic Versioning formats. For a PR with a single commit, reuse the commit
message as the title; for a PR with multiple commits, choose the type and
summary that represent the change as a whole.
## Template
A PR template is a Markdown skeleton that is automatically inserted into the
description field when a PR is created. With a template in place, the structure
of the description — overview, changes, verification — stays consistent across
PRs, and the information reviewers need is codified as a rule in advance.
**1. Create the template file**
Add `.github/PULL_REQUEST_TEMPLATE.md` to the repository.
**2. Write the skeleton**
Lay out the information reviewers need, separated by headings and comments.
````markdown theme={null}
## Overview
## Background / Purpose
## Changes
-
Prompt used
### LLM model used
### Prompt
```markdown
```
## Test plan
- [ ] Added or updated unit tests
- [ ] Confirmed all existing tests and CI pass
## How to verify
- [ ] Exercised the affected feature locally and confirmed it behaves as expected
- [ ] Confirmed surrounding features in the affected area still work
## Related issue
## Notes
````
**3. Merge it into the default branch**
The template takes effect only once it exists on the default branch. PRs
created after the merge get the skeleton inserted into their description
automatically.
> [!TIP]
>
> Review the template regularly. Remove sections nobody fills in. If there are
> items that come up often as questions in review, add them as sections.
## Draft
A draft is a PR state that signals the work is not yet ready for review. While
a PR is a draft it cannot be merged, so unfinished changes are never pulled in
by accident.
Opening a PR as a draft before the work is finished lets you gather feedback
on the direction of the implementation and design early, over the diff of the
actual code. Unlike aligning through documents or conversation, the discussion
is grounded in working code, so you and the reviewers reach a shared
understanding at an early stage.
Once the feedback you need is in and the understanding is aligned, you can
either continue working on the same PR, or close the draft and open a new PR
from scratch. The cost of changing direction grows as the work progresses, so
a draft is an effective way to turn back early and keep the sunk cost to a
minimum.
Select "Create draft pull request" when opening the PR, and switch it out of
the draft state with "Ready for review" once it is ready.
## Granularity
Pull request granularity is whether a single PR concentrates on one thing — the
uniformity of its change content. It is measured by whether the changes are
uniform, not by the number of lines or files in the diff.
### The difference between size and granularity
Size (lines and files changed) and granularity (uniformity of the change
content) are different measures, and granularity is the one that drives the
split decision. The test is whether the PR's change content is uniform — the PR
concentrates on one thing — not how large the diff is.
| Example change | Size | Appropriate? | Reason |
| - | - | - | - |
| Bulk rename of a function used in 10,000 places | Large | Appropriate | The change content is uniform, so one PR is fine |
| Data fetching, transformation, and rendering implemented together | Small–medium | Inappropriate | Different kinds of changes are mixed, so split it |
| A 20-line bug fix plus an unrelated "while I'm here" refactor | Small | Inappropriate | Two different changes are mixed, so split it |
### Why granularity matters
A focused diff narrows the scope that has to be reviewed. For the same total
amount of work, reviewing one change ten times is lighter for both the author
and the reviewer than reviewing ten changes in one PR.
> [card] Faster review
>
> A diff with uniform change content fits in a reviewer's head, so review stops
> being deferred and finishes in minutes.
> [card] Clean reverts
>
> Reverting a PR with a single, uniform change rolls back exactly that change and
> nothing else.
> [card] Fewer conflicts
>
> Short-lived branches are less likely to run into conflicts.
> [card] Faster root-cause
>
> A PR with uniform change content also has a narrow impact area, so isolating
> the cause during an incident is fast.
A large, mixed PR produces a negative cycle: it raises the reviewer's cognitive
load, review is deferred, the branch lives longer, conflicts accumulate, and the
next review is harder still.
Granularity also matters for context management when AI agents do the work.
Having an agent handle multiple requirements or unrelated changes in the same
context spreads its attention and lowers precision. Splitting the work into PR
units with uniform change content lets the agent focus its limited context on
one thing, raising the accuracy of both implementation and review.
### Tips for getting granularity right
#### Break work down first
Decompose the work into independently workable tasks before writing code, so
each task maps to one PR. See [Task Breakdown](/development/task-breakdown).
#### When in doubt, split smaller
When unsure about the right granularity, choose the smaller one. Discussing
granularity within the review exchange aligns expectations with the reviewer.
Splitting a PR that has already grown large is harder than starting small and
coarsening the granularity later. When in doubt, ship small and flesh the work
out incrementally.
#### Review first
Finer granularity creates more moments where the next piece of work cannot start
until a merge lands. If review stalls there, it becomes the bottleneck and slows
down overall development speed. So when a review request arrives, handle it
before your own work.
The context switch of interrupting your own work may be a concern, but reviewing
a well-granulated PR takes minutes — sometimes under a minute — so the cost of
the interruption is small. Keeping granularity right is what lets the
review-first habit take root in the team. See
[Code Review](/development/code-review) for what that review actually checks.
#### Keep CI fast
Finer granularity means more PRs, and CI runs grow in proportion. If CI stays
slow, the accumulated waiting before each merge erodes development efficiency
instead.
Aim for runs under 10 minutes, and treat anything over 5 minutes as
slow enough to improve. For concrete techniques, see
[Keep CI fast](/development/ci-cd#keep-ci-fast) in CI/CD.
#### Separate deploy from release
Treating the deploy of code and the release of a feature as separate events
lets unfinished work merge without waiting for the whole feature to be done,
so PRs can keep shipping small.
See [Release](/development/release-strategy) for details.
## Stacks
A stack is a technique for splitting a series of dependent changes into small PRs stacked on top of each other. Each PR in the stack contains one focused change, and its base is the branch of the PR directly below it instead of the default branch.
Keeping PRs small normally collides with dependencies between tasks. When task B builds on the result of task A, you cannot open B's PR against the default branch until A's PR is reviewed and merged, so you either wait or bundle A and B into one large PR. Stacking resolves this: you branch B off A's branch and open B's PR against A's branch, so both stay small and neither blocks the other.
### How to proceed with tasks
When tasks depend on each other, there are three ways to proceed: wait, bundle, or stack. The following diagrams compare them as branch trees.
#### Wait
Task B cannot start until task A's PR merges. Granularity is preserved, but task B's branch can only be created after task A merges, so the follow-up work stalls while the review is pending.
```mermaid theme={null}
%%{init: {'gitGraph': {'mainBranchName': 'main'}}}%%
gitGraph
commit id: "released"
branch task-a
commit id: "implement task A"
checkout main
merge task-a id: "wait for PR-A to merge"
branch task-b
commit id: "implement task B"
checkout main
merge task-b id: "merge PR-B"
```
#### Bundle
Instead of waiting, tasks A and B are implemented on a single branch and go into a single PR. Nothing stalls, but the diff mixes two intents and grows large, raising the review burden.
```mermaid theme={null}
%%{init: {'gitGraph': {'mainBranchName': 'main'}}}%%
gitGraph
commit id: "released"
branch task-a-b
commit id: "implement task A"
commit id: "implement task B"
checkout main
merge task-a-b id: "one large merge"
```
#### Stack
Branch B off A's branch and point B's PR at A's branch. Both PRs stay small, and B proceeds without waiting for A's review.
```mermaid theme={null}
%%{init: {'gitGraph': {'mainBranchName': 'main'}}}%%
gitGraph
commit id: "released"
branch task-a
commit id: "implement task A (PR-A)"
branch task-b
commit id: "implement task B (PR-B)"
```
### How it works
A stack is a chain of branches, and each PR in the stack is called a layer. The bottom branch is based on the default branch, and every branch above is based on the branch directly below it. Each PR targets the branch it was based on, so its diff shows only the changes of its own layer.
```mermaid theme={null}
flowchart LR
subgraph before["Before merging"]
direction TB
b3["PR #3: API"] -->|base| b2["PR #2: service"] -->|base| b1["PR #1: model"] -->|base| bm["main"]
end
subgraph after["After PR #1 merges"]
direction TB
a3["PR #3: API"] -->|base| a2["PR #2: service"] -->|"base (retargeted to main)"| am["main (includes the model changes)"]
end
before -->|"merge PR #1"| after
```
Review proceeds independently per layer. A reviewer of PR #2 sees only the service-layer diff, because the model changes below it belong to PR #1.
Merging proceeds from the bottom up. When the bottom PR merges, GitHub automatically rebases the remaining branches so that the next PR targets the default branch, and the stack shrinks by one layer. You can also merge the entire stack at once by merging the top PR — every PR below it merges with it — or land only the bottom portion and keep working on the rest. See [GitHub Docs](https://docs.github.com/en/pull-requests/get-started/about-stacked-prs) for the platform-side behavior.
This mechanism gives stacks the following benefits.
> [card] Granularity is preserved
>
> Each dependent change stays a single-intent PR instead of being bundled into one large diff.
> [card] No waiting on review
>
> You continue the next layer on top of the previous branch while its review is still in progress.
> [card] Reviews stay small
>
> Each PR shows only its own layer's diff, so every review stays within a reviewer's working memory.
> [card] Dependencies are explicit
>
> The base chain records which change builds on which, so the merge order is visible on the PRs themselves.
What needs attention when operating a stack is keeping the chain consistent. When a lower layer changes after review feedback, every branch above it must be rebased onto the updated branch. The stacking technique itself is not specific to GitHub and has long been workable by hand, but then each rebase and base retarget is manual work. GitHub's native support for stacks automates this as a cascading rebase, triggered server-side from the PR or run locally with the `gh stack` extension. Beyond this automation, another benefit of running a stack on GitHub is that GitHub itself understands that the series of PRs is linked as a stack.
Stacking is for changes that genuinely depend on each other. Independent tasks do not need a stack — open them as separate PRs against the default branch.
### Using gh stack
`gh stack` is a GitHub CLI extension that handles the local workflow for a stack as a unit: it creates and tracks branches in dependency order, keeps them rebased, pushes them, creates and links the PRs, and navigates between layers.
> [!NOTE]
>
> GitHub's server-side support for stacks is in public preview and rolling out to repositories in stages. If `gh stack submit` fails on a repository, the rollout may not have reached it yet.
**1. Install the extension**
```bash theme={null}
gh extension install github/gh-stack
```
**2. Build the branch chain**
Implement each layer on its own branch, branching each new branch off the previous one, and commit. Then adopt the existing branches into a stack, listing them bottom to top:
```bash theme={null}
gh stack init --base main feature/model feature/service feature/api
```
To build the stack as you go instead, run `gh stack init` on the first branch and stack each new layer with `gh stack add`.
**3. Create all PRs at once**
```bash theme={null}
gh stack submit --auto
```
This pushes every branch and creates the PRs as drafts, with each base set to the branch below. Mark them ready for review once the descriptions are filled in.
**4. Merge from the bottom**
Merge the bottom PR first; the PRs above are rebased automatically on GitHub's side. Merging the top PR merges the entire stack at once. To catch your local branches up after merges — fetch, rebase, push, and stack-state sync in one command — run:
```bash theme={null}
gh stack sync
```
### Automating stacks with AI agents
Stacks pair well with AI agent workflows. Once work is broken down into issues with explicit dependencies, an agent can implement the issues in dependency order, stacking one branch per issue, and then create all the PRs in one submit. The human concentrates on reviewing and merging each small layer.
An automated workflow takes a parent issue — the output of [task breakdown](/development/task-breakdown) — as its input and proceeds as follows.
**1. Read dependencies from the parent issue**
Fetch the parent issue's sub-issues and the dependencies between them. The parent-child issues and dependency settings created during task breakdown become the input of the automation as they are.
**2. Convert the dependency graph into stacks**
Order the dependency graph so that issues to complete first sit at the bottom, and group the issues connected by dependencies — directly or transitively — into one stack. Groups with no dependency connection between them can be worked on in parallel by multiple agents.
For example, suppose the sub-issues have the following dependencies. Arrows point at the issue depended on (the one to complete first).
```mermaid theme={null}
flowchart RL
B["Issue B"] -->|depends on| A["Issue A"]
C["Issue C"] -->|depends on| A
D["Issue D"] -->|depends on| B
D -->|depends on| C
F["Issue F"] -->|depends on| E["Issue E"]
```
This graph converts into the following two stacks.
```mermaid theme={null}
flowchart BT
subgraph s1["Stack 1"]
A2["Issue A"] --> B2["Issue B"] --> C2["Issue C"] --> D2["Issue D"]
end
subgraph s2["Stack 2"]
E2["Issue E"] --> F2["Issue F"]
end
```
Issues A through D form one stack because following their dependencies connects them all. Issues B and C have no direct dependency on each other, but they are connected through A and D, so they are stacked serially within the same stack. The group of issues E and F has no dependency connection to A through D, so multiple agents can implement it in parallel.
**3. Implement while stacking branches**
The agent implements the issues in a stack from the bottom, following the dependency order. Each issue gets its own branch and commits, building a chain where issues and branches correspond one to one. Issues with no dependency on each other, like issues B and C in the example above, can be implemented simultaneously in parallel and then assembled into the chain.
**4. Create the PRs in bulk**
Once the chain is built, `gh stack submit --auto` pushes the whole stack and creates the PRs with the base chain configured.
**5. Humans review and merge from the bottom**
Human work starts here: review each layer's small diff and merge from the bottom. When a lower PR merges, the ones above are rebased automatically on GitHub's side, so the stack does not need manual restructuring after every merge. Once every PR in the stack is approved, you can also merge the entire stack at once by merging the top PR.
The quality of this automation is decided by the quality of the task breakdown it consumes. Issues with explicit requirements, completion criteria, and dependencies are the prerequisite for automating stacks.
## Related pages
> [card] [Code Review](/development/code-review)
>
> What a reviewer checks once a request lands, and how self-review and clear
> comments keep the exchange fast.
> [card] [Test Code](/development/testing)
>
> What makes a change verifiable in the first place, and how tests keep a PR
> reviewable.
> [card] [Onboarding](/organization/onboarding)
>
> Why small pull requests are the fastest way for a new member to learn
> from daily feedback.
# What is refactoring? Changing structure, not behavior
Source: https://lib.findy.co.jp/development/refactoring
Change structure without changing behavior: separate structure from behavior changes, proceed in small reversible steps, and design code for deletion.
## Overview
Refactoring is changing the internal structure of code without changing its observable behavior. Structure drifts as a codebase absorbs change after change, and refactoring is the ongoing work that restores [modifiability](/development/modifiability) — the property that keeps the next change cheap and safe.
Refactoring is not a special project or a phase that waits for permission: it can happen at any time, and it is always in demand. What needs discipline is not *when* to refactor but *how* — in units that a reviewer can verify, in steps that can be undone, and toward a structure whose parts can eventually be deleted.
This page covers three practices that provide that discipline — separating structure changes from behavior changes, proceeding in small reversible steps, and designing for deletion — and the role of test code that underpins all of them.
## Structure changes and behavior changes
Every change to code belongs to one of two categories, and the two are verified in entirely different ways.
| | Structure change | Behavior change |
| - | - | - |
| What changes | Names, boundaries, dependencies, duplication — how the code is organized | What the software observably does |
| Who notices | Only developers reading the code | Users, API consumers, tests |
| How it is verified | Existing tests pass, unchanged | Updated tests assert the new behavior |
| Risk profile | Low, and mechanically checkable | Carries product risk by definition |
The examples below use a common running example: a hook that fetches order history and shapes it for display.
```tsx Running example: fetching and shaping order history theme={null}
// Fetch order history and shape it for display
export const useOrderHistory = () => {
const { data } = useOrders();
// Hide cancelled orders and sort newest first
const orders = [...(data ?? [])]
.filter((order) => order.status !== "cancelled")
.sort((a, b) => compareDesc(a.orderedAt, b.orderedAt));
return { orders };
};
```
Which category a change to this hook belongs to is decided by one thing: whether the list content — the observable behavior — changes. In a structure change, only the code arrangement changes and the hook returns the same list, so existing tests pass unchanged.
```tsx Structure change: extract the shaping logic into a function theme={null}
const selectOrders = (data: Order[] | undefined) =>
[...(data ?? [])]
.filter((order) => order.status !== "cancelled")
.sort((a, b) => compareDesc(a.orderedAt, b.orderedAt));
export const useOrderHistory = () => {
const { data } = useOrders();
return { orders: selectOrders(data) };
};
```
In a behavior change, the list content changes, so the tests are updated to the new behavior.
```tsx Behavior change: stop excluding cancelled orders theme={null}
export const useOrderHistory = () => {
const { data } = useOrders();
// Drop the filter and keep only the newest-first sort
const orders = [...(data ?? [])]
.sort((a, b) => compareDesc(a.orderedAt, b.orderedAt));
return { orders };
};
```
Refactoring, by definition, covers only the first kind — the structure change. The moment a change alters what the software does, it is no longer a refactoring — it is a behavior change that deserves a behavior change's scrutiny.
### Do not mix the two in one pull request
A structure change and a behavior change must not share a pull request. The reason is how each is reviewed.
A structure-only pull request is verified with a single question: is the behavior identical? The evidence is mechanical — no test was modified, and every test passes. A reviewer can approve a large structural diff quickly, because the tests answer the hard question.
A behavior-change pull request is reviewed against its intent: the diff includes updated tests, and the reviewer checks that the new assertions match the specification.
A pull request that mixes a structure change and a behavior change destroys both verification strategies. The tests changed, so "tests unchanged and passing" no longer proves behavior is preserved — the reviewer must classify every line by hand, asking of each whether it was supposed to change behavior or not. The review becomes slower and less reliable at the same time.
Using the earlier extraction as the example, the two treatments differ like this. First, the pattern where the pull request only extracts: the tests are untouched, and passing unchanged is itself the evidence that behavior is preserved. Showing cancelled orders ships as a follow-up behavior-change pull request with its updated tests.
```tsx ✅ Implementation: this pull request only extracts theme={null}
const selectOrders = (data: Order[] | undefined) =>
[...(data ?? [])]
.filter((order) => order.status !== "cancelled")
.sort((a, b) => compareDesc(a.orderedAt, b.orderedAt));
export const useOrderHistory = () => {
const { data } = useOrders();
// Calling the same logic as before keeps the list identical
return { orders: selectOrders(data) };
};
```
```tsx ✅ Test: passes unchanged theme={null}
// The tests are untouched — passing unchanged is the evidence
// that the observable behavior is preserved
test("returns order history, newest first", () => {
const { result } = renderHook(() => useOrderHistory());
// cancelled orders are excluded from the list
expect(result.current.orders).toEqual([delivered2, delivered1]);
});
```
Mixing the extraction (structure) and the change to the visible orders (behavior) in one pull request instead rewrites the test expectations in the same diff: "tests pass unchanged" is lost as evidence, and the reviewer classifies every line by hand.
```tsx ❌ Implementation: structure and behavior share one diff theme={null}
const selectOrders = (data: Order[] | undefined) =>
[...(data ?? [])]
// Alongside the extraction, the filter is dropped so
// cancelled orders are now shown
.sort((a, b) => compareDesc(a.orderedAt, b.orderedAt));
export const useOrderHistory = () => {
const { data } = useOrders();
return { orders: selectOrders(data) };
};
```
```diff ❌ Test: expectations rewritten in the same diff theme={null}
test("returns order history, newest first", () => {
const { result } = renderHook(() => useOrderHistory());
- // cancelled orders are excluded from the list
- expect(result.current.orders).toEqual([delivered2, delivered1]);
+ // cancelled orders now appear in the list
+ expect(result.current.orders).toEqual([delivered2, cancelled1, delivered1]);
});
```
The revert unit degrades the same way. A pull request should be a unit that can be reverted alone — see [Task Breakdown](/development/task-breakdown). Reverting a mixed pull request throws away a correct structure change to undo a wrong behavior change, or the reverse.
> [!TIP]
>
> When a reviewer requests a refactoring on a behavior-change pull request, it does not have to be fixed inside that pull request. Accepting the point and doing it as a follow-up structure-only pull request keeps both changes verifiable.
### The timing is a choice, not a rule
Structure changes and behavior changes go into separate pull requests, but their order in time is a genuine choice.
* **Structure first** — when the current structure makes the coming behavior change awkward, reshape the code first. The behavior change that follows becomes smaller and easier to review.
* **Structure after** — when the behavior change is urgent or the structural problem only becomes visible while working, ship the behavior first and clean up immediately after, leaving the area ready for the next change.
* **Not now** — when the code is rarely touched, the cost of restructuring may never pay back. Leaving it alone is a legitimate decision.
A practical basis for the choice is how often the code changes: structure that many future changes will pass through pays back quickly, and structure nobody revisits pays back never. Delivering observable behavior early also reduces uncertainty — polishing structure before the behavior is validated optimizes code that may not survive.
## Tests define "behavior unchanged"
Refactoring and test code are inseparable. "Existing tests pass unchanged" — the way a structure change is verified — only works when the tests genuinely assert the observable behavior. In other words, the claim that a refactoring preserves behavior is only as strong as the tests that assert the behavior.
Two signals during a refactoring deserve attention:
* **A test had to change.** Either the change was not actually structure-only, or the test asserts implementation details rather than observable behavior. Both cases need fixing — the first in the diff, the second in the test. See [Test Code](/development/testing).
* **No test failed while the logic was temporarily broken.** If an intermediate mistake produced no failing test, the safety net has a hole in the area the refactoring touches.
## Small, reversible steps
The cost of a change grows faster than its size: a larger diff takes disproportionately longer to review, conflicts with more concurrent work, and hides mistakes better. Refactoring therefore proceeds as a series of small steps, each of which keeps the system fully working.
The rhythm of a step is fixed: make one structural move, verify that everything still passes, and commit. Renames, extractions, and moves each land as their own verified step. A step that turns out wrong is undone by reverting one small commit, not by untangling it from a day of other edits.
The same rule applies at the pull request level. Merge small structure-only pull requests into the default branch continuously, rather than accumulating them on a long-lived refactoring branch. A long-lived branch collects conflicts with every concurrent change, and its eventual merge is exactly the large, risky diff the small steps were meant to avoid. Keep each pull request small enough that a reviewer finishes it in minutes.
A restructuring too large for a single safe step is done as a **parallel change**: the new structure is built alongside the old, and traffic moves over incrementally.
The three steps below walk through replacing a price formatter with a multi-currency one.
**1. Expand**
Add the new structure next to the old one, with nothing using it yet. Behavior is untouched, so this step is trivially safe.
```tsx Expand: add the new function next to the old one theme={null}
// The existing function is untouched
export const formatPrice = (price: number) =>
`¥${price.toLocaleString()}`;
// Add the new function; nothing uses it yet
export const formatMoney = ({ amount, currency }: Money) =>
`${amount.toLocaleString()} ${currency}`;
```
**2. Migrate**
Move callers from the old structure to the new one, a few at a time. Each migration is a small, independently revertible pull request, and the system works at every point in between.
```diff Migrate: move callers to the new function one by one theme={null}
- {formatPrice(order.total)}
+ {formatMoney({ amount: order.total, currency: order.currency })}
```
**3. Contract**
When nothing uses the old structure, delete it. The refactoring is not finished until this step lands — a codebase carrying both structures is harder to change than before the refactoring started.
```diff Contract: delete the old function once nothing uses it theme={null}
- export const formatPrice = (price: number) =>
- `¥${price.toLocaleString()}`;
```
The pattern works across ownership boundaries as well: renaming a field in an API response follows the same expand, migrate, contract sequence, with the provider and consumers moving in separate, individually safe steps.
## Designing for deletion
Many refactorings end with a deletion: the contract step removes the old structure, an experiment that did not survive is removed, a feature flag whose rollout completed is retired — see [Release](/development/release-strategy). Deletion is where the classification of changes meets design: deleting code is easy, but deleting it **safely, quickly, and simply** is a property the code either was given when it was written or does not have — see [Modifiability](/development/modifiability).
Code is easy to delete when its dependents can be enumerated mechanically and its parts live together. This is another way of saying the structure has high **cohesion** (code that changes together lives together) and low **coupling** (unrelated code does not depend on each other) — and the pair also indicates which direction a refactoring should move the structure.
Cohesion has recognized levels of strength: the more essential the reason a module's parts are together, the stronger the cohesion.
| Cohesion | Why the parts are together | Typical example |
| - | - | - |
| Functional (strongest) | They serve a single purpose | The UI, logic, and tests that make up one feature |
| Sequential | One part's output feeds the next | A flow from fetch through transform to format |
| Communicational | They operate on the same data | Operations reading and writing the same entity |
| Procedural | They share only an execution order | Checks that run in sequence before a screen renders |
| Temporal | They run at the same time | Initialization invoked together at startup |
| Logical | They are the same kind of thing | A general-purpose function switching on a flag; utilities grouped only by kind |
| Coincidental (weakest) | They happen to be in the same place | A miscellaneous `common` module |
The priority is clear: aim for functional cohesion, accept sequential and communicational, and treat logical and coincidental cohesion as targets for decomposition. When the reason code is grouped shifts from "it changes together" to "it is the same kind" or "it happened to be there," that is the sign of weak cohesion.
The following practices keep cohesion high and coupling low:
* **Keep dependencies explicit and one-directional.** The question "what depends on this?" must have a mechanical answer — from types, imports, or module boundaries. Code whose dependents cannot be listed cannot be deleted with confidence.
* **Group code by concept, not by kind.** When everything a feature needs lives in one subtree, deleting the feature is deleting the subtree. When it is scattered across shared layers, every deletion is an investigation. Places grouped only by kind — `utils`, `common` — are the typical form of logical or coincidental cohesion.
* **Treat shared abstractions as deletion risks.** Every new caller of a shared helper makes that helper harder to remove or change. Extract shared code when duplication has proven itself a burden, not in anticipation.
* **Delete dead code instead of keeping it.** Commented-out blocks, unused exports, and flags that never flip are not free: they mislead readers and dilute change detection. Version control already preserves everything — restoring deleted code is one revert away.
Grouping by concept instead of by kind shows most clearly in the directory structure.
```text Grouped by kind vs. grouped by concept theme={null}
# ❌ Grouped by kind: removing order history means
# investigating every layer
src/
components/OrderList.tsx
hooks/useOrderHistory.ts
utils/orderFormatters.ts
# ✅ Grouped by concept: removing order history is
# deleting one subtree
src/
features/order-history/
OrderList.tsx
useOrderHistory.ts
formatters.ts
```
The forward-looking form of this practice is a question asked while writing new code: how will this be removed? A module that has an answer — its dependents are enumerable, its parts are together, nothing reaches into its internals — is cheap to delete, and for exactly the same reasons it is cheap to change.
## Related pages
> [card] [Modifiability](/development/modifiability)
>
> The classification of changes — separate, revise, remove — that refactoring keeps cheap.
> [card] [Task Breakdown](/development/task-breakdown)
>
> Split work into independently revertible units — the same principle that separates structure from behavior.
> [card] [Test Code](/development/testing)
>
> The tests that make "behavior unchanged" a verifiable claim instead of a hope.
> [card] [Pull Requests](/development/pull-request)
>
> Keep each pull request focused on one intent so review stays fast and reliable.
# Release strategy: separating deployment from release
Source: https://lib.findy.co.jp/development/release-strategy
Separate deploying code from releasing features. Covers environment-variable feature flags, trunk-based development, gradual rollout, instant rollback, and flag cleanup.
## Overview
A release is the set of decisions about when and how a change becomes visible to users, independent of when its code reaches the production environment. The core principle is separating *deploy* from *release*: deploying is the mechanical act of shipping code, releasing is the decision to expose a feature.
Without that separation, releases are tense events. Changes pile up into a large batch waiting for the announcement date, unverified features reach users the moment their code merges, and recovery from a problem depends on another deploy. With the separation in place, deploying becomes a routine step repeated many times a day, and releasing becomes a low-risk decision that a single configuration change can advance or reverse.
This page explains the principle of that separation, the environment-variable feature flag that implements it with no extra infrastructure, the development flows that deliver features spanning multiple pull requests safely, and how to roll out, roll back, and clean up flags. The pipeline that automates the deploys themselves is covered on the [CI/CD](/development/ci-cd) page.
## Principles
### Treat deploy and release as different events
Deploying code and releasing a feature usually happen at the same moment, but they answer different questions and belong to different owners.
> [card] Deploy
>
> Reflecting code in the production environment. A mechanical, repeatable step that can be automated and performed many times a day.
> [card] Release
>
> Making a feature available to users. A judgment call about timing — coordination with announcements, support readiness, or business milestones.
Keeping the two coupled forces a trade-off: either deploys wait for the business timing, so changes pile up into large risky batches, or features go live the instant their code lands, whether or not anyone is ready.
### Deploy small and often, choose release timing deliberately
Separating the two is the foundation of continuous delivery — keeping the software releasable at all times, deploying small changes frequently, and choosing release timing deliberately. Small, frequent deploys improve speed and stability together, because each change is easier to review, test, and undo.
The feature flag, covered next, is what implements this separation with no extra infrastructure.
## Implementing the separation with feature flags
### Start with a single environment-variable branch point
A feature flag is a conditional that switches behavior on or off without a code change. The simplest reliable implementation is an environment variable read at one branch point in the code.
In the following example, a new label is rendered only while the `FEATURE_NEW_LABEL` environment variable is `'true'`. Enable it locally to work on the feature, and merge with it disabled in the production environment.
```tsx React theme={null}
export const SampleComponent = () => {
const isEnabledNewLabel = process.env.FEATURE_NEW_LABEL === 'true';
return (
{isEnabledNewLabel && NEW}
Sample
);
};
```
```ruby Ruby theme={null}
def new_label_enabled?
ENV['FEATURE_NEW_LABEL'] == 'true'
end
def sample_labels
labels = []
labels << 'NEW' if new_label_enabled?
labels << 'Sample'
labels.join(' ')
end
```
Enabling the feature in the production environment is a configuration change — add `FEATURE_NEW_LABEL=true` to the environment — and disabling it is removing that line.
> [!TIP]
>
> Give every flag a shared prefix such as `FEATURE_`. A search through the environment configuration then inventories the live flags, which also surfaces the forgotten ones covered in the cleanup section below.
### Know what the flag unlocks
The flag turns "the code is in the production environment" and "the feature is visible" into independent facts. That unlocks:
> [card] Merge unfinished work
>
> In-progress features merge into the main branch behind a flag, invisible to users, instead of aging in a long-lived branch.
> [card] Deploy often, release deliberately
>
> Deploy to the production environment many times a day while choosing when to release each feature.
> [card] Instant rollback
>
> If a released feature misbehaves, turn the flag off. Recovery time is minimal.
> [card] Test safely in the production environment
>
> Enable a feature in the verification environment or for internal use first, while users in the production environment still see the old behavior.
> [!NOTE]
>
> Environment-variable flags can be implemented with no extra infrastructure, which makes them a good first step. Adopting a flag management library or service is also worth considering.
## Delivering features that span multiple pull requests
Features too large for a single pull request benefit most from separating deploy and release. The development flow differs depending on whether the change can hide behind a flag, so this section covers two flows together with when to apply each.
### Trunk-based development
Trunk-based development is the practice of integrating all work into the main branch in small increments, avoiding branches that live for days or weeks. Long-lived branches accumulate merge conflicts, hide integration problems until the end, and produce large pull requests that are hard to review.
Feature flags are what make this practical for features that take more than one pull request to build: each increment merges as soon as it passes review, guarded by the flag, and the feature is enabled only when the last piece lands.
The result is that several people can build in the same area with conflicts less likely, and every merge is small enough to review properly.
In the following diagram, one feature is split into three increments, each merged into the base branch with the flag off, and the release happens by enabling the flag after the last increment lands.
```mermaid theme={null}
%%{init: {'gitGraph': {'mainBranchName': 'base'}}}%%
gitGraph
commit id: "released"
branch increment-1
commit id: "work 1 (flag off)"
checkout base
merge increment-1 id: "PR: merge 1"
branch increment-2
commit id: "work 2 (flag off)"
checkout base
merge increment-2 id: "PR: merge 2"
branch increment-3
commit id: "work 3 (flag off)"
checkout base
merge increment-3 id: "PR: merge 3"
commit id: "flag on = release"
```
This is the same principle as splitting work into small units — see [Task Breakdown](/development/task-breakdown) for slicing features down to a size that merges behind a flag, and [Pull Requests](/development/pull-request) for keeping each merge reviewable.
### The topic branch flow
Some changes cannot hide behind a flag — a visual overhaul or a framework migration, where the impact on the production environment cannot be hidden.
The topic branch flow keeps granularity in that case. It is a three-layer branch structure that places a topic branch between the base branch and the working branches. Review and integration complete on the topic branch, and the base branch receives nothing until release, so small pull requests keep flowing without affecting the production environment.
```mermaid theme={null}
%%{init: {'gitGraph': {'mainBranchName': 'base'}}}%%
gitGraph
commit id: "released"
branch topic
branch develop-1
commit id: "work 1"
checkout topic
merge develop-1 id: "PR: review 1"
branch develop-2
commit id: "work 2"
checkout topic
merge develop-2 id: "PR: review 2"
checkout base
commit id: "other changes"
checkout topic
merge base id: "daily sync"
checkout base
merge topic id: "PR: release"
```
The flow works as follows.
1. Cut a topic branch from the base branch, then cut working develop branches
from the topic branch.
2. Review on PRs from a develop branch into the topic branch. This is the stage
where granularity is maintained.
3. When the work is ready for the production environment, merge a PR from the topic branch into
the base branch. The review at this point can be minimal, because the changes
were already reviewed in step 2.
4. Merge the base branch's changes into the topic branch at least once a day to
keep conflicts to a minimum.
The trade-off is that the topic branch itself is a long-lived branch: integration with the base branch is deferred, which is exactly what trunk-based development avoids, so the daily sync in step 4 is what keeps conflicts manageable.
Prefer feature flags when the change can hide behind one, and reserve the topic branch flow for changes that cannot.
## Rolling out as a sequence of controlled steps
With deploy and release separated, releasing becomes a sequence of controlled steps rather than a single event.
**1. Deploy with the flag off**
The code reaches the production environment disabled. Users see no change; the deploy itself carries near-zero release risk.
**2. Enable in the verification environment**
Turn the flag on in the verification environment first. Problems surface before any user is exposed — the earlier a defect is found, the cheaper it is to fix.
**3. Release in the production environment**
Enable the flag in the production environment at the chosen timing. If the rollout can be scoped, start with a specific group of users and widen the audience gradually.
**4. Roll back by turning the flag off**
If the feature misbehaves, disable the flag.
> [!WARNING]
>
> Rollback by flag only works if the old code path still exists and still passes its tests. Do not delete or break the fallback path while the flag is live.
The "is anything wrong?" check at each step is faster and more reliable with automated tests covering the primary user journeys. See [E2E Testing](/frontend/e2e-testing) for automating the release check against the deployed environment.
## Managing flags as temporary
### Test both states
A flag doubles the states your code can be in, and both states run in the production environment at some point in the feature's life. Write tests for each side of the branch:
```tsx theme={null}
it('renders the NEW label when FEATURE_NEW_LABEL is true', () => { /* ... */ })
it('does not render the NEW label when FEATURE_NEW_LABEL is false', () => { /* ... */ })
```
The off-state test is not optional: it is what guarantees the rollback path keeps working while the feature evolves. See [Test Code](/development/testing) for what makes these tests trustworthy.
### Remove flags that have done their job
A flag is temporary by design. Once the feature has run stably with the flag on and there is no scenario for turning it back off, remove the flag, the dead branch, and the off-state tests in one pull request.
Stale flags accumulate into a combinatorial maze of states nobody tests. A trustworthy test suite is what makes this deletion safe to do promptly.
## Related pages
> [card] [CI/CD](/development/ci-cd)
>
> The automated pipeline that makes flag-off deploys repeatable many times a day.
> [card] [Task Breakdown](/development/task-breakdown)
>
> Slice features into increments small enough to merge behind a flag.
> [card] [Pull Requests](/development/pull-request)
>
> Keep each merge small and reviewable.
> [card] [Test Code](/development/testing)
>
> Tests that protect both flag states and make flag removal safe.
# How to break down tasks: one task, one pull request
Source: https://lib.findy.co.jp/development/task-breakdown
Breaking work into small, independent units: benefits, good-task conditions, split-or-merge criteria, breakdown steps, dependencies, and issue creation.
## Overview
Task breakdown is the practice of splitting a feature into small units of work
before implementation. Each task aims to merge on its own, revert on its own,
and drag no unrelated changes with it. The preparation done before writing
code determines [pull request granularity](/development/pull-request#granularity):
building PRs from the broken-down tasks lets you keep creating PRs at the
right granularity.
## Benefits
Listing and splitting tasks before starting looks like a detour, but across
the development cycle it turns out to be the fastest path.
> [card] More accurate estimates
>
> Small, concrete tasks are easier to size than one large feature, so the
> total estimate carries fewer surprises.
> [card] Early agreement on the approach
>
> Writing the task list in an issue and having it reviewed before
> implementation surfaces missing cases and wrong assumptions while they are
> still cheap to fix, which cuts rework.
> [card] PR granularity stays right
>
> Building PRs from the broken-down tasks keeps each PR focused on one thing
> and prevents it from bloating.
> [card] Visible progress, easy hand-off
>
> A checklist of tasks makes status legible at a glance and makes handing
> work between people — or between people and AI agents — straightforward.
Good task breakdown also translates into providing AI agents with the right
context. Context engineering is the practice of preparing the context an AI
agent works with — instructions, reference material, and scope — so that it
contains exactly what the goal requires, no more and no less. A task with
uniform change content lets you load only the information that piece of work
needs, so the agent concentrates its limited context on one thing.
Task breakdown, [pull request granularity](/development/pull-request#granularity), and
context engineering are tightly linked: breakdown decides the unit of work,
that unit drives the granularity of the PR, and that granularity determines
the quality of the context the agent receives. Even when implementation is
delegated to AI agents, the starting point is a good breakdown.
## What makes a good task
A well-sized task satisfies four conditions at once.
> [card] Merges without breaking anything
>
> The change is safe to integrate on its own, and the application keeps
> working after the merge.
> [card] Includes its tests
>
> Implementation and the tests that prove it ship in the same task, never
> separately.
> [card] Reverts in isolation
>
> Rolling it back does not disturb other tasks.
> [card] Reviewable in one sitting
>
> It stays small enough that a reviewer can read it through without
> breaks and understand the whole change.
## Keep together or split apart
Cohesion decides the boundary. To judge whether two pieces of work belong to
the same task, apply three checks in order. If any answer forces them together,
keep them together.
**1. Check independence**
Does task B work correctly without task A? If not, they are one task.
**2. Check completeness**
Is task A a meaningful, mergeable unit on its own? If not, merge it into
the task that gives it meaning.
**3. Check revert impact**
Does reverting task A also break task B? If so, they are one task.
Some combinations do not need the checks — they always land the same way.
> [card] Always keep together
>
> * Implementation and its tests
> * An API endpoint and its routing
> * A data model and its migration
> [card] Always split apart
>
> * Refactoring from new features
> * A library upgrade from feature work
> * A performance change from feature work
> * A data migration from feature work
> * Each stage of a feature flag (add → enable → remove)
> * Features that do not depend on each other
## Breakdown steps
Breakdown is iterative. The first list does not need to be perfect; it gets
more precise as more people look at it and as the breakdown progresses.
This section walks through building a task list, using the task "Add a REST
API that returns a list of users" as an example.
**1. Draft a task list from the requirement**
Start by writing the rough requirement as an issue task list. A single
top-level line is enough at this point.
```markdown theme={null}
- [ ] Add a REST API that returns a list of users
```
**2. Expand into independently shippable slices**
Break the single line into pieces that ship on their own. Fetching the
list, filtering, pagination, and sorting each became their own task.
Build the feature by stacking small additions instead of implementing
everything at once.
```markdown highlight={2-8} theme={null}
- [ ] Add a REST API that returns a list of users
- [ ] Fetch the list of users from the database and return it
- [ ] Support filtering
- [ ] id
- [ ] name
- [ ] Support pagination
- [ ] Support sorting
- [ ] id asc/desc
```
**3. Review the list across roles**
Have frontend, backend, and product reviewers look at the list before any
code is written. Discussion turns vague items concrete: in this example,
aligning in review pinned the name filter down to a partial match.
```markdown highlight={5} theme={null}
- [ ] Add a REST API that returns a list of users
- [ ] Fetch the list of users from the database and return it
- [ ] Support filtering
- [ ] id
- [ ] partial match on name
- [ ] Support pagination
- [ ] Support sorting
- [ ] id asc/desc
```
**4. Keep splitting during implementation**
When implementation reveals reality, feed it back into the list and split
further. In this example, writing tests surfaced the hidden requirement of
handling deactivated users, and the fetch task split into "return all
users" and "exclude deactivated users". Keep updating and splitting the
list during implementation instead of letting one task swell.
```markdown highlight={3-4} theme={null}
- [ ] Add a REST API that returns a list of users
- [ ] Fetch the list of users from the database and return it
- [ ] Return all users
- [ ] Exclude deactivated users from the list
- [ ] Support filtering
- [ ] id
- [ ] partial match on name
- [ ] Support pagination
- [ ] Support sorting
- [ ] id asc/desc
```
## Dependencies and parallelism
Once the list settles, map the dependencies between tasks and identify which
tasks can run in parallel. Tasks with no dependency on each other can be
implemented simultaneously — by different people, or by multiple AI agents.
For example, a bulk user registration feature breaks into five tasks: the
domain model comes first, the parser and the validator depend only on it and
run in parallel, the service layer combines them, and the API endpoint sits on
top.
```markdown theme={null}
- [ ] Add bulk user registration
- [ ] Task 1: Define the domain model
- [ ] Task 2: Implement the parser
- [ ] Task 3: Implement the validator
- [ ] Task 4: Implement the service layer
- [ ] Task 5: Add the API endpoint
```
Mapping the dependencies of this task list produces the following diagram.
```mermaid theme={null}
flowchart LR
T1[Task 1
Domain model] --> T2[Task 2
Parser]
T1 --> T3[Task 3
Validator]
T2 --> T4[Task 4
Service layer]
T3 --> T4
T4 --> T5[Task 5
API endpoint]
```
## Turning tasks into issues
Once the breakdown and its dependencies are settled, create an issue per task.
Checkboxes in a task list cannot track assignees, discussion, or progress per
task. Promoting a task you are about to start into its own issue makes one
issue one unit of work, with the requirements and discussion for that task
collected in one place.
Structure the feature and its tasks as parent and child issues.
* **Parent issue** — represents the whole feature. It keeps the background,
the goal, and the full task list, and links to each child issue so progress
can be followed from one place.
* **Child issue** — represents one broken-down task. It states the task's
requirements and completion criteria, and records the dependencies mapped
earlier. If the tool supports linking parent and child issues, the
children's progress rolls up to the parent.
On GitHub, this structure maps to two features: sub-issues and issue
dependencies. Sub-issues carry the parent–child relationship — which feature a
task belongs to — while dependencies carry the starting order — which task to
start after.
**Sub-issues (parent–child)** — adding the child issues to the parent as
sub-issues makes the feature-task hierarchy explicit, and the children's
completion rolls up to the parent as progress. See
[Adding sub-issues](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/adding-sub-issues)
in the GitHub Docs for the steps. For the bulk registration feature, the five
child issues hang under the parent issue.
> [card] Parent issue: Add bulk user registration
>
> Sub-issues (0 / 5)
>
> * [ ] Task 1: Define the domain model
> * [ ] Task 2: Implement the parser
> * [ ] Task 3: Implement the validator
> * [ ] Task 4: Implement the service layer
> * [ ] Task 5: Add the API endpoint
**Dependencies (starting order)** — record the starting order between child
issues as issue dependencies. Setting a dependency on Task 1 for the Task 2
issue makes it visible, even in lists, that Task 2 cannot start until Task 1
completes, and it can replace writing dependencies in the issue body. See
[Creating issue dependencies](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/creating-issue-dependencies)
in the GitHub Docs for the steps. The dependencies of the bulk registration
feature form the following graph, where each arrow points to the issue it
depends on — the one that must complete first.
```mermaid theme={null}
flowchart RL
T2[Task 2
Parser] -->|depends on| T1[Task 1
Domain model]
T3[Task 3
Validator] -->|depends on| T1
T4[Task 4
Service layer] -->|depends on| T2
T4 -->|depends on| T3
T5[Task 5
API endpoint] -->|depends on| T4
```
Start with Task 1, which has no dependencies; Task 2 and Task 3 share the same
dependency and can proceed in parallel.
An issue created this way is a unit of work you can hand to a person or an AI
agent as is. With the requirements, completion criteria, and dependencies in
one place, the quality of the context the implementer receives is largely
decided at this point. Issues with no dependencies can be started in parallel.
Issues that do depend on each other can also proceed without waiting for each
review to finish, by stacking one pull request per issue — see
[stacks](/development/pull-request#stacks).
## Related pages
> [card] [Pull Requests](/development/pull-request)
>
> Where the tasks broken down here get submitted — one task, one pull
> request, stacked when they depend on each other.
> [card] [Release](/development/release-strategy)
>
> Merge task-sized increments behind a flag and choose separately when users
> see them.
> [card] [Onboarding](/organization/onboarding)
>
> Break down tasks together with a new member so they can submit small
> changes from their first week.
> [card] [Agentic Workflow](/ai/agentic-workflow)
>
> Hand a broken-down issue to an AI agent, and run the independent ones in
> parallel.
# How to write test code that protects your system from bugs
Source: https://lib.findy.co.jp/development/testing
Design tests that pass when they should and fail when they should, instead of chasing coverage numbers, so regressions surface before release.
## Overview
Test code verifies that the system behaves as intended, and it is the safety net that makes continuous change possible.
What matters in test code is that it **protects the system**: a protective test passes when the behavior is correct and fails when the behavior breaks. Its value is not in every test passing, but in preventing unintended behavior before it is released to production.
This page explains the principles behind such tests and shows patterns for writing test code that protects the system.
## Principles
### The purpose of tests is sustainable growth of the software
Automated tests exist to make the growth of the software sustainable: it keeps the project in a state where the effect of a change can be verified with trustworthy results in a short time, so the team can keep changing the system with confidence. Detecting unintended behavior is the mechanism, not the end goal.
Quality and speed are therefore not a trade-off. Skipping tests buys a short-lived head start, and the cost returns quickly as unintended behavior slipping in, manual re-verification, and fear of touching existing code. It is not that there is no time to write tests — there is no time because tests are not written.
Refactoring and incremental improvement require confidence that existing behavior still holds after a change, and test code provides it.
This matters even more when AI coding tools propose changes: whether a proposed change is safe to accept is ultimately answered by the test code, and the quality of the test code determines how much of that work can be delegated.
### Passing and failing must both be trustworthy
Test code protects the system only while its results can be trusted in both directions. Two kinds of failures erode trust in test code:
> [card] False negative — broken but passing
>
> The behavior is broken but the test passes. Fragmentary assertions or mocking the logic under test cause it; the test reports safety that does not exist, and unintended behavior is released to production.
> [card] False positive — correct but failing
>
> The behavior is correct but the test fails. Dependence on implementation details or unstable timing causes it; frequent false positives train the team to ignore failures, until the moment the behavior truly breaks is missed as well.
Strengthen assertions to reduce false negatives, and assert observable behavior rather than internal implementation to reduce false positives. Test code earns trust by keeping both low. The patterns later in this page guard mainly against false negatives.
### Coverage is a result, not a goal
Coverage measures which lines test code executes, not whether it asserts the right behavior. A line can run without any assertion that it does the correct thing, so a high percentage can coexist with tests that protect very little.
The reliable order is to decide **what behavior must not break**, then add test cases that would catch it breaking. Coverage rises as a consequence.
### Write tests in the same pull request as the implementation
A behavior change and the test that protects it belong in the same pull request. Deferring the test to a follow-up leaves a window where the behavior is unprotected, and in practice the follow-up competes with new work and loses.
Review test code at least as rigorously as implementation code: a weak assertion approved today is unintended behavior missed later.
See [Pull Requests](/development/pull-request) for how to keep such changes reviewable.
## Writing test code that protects the system
The following patterns are cases where a test looks fine but would not catch the bug it is meant to catch — that is, sources of false negatives. Each pattern strengthens the test until it fails for the failures that matter.
The same patterns are the recurring weaknesses of test code generated by AI tools: generated tests tend to optimize for a green run rather than for protection, so review them against these patterns before merging, with the same scrutiny as hand-written tests.
### 1. Assert execution state, not just execution
Asserting only that a callback was called hides three bugs: a handler that fires twice when it should fire once, a handler called with the wrong arguments (another user's data, for example), and an error-path callback that runs when it should never run. Pin down the count and the arguments, and assert that the handlers that should never be called were never invoked.
```javascript Jest theme={null}
// ❌ Only asserts the callback was called
// (double fire, wrong payload, and onError all pass)
expect(onSuccess).toHaveBeenCalled();
// ✅ Pin the count, the arguments, and the silent paths
expect(onSuccess).toHaveBeenCalledTimes(1);
expect(onSuccess).toHaveBeenCalledWith({ userId: 123 });
expect(onError).not.toHaveBeenCalled();
```
```ruby RSpec theme={null}
# ❌ Only asserts the callback was called
# (double call, wrong payload, and on_error all pass)
expect(on_success).to have_received(:call)
# ✅ Pin the count, the arguments, and the silent paths
# (`.with(...).once` alone counts only the matching calls, so an extra
# call with different arguments would slip through — pin the total too)
expect(on_success).to have_received(:call).once
expect(on_success).to have_received(:call).with(user_id: 123)
expect(on_error).not_to have_received(:call)
```
### 2. Assert the whole expected value, not fragments
Checking one field of a result leaves every other field unprotected: an unchecked field that is dropped, renamed, or corrupted passes silently. Compare the entire structure against a literal expected value, so any unintended change to the shape or content of the result fails the test.
```javascript Jest theme={null}
// ❌ Only asserts individual fields
expect(result.id).toBe(1);
expect(result.name).toBe("Alice");
expect(result.role).toBe("member");
// ✅ Pin the whole structure (any unintended change fails)
expect(result).toStrictEqual({ id: 1, name: "Alice", role: "member" });
// ✅ Check the keys in addition to individual fields
// (missing or extra keys — dropped or unintentionally added fields — also fail)
expect(Object.keys(result).sort()).toEqual(["id", "name", "role"]);
expect(result.id).toBe(1);
expect(result.name).toBe("Alice");
expect(result.role).toBe("member");
```
```ruby RSpec theme={null}
# ❌ Only asserts individual attributes
expect(result[:id]).to eq(1)
expect(result[:name]).to eq("Alice")
expect(result[:role]).to eq("member")
# ✅ Pin the whole structure (any unintended change fails)
expect(result).to eq({ id: 1, name: "Alice", role: "member" })
# ✅ Check the keys in addition to individual attributes
# (missing or extra keys — dropped or unintentionally added fields — also fail)
expect(result.keys).to contain_exactly(:id, :name, :role)
expect(result[:id]).to eq(1)
expect(result[:name]).to eq("Alice")
expect(result[:role]).to eq("member")
```
Generated tests in particular often assert just enough for the current behavior to pass: the tests pass today, but there is no guarantee against a future extension that breaks an unasserted part of the behavior.
```javascript Jest theme={null}
// ❌ Asserts only the count (any two items pass)
expect(result.items.length).toBe(2);
// ✅ Pin the whole expected value (any broken item, price, or total fails)
expect(result).toStrictEqual({
items: [
{ id: 1, name: "Coffee", price: 500 },
{ id: 2, name: "Beans", price: 1200 },
],
total: 1700,
});
```
```ruby RSpec theme={null}
# ❌ Asserts only the count (any two items pass)
expect(result[:items].length).to eq(2)
# ✅ Pin the whole expected value (any broken item, price, or total fails)
expect(result).to eq({
items: [
{ id: 1, name: "Coffee", price: 500 },
{ id: 2, name: "Beans", price: 1200 }
],
total: 1700
})
```
Loose matchers weaken assertions the same way. `toBeTruthy` and `be_truthy` pass for a non-empty string, a number, or any other truthy value, so a refactor that quietly changes a boolean return into another type keeps passing. Assert the exact value and type instead.
```javascript Jest theme={null}
// ❌ Passes even when the value is not true ("yes" or 1 also passes)
expect(active).toBeTruthy();
// ✅ Assert the exact value and type
expect(active).toBe(true);
expect(count).toBe(0);
```
```ruby RSpec theme={null}
# ❌ Passes even when the value is not true ("yes" or 1 also passes)
expect(active?).to be_truthy
# ✅ Assert the exact value and type
expect(active?).to be true
expect(count).to eq 0
```
### 3. Mock the boundary, not the logic under test
When a green run becomes the goal, an AI coding tool may mock the very logic under test, or adjust the expected value to whatever the implementation currently returns. Such a test passes even if the implementation is wrong, because the implementation itself was treated as the answer key.
The proper role of a mock is the opposite: fixing an external boundary — the current time, a network response — so that the output becomes deterministic. Output that depends on the current time, such as a mail body that embeds an expiry date, can only be asserted in fragments until the clock is pinned; once the time is mocked, the whole expected value can be asserted exactly, as in pattern 2.
Describe how mocks should be used in each case in the project's custom instructions, and verify during review that the expected values come from the specification, not from the output.
```javascript Jest theme={null}
// Implementation under test: builds a mail body whose expiry date
// is seven days from the current time
const mailService = {
createInviteMailBody(toEmail, inviteLink) {
const expiresAt = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);
const expiryDate = expiresAt.toISOString().slice(0, 10); // e.g. "2026-07-08"
return `Dear ${toEmail},\n${inviteLink}\nThis link expires on ${expiryDate}.`;
},
};
const expectedBody = `Dear ${toEmail},\n${inviteLink}\nThis link expires on 2026-07-08.`;
// ❌ Mocks the logic under test itself
// (only asserts the mock's return value — a broken implementation passes)
jest.spyOn(mailService, "createInviteMailBody").mockReturnValue(expectedBody);
expect(mailService.createInviteMailBody(toEmail, inviteLink)).toBe(expectedBody);
// ✅ Mock only the external boundary (the clock), run the real logic
// (the expiry is pinned to 2026-07-08 — a bug in the implementation fails)
jest.useFakeTimers().setSystemTime(new Date("2026-07-01T00:00:00Z"));
expect(mailService.createInviteMailBody(toEmail, inviteLink)).toBe(expectedBody);
```
```ruby RSpec theme={null}
# Implementation under test: builds a mail body whose expiry date
# is seven days from the current time
class MailService
def create_invite_mail_body(to_email, invite_link)
expiry_date = (Time.zone.now + 7.days).strftime("%Y-%m-%d") # e.g. "2026-07-08"
"Dear #{to_email},\n#{invite_link}\nThis link expires on #{expiry_date}."
end
end
expected_body = "Dear #{to_email},\n#{invite_link}\nThis link expires on 2026-07-08."
# ❌ Mocks the logic under test itself
# (only asserts the mock's return value — a broken implementation passes)
allow(mail_service).to receive(:create_invite_mail_body).and_return(expected_body)
expect(mail_service.create_invite_mail_body(to_email, invite_link)).to eq(expected_body)
# ✅ Mock only the external boundary (the clock), run the real logic
# (the expiry is pinned to 2026-07-08 — a bug in the implementation fails)
travel_to Time.zone.local(2026, 7, 1) do
expect(mail_service.create_invite_mail_body(to_email, invite_link)).to eq(expected_body)
end
```
## Related pages
> [card] [Code Review](/development/code-review)
>
> What a reviewer checks beyond the tests — design fit, requirements, and
> readability.
> [card] [Dependency Updates](/development/dependency-updates)
>
> A suite you trust is what lets dependency updates merge without a person
> reading each one.
> [card] [Testing Strategy](/frontend/testing-strategy)
>
> Which test layer each verification belongs to, and where this page's principles apply across the frontend layers.
# The role of Developer Relations
Source: https://lib.findy.co.jp/devrel/engineering-culture
Defines DevRel as a company's function for reaching developers, then covers engineering culture, the engineering community's three layers, and technical communication.
## Overview
DevRel (Developer Relations) is what a company does to build relationships
with developers. Understanding what that work rests on means understanding
the culture shared among software engineers — the values of learning,
sharing, and improvement — and the communication that makes those values
visible from outside.
This page covers the culture of software engineers. It first defines
DevRel, then works through engineering culture, the three layers of the
engineering community, and what technical communication achieves.
## What DevRel is
### The general definition
DevRel (Developer Relations) is the relationship a company builds with
developers, and the function responsible for building it. What
distinguishes it from general marketing or public relations is the
counterpart: developers, whether as users of a product, as participants in a
community, or as potential colleagues.
### Two orientations
| Orientation | Who uses the product | What the function works toward |
| - | - | - |
| Product-oriented | Developers are the users, as with APIs, SDKs, developer tools, infrastructure, and components | Adoption and continued use: documentation, samples, support, and feeding user feedback back into the product |
| Branding-oriented | Users are not necessarily developers | Recognition and trust for the engineering organization: publishing, hosting events, supporting employees who speak |
Many companies hold both orientations at once, and the balance shifts as the
business changes. Naming which one a given activity serves prevents it from
being judged by the wrong measure.
### Examples of taking part
| Way of taking part | What it requires |
| - | - |
| Hosting your own events | Continuous planning capacity and a reason for participants to attend |
| Sponsoring community events | Funding or a venue, offered without conditions on the content |
| Running engineering media | A steady supply of writers and an editorial process |
| Supporting employees who speak | Time, review, and a policy on what may be disclosed |
| Contributing to open source | Sustained engineering time, not a one-time donation |
### Principles
> [card] Put the participant's purpose first
>
> Design each activity around what participants came for. Content whose
> main purpose is promotion loses the audience it was meant to reach.
> [card] Stay neutral on technology
>
> Avoid ranking languages, tools, or roles against each other. Comparisons
> should describe the conditions under which each fits.
> [card] Plan for continuity
>
> Relationships are built by repeated contact. Size the activity so it can
> be sustained rather than run once at full effort.
> [card] Measure indirectly
>
> Accept that attribution is partial. Track participation, repeat
> attendance, and reach over time instead of assigning each activity a
> direct return.
These principles constrain each other in practice. Continuity limits how
large any single activity can be, and neutrality limits how directly an
activity can serve the company's short-term interest. Deciding those
trade-offs deliberately, rather than per activity, is what makes the
function's output consistent over time.
## What engineering culture is
### Values
Engineering culture is a set of values held in common by engineers,
independent of any single employer or technical field. It is not a company's
internal rules, benefits, or ways of working; those are organizational
culture, and they differ from company to company. Engineering culture is what
recurs across communities, collaborative projects, and public writing
regardless of who employs the people involved.
Three values account for most of what is observed.
| Value | What it means | How it appears in practice |
| - | - | - |
| Learning | Treating current knowledge as provisional and keeping it up to date | Reading source code and design documents, trying unfamiliar tools, studying the reasoning behind a design |
| Sharing | Moving knowledge outside the person who holds it | Documentation, peer review, articles, talks, open source |
| Improvement | Treating a working system as still improvable | Reworking a structure that has drifted, retrospectives, automating repeated work |
### Why these values hold
These are not preferences that happen to be common. Three properties of
engineering work make them practical necessities.
**Technical knowledge keeps changing.** Tools and frameworks turn over on a
scale of a few years, and new areas such as cloud and AI keep being added
to what has to be learned. Learning is a condition of continuing to work in
the field, not an optional virtue.
**Knowledge does not decrease when copied.** Explaining a solution does not
remove it from the person explaining. Because the cost of sharing is low and
both sides gain, sharing spreads more readily here than in fields where
know-how is scarce by nature.
**What is built is never finished.** Software that stays in use keeps
absorbing changes in requirements, environment, and load, so "it works"
describes a state rather than a completion. Improvement is the activity
that maintains that state.
Open source is the clearest instance of the three appearing together: the
code is published, anyone can read and learn from it, and improvements can
be contributed back to the same codebase.
## The structure of the engineering community
### Three layers
The engineering community is made up of three layers with different actors
and different motives. Treating them as one is a common source of failure
when a company begins to participate.
| Layer | Actor | Primary motive | Typical form of communication |
| - | - | - | - |
| Individual | An engineer as a person | Organizing their own understanding and building a public record of it | Articles, talks, open source contributions, answers to questions |
| Community | Volunteer organizers and participants | Sustaining a place where people with a shared interest can learn | Study groups, meetups, tech conferences, open source projects |
| Company | A business and the engineers it employs | Product adoption, technical branding, recruiting | Company-hosted events, engineering media, sponsoring, support for employees who speak |
### How the layers relate
Individuals move across all three layers. The same person writes a personal
article, helps organize a meetup, and speaks at an event hosted by their
employer. Because it is the same person who crosses the layers, how they
are treated in one layer affects trust in the others.
Communities run on volunteer effort and depend on neutrality. Organizers
generally do not profit, participants attend by choice, and the place holds
together only while people believe it is not being run as a sales channel.
That belief is the community's principal asset.
Companies participate as businesses, and that motive is legitimate and does
not need to be concealed. What matters is the order of exchange. A company
that first offers something the community wants — a venue, funding,
speakers, published knowledge — retains its access. A company that asks for
attention first tends to lose that access, and the loss is difficult to
reverse.
> [!WARNING]
>
> Access to a community is not a channel a company owns. It is granted by
> the people who organize and attend the place, and it is withdrawn when the
> place stops serving them. Plan participation on the assumption that it can
> be withdrawn.
### Kinds of places
Communities gather in several formats. They differ in scale, in how much
preparation they need, and in what they are suited to.
| Format | Scale and cadence | What it is suited to |
| - | - | - |
| Study group | Small, recurring | Working through a single topic with the same participants over time |
| Meetup | Small to medium, recurring | Meeting people with a shared interest; conversation matters as much as the sessions |
| Tech conference | Large, usually annual | Covering a whole technical area at once and reaching people outside the regular circle |
| Online event | Any scale, low travel cost | Reaching participants regardless of location, and leaving a recording behind |
| Open source project | Continuous, no venue | Collaborating on an artifact rather than on an occasion |
## What technical communication achieves
### Definition and forms
Communication matters both for a company's own product and for its
technical branding. Technical communication is the act of putting
engineering knowledge outside the person or team that holds it, in a form
other people can use. It covers several forms, and they are not
interchangeable.
| Form | What it suits |
| - | - |
| Engineering articles | Explaining a decision and the reasoning behind it at length, in a form that stays readable later |
| Talks at events | Reaching an audience at a fixed time and answering questions directly |
| Study groups and meetups | Building relationships with a small number of people in depth |
| Open source | Publishing the result itself, where the artifact carries the explanation |
| Public documentation | Serving readers who arrive with a specific question already formed |
### Three effects
> [card] The learning cycle
>
> Explaining forces the explainer to close gaps that were tolerable while
> the knowledge stayed private, and readers avoid re-solving a solved
> problem.
> [card] Technical branding
>
> Published work makes an organization's technical standard observable
> from outside, which is what other parties assess before working with it.
> [card] Effects on recruiting
>
> Communication conveys what a job description cannot: the actual problems
> a team works on and the quality of its decisions.
The learning cycle returns to the communicator first. Writing an explanation
exposes the parts of an understanding that were never examined, because a
reader will not accept a step the writer cannot state. Feedback then
corrects what the writer got wrong, which is a form of review that is
otherwise hard to obtain.
Technical branding follows from accumulation rather than from any single
piece. An organization that publishes its decisions consistently becomes
predictable to outsiders, and predictability is what makes technical
partnerships and adoption decisions possible.
Recruiting effects are real but indirect. Content made to serve its
audience attracts people who value the same things; content made to attract
applicants reads as advertising and loses the audience it needs. Treating
recruiting as a downstream effect rather than a direct goal is what keeps
the material worth their time.
> [!NOTE]
>
> The effects of communication appear slowly and are hard to attribute to
> any single article or event. Evaluate the activity over a period long
> enough to contain many of them, rather than judging each one on
> short-term numbers.
## Related pages
> [card] [Technical Editing](/devrel/technical-editing)
>
> The editing side of running engineering media, one of the ways of
> taking part listed above.
> [card] [Online Events](/devrel/online-event)
>
> How to plan and run the company-hosted events this page describes, from
> planning to follow-up.
> [card] [Tech Blog](/organization/tech-blog)
>
> How an organization runs publishing through technical articles, from pitch
> and review to publication.
> [card] [Offline Events](/devrel/offline-event)
>
> How to run the company-hosted events this page describes in person,
> where conversation after the talks becomes part of the value.
# How to plan and run an in-person tech event, start to finish
Source: https://lib.findy.co.jp/devrel/offline-event
Covers what distinguishes in-person events and what each phase requires for them: choosing a venue, layout and supplies, the networking session, and follow-up.
## Overview
An offline event is an event in which speakers and participants gather in one
physical venue.
This page covers how to run an in-person tech event. It follows the four
phases defined in [Online Events](/devrel/online-event): planning, preparation,
the day itself, and follow-up. Narrowing the purpose, identifying the target,
setting metrics, and finding topics work the same way in both formats, so this
page covers only what changes when the event happens in a room.
## What distinguishes offline events
Three properties separate offline events from online ones.
| Property | Effect on running the event |
| - | - |
| Chance encounters | Participants meet and talk with each other, and the networking session can become the center of the event's value rather than an add-on. Some participants end up alone, so organizers connect them with others |
| Estimating same-day attendance | Attendance falls short of registrations, sometimes to about half. Estimate numbers from expected attendance, not from registrations |
| Venue capacity | The venue's capacity sets the upper limit on attendance |
## Planning
Planning for an offline event adds two decisions to the purpose, target, and
metrics: the venue and the scale.
### Choose the venue
The venue is either your own space or a space borrowed from another company.
The choice changes the arrangements. What to agree on with the host when
borrowing a space is covered in the preparation section below.
### Decide the scale first
Decide the number of participants before arranging anything else, because the
venue, food and drinks, and the number of staff all scale with it.
### Set the date and time
Open the doors about 30 minutes before the start. Publish the event page two
to three weeks in advance.
## Preparation
Preparation for an offline event is mostly about the physical setting: how
the room is arranged, what to bring, food and drinks, and who does what on
the day. Speaker outreach, the title, and promotion follow
[Online Events](/devrel/online-event).
### Lay out the room
Arrange the room to fit the format. For a panel discussion, the standard
arrangement places the moderator on the audience's right and the speakers on
the audience's left. When the event is streamed, decide the speakers'
positions by where the camera frames them.
Set aside a cloakroom for bags and coats. Participants holding their
belongings find it harder to mingle.
### Prepare supplies
The following supplies cover most events.
| Item | Purpose |
| - | - |
| Name cards and holders | Participants write their name, company, and social media account |
| Lanyards in two colors | The lanyard color identifies people who do not want to appear in photos |
| Cards with the hashtag and Wi-Fi details | Placed on each table so that participants can post about the event easily |
| Printed QR codes for the survey | For answering the survey |
| Pens | For filling in name cards |
| Masking tape | For putting up signs and hanging garbage bags |
| Display adapters | Let laptops with different ports connect |
| Garbage bags | For collecting garbage |
| An "off the record" sign | Held up when someone is about to share something off the record; having one livens up the room |
### Arrange food and drinks
Calculate quantities from expected attendance, not registrations.
Individually wrapped food in one portion per person reaches everyone and is
easy to clean up. Dishes that need serving take extra work to set up with
cutlery and to clean up.
| Item | Guideline |
| - | - |
| Food | One individually wrapped portion per expected attendee, plus individually wrapped snacks |
| Alcoholic drinks | About two per expected attendee, including options other than beer |
| Non-alcoholic drinks | Enough for most attendees; tea tends to run out first |
Choose small bottles for soft drinks. Large bottles require cups and tend to
run short or be left over. Order drinks early if you want specific products
or a fixed delivery time.
### When borrowing another company's space
When the venue belongs to another company, agree on the following with the
host in advance.
* **Equipment and layout.** Agree on the equipment to use and how the room is
arranged.
* **The event page.** Include the host's company information and ask the host
to review the page.
* **Deliveries.** Ask the host to help receive food and drinks and to chill
the drinks.
* **The schedule for the day.** Share the event schedule for the day.
* **Speakers and promotion.** Invite the host's members to speak and ask the
host to promote the event.
On the day, place a staff member near the building to guide participants.
### Plan the staffing
Assign roles in advance. Reception needs one person for a small event and two
or more once the event exceeds about 30 participants.
For an event of just under 100 participants, about six people is a guideline.
| Role | What it covers |
| - | - |
| Host and moderator | Running the program from opening to closing, introducing speakers, reading out questions, announcing the networking session |
| Reception (2 people) | Checking in participants, handing out name cards, receiving deliveries, welcoming late arrivals |
| Presentation support | Switching slides, managing microphones, showing the waiting screen and announcements |
| Streaming | Setting up and watching the stream, reporting problems to the host |
| Venue guide | Directing participants to the room and restrooms |
| Catering and venue | Setting out and refilling food and drinks, managing garbage, setup and cleanup (shared by everyone) |
## The day of the event
The day of the event covers reception, background music, the survey, the
networking session, and the closing.
### Run reception
When participants arrive all at once, reception backs up. Split the work
among several people, with one person checking people in and others handling
name cards.
### Use background music
Background music sets the atmosphere of the event. Play it from when the
doors open until the start, and again from the survey through the networking
session to the closing. Songs whose lyrics do not catch the ear get in the
way of conversation less.
### Take the survey right after the talks
Ask participants to answer the survey right after the talks end, not after
the networking session. Once the networking session starts, conversation
takes over and the response rate drops.
### Run the networking session
Watch the following during the networking session.
* **Connect people who are alone.** Organizers talk to participants who are
alone and connect them with others. Asking whether there is anyone they
would like to talk to after the talks is one way to do this.
* **Announce the Pac-Man rule.** Just before the networking session, announce
the Pac-Man rule as a cue that makes it easier to join a group. Under the
Pac-Man rule, people standing in a circle leave a gap of one person, like
the open mouth of Pac-Man, so that someone new can join.
* **Shuffle the groups.** People who sit down tend to stay with the same
group. After about 30 minutes of networking, insert a photo break so that
the groups mix.
* **Watch the drinks.** Buy more if they are running short.
### Close with announcements from participants
At the closing, give participants time to announce their own events and
communities. Once one or two people speak, others follow and the room livens
up, which also makes the organizers' own announcements easier to deliver.
The segment is easier to start when participants who run events or
communities are in the room.
## Follow-up
Follow-up for an offline event is the same as for an online one: analyze the
survey, hold a retrospective with the speakers, and check the result against
the metrics set during planning. The points to look at are described in
[Online Events](/devrel/online-event).
Also build ongoing contact with participants.
## Related pages
> [card] [Online Events](/devrel/online-event)
>
> The four phases and the planning practices this page builds on, applied to
> the online format.
> [card] [The role of DevRel](/devrel/engineering-culture)
>
> Why a company hosts events at all, and the principles that keep them
> serving the community.
> [card] [Technical Editing](/devrel/technical-editing)
>
> Another way a company takes part in the engineering community, through the
> articles it publishes.
# How to plan and run an online tech event, start to finish
Source: https://lib.findy.co.jp/devrel/online-event
Covers what distinguishes online events and the four phases of running one: planning, preparation, the day itself, and follow-up.
## Overview
An online event is an event in which speakers and participants join over a
streaming or video-conferencing service instead of gathering in one place.
For a company practicing DevRel, it is one of the most common ways to host
its own events, because it can be run repeatedly at modest cost.
This page covers how to run an online tech event. It first describes what
distinguishes the online format, then defines the four phases of running an
event and works through what each phase requires.
## What distinguishes online events
Four properties separate online events from in-person ones. Each widens what
the event can reach in one direction and constrains it in another. Publishing
the recording of an event afterward is called an archive stream.
| Property | What it widens | What it constrains |
| - | - | - |
| Reach | Participants can join from anywhere, and the size is bounded by the streaming service's capacity rather than a venue's | The event competes for attention with everything else on the participant's screen |
| Barrier to entry | No travel, so people can sign up on the day or join partway through | Signing up costs little, so a share of registrants do not attend |
| Interaction | Questions arrive in writing through chat or a Q\&A tool, which makes them easier for quiet participants to ask | Speakers cannot read the room, and silence on a stream feels long within seconds |
| Recording | An archive stream reaches people who could not attend at the scheduled time | Participants who know a recording will follow are more likely to skip the live session |
These properties shape the practices in the rest of this page. Late joiners
are why slides should carry what is said. The lack of a room to read is why
facilitation and question handling need dedicated people.
## The four phases of running an event
Running an event divides into four phases: planning, preparation, the day
itself, and follow-up. Each phase produces what the next one depends on.
```mermaid theme={null}
flowchart LR
A["Planning
purpose, target,
metrics"] --> B["Preparation
speakers, title,
promotion"]
B --> C["The day
facilitation,
questions"]
C --> D["Follow-up
survey,
retrospective"]
D -. "feeds the next plan" .-> A
```
Most of an event's outcome is decided in the planning phase. If the purpose
or the target audience is vague, careful preparation and smooth facilitation
cannot make the event reach the right people, because the speakers, the title,
and the promotion are all chosen to fit what planning decided.
Follow-up connects back to planning. What the survey and retrospective reveal
becomes input to the next event's plan, which is why the phases are a cycle
rather than a line.
> [!NOTE]
>
> Lightweight formats such as an informal lightning-talk night or a co-working
> session do not need the full sequence. The four phases pay off when an
> event has a specific audience and a goal to reach.
## Planning
Planning means deciding, provisionally, why the event is held, for whom, and
how its result will be judged. A plan is complete when each of these can be
stated in one sentence.
### Narrow the purpose to one
Give each event a single purpose. With several purposes, each later decision
can be justified by a different one, and it is common to finish preparation
and then find that the chosen angle fits none of them well.
### Identify the target and ask them directly
Name the target audience concretely: their role, their experience with the
topic, and what they would want to take home. Then test the plan by asking
people who match that description, such as engineers who use the technology
at work.
Asking is faster than research for this question. Published material shows
what exists, but only the target can say whether they would attend and what
would make the event worth their time. Before asking, write down who you want
to attend, the goal, and what you want to learn from them.
### Set metrics for the purpose
Decide in advance how the purpose will be measured. Without a measure, the
follow-up phase has nothing to check the result against.
| Kind | Examples |
| - | - |
| Quantitative | Registrations, attendance rate, visits to a page the event points to |
| Qualitative | Survey satisfaction, what survey comments say participants learned |
### Judge a technology's maturity by what has been written about it
For events about a specific technology, timing matters. Too early and no
speaker has enough experience to talk about; too late and the audience that
wanted an introduction has already moved on. The quality of articles
published about the technology is a usable indicator.
| What articles exist | Timing | Reason |
| - | - | - |
| Only summaries and announcements | Too early | Few people have used it yet |
| Sample code and tutorials | Borderline | There is not yet enough experience for a talk |
| Implementation notes and pitfalls | Suitable | People have started using it for real work |
| Only case studies from production use | Audience is narrow | It no longer appeals to people who are about to adopt it |
Attention on social media is not the same as demand. The test is whether
engineers in the target audience would want to try the technology.
### Alternate between deciding and researching
Do not try to settle the plan in one pass. Make a provisional decision,
research whether it holds, and revise it. Each round raises the resolution
of the plan.
When the plan cannot be put into words, it usually means the provisional
decision has not been tested enough. When a choice such as which speaker to
invite or which format to use is hard to make, return to the two anchors —
the target and the goal — and pick the option that serves them.
### Drop plans readily
Dropping a plan is a normal outcome of planning, not a failure. Drop or
postpone a plan when any of the following holds.
* No published work or practitioner supports the premise.
* Another organizer has recently held an event on the same theme.
* The target or the goal cannot be settled.
A plan pushed through despite these signs rarely draws its audience. A
dropped plan often becomes material for a later one.
Finally, check whether the people running the event want to hold it. Planning
and preparation take sustained effort, and that effort is hard to maintain
for a theme the organizers themselves are not curious about.
### Finding topics
Topics come from watching where engineers discuss technology. The main
sources are the following.
* Social media accounts where engineers post about their work
* Technology tags on social bookmarking services
* Engineering blogs published by companies
* Special issues of technical books and magazines
* Internal chat channels where engineers share what they are reading
* Events held by other organizers
Keep a list of keywords that catch your attention, even ones you do not yet
understand. Start researching a keyword when it crosses a threshold: it
appears across several of these sources within a short period, or a
well-known practitioner mentions it.
Engineers inside the company are another source. Ask them what they find
interesting about a technology, after doing your own research first so the
conversation goes beyond basics.
Past events that drew a strong response are also a valid starting point;
identify which element — the speakers, the theme, the format — drove the
response, and reuse it.
## Preparation
Preparation turns the plan into an event people can find and attend. It
covers inviting speakers, writing the title, aligning with speakers, and
promotion.
### Invite speakers
The invitation should make clear why this person is being asked. Mention the
articles or talks of theirs that you read and how they fit the plan, so the
recipient can see the request is based on research rather than sent in bulk.
State who you are and what the event is.
Keep the message short enough to read on a phone. Prepare more than one
candidate for each slot, because invitations are often declined or go
unanswered.
### Write the title
The title is how the target audience decides whether the event is for them.
Include the keywords the target would recognize, and make clear what the
event covers and what participants will take away.
Avoid the following kinds of expression. They attract attention once but
cost trust over repeated events.
* Alarmist or excessively negative phrasing, such as claims that something
is about to become obsolete
* Phrasing that favors one technology or role over another
* Emphasis on age or other attributes that pushes other people away
* Themes that already carry a strongly negative image
Show the draft title to the speakers during the alignment meeting. A wording
the speaker is uncomfortable with makes the talk harder to give and creates
expectations the talk will not meet.
### Align with speakers in advance
Hold an alignment meeting with each speaker, typically about 30 minutes.
Explain the background of the plan, why you invited them, and the target and
the goal. The same technical theme calls for different content depending on
the audience, so the speaker needs this to decide what to say.
Settle the talk theme by asking rather than prescribing. Ask which parts of
the topic they could not talk about, and which parts would be interesting to
go deeper on.
Ask speakers to put what they will say on their slides. Participants who join
partway through can catch up, and the organizers can follow the content and
prepare questions in advance.
### Promote the event
Promotion is the work of making the event known to the target audience and
turning that awareness into registrations and attendance. Announcements from
the speakers are the most effective channel, because they reach people who
already follow the speakers' work.
Speakers announce an event they are looking forward to. The alignment meeting
is where that attitude forms, so use it to make the event something the
speaker wants to do, and ask there whether they would share the announcement.
Posting from the event's account with the speakers mentioned makes it easy for
them to share.
Send reminders the day before and on the day. A short, specific message about
what participants will hear keeps their interest and reduces last-minute
cancellations.
## The day of the event
On the day, the organizers' job is to keep the event focused on what the
target audience came for. That depends on checks before the start, a clear
division of roles, and facilitation.
### Before the start
Meet the speakers 15 to 30 minutes before the start. Confirm once more what
the event is meant to give participants, and check audio, screen sharing,
and the streaming controls.
### Divide the roles
Assign the behind-the-scenes work to specific people so that the facilitator
can concentrate on the conversation.
| Role | What it covers |
| - | - |
| Chat and questions | Monitoring chat, collecting and organizing questions for the speakers |
| Social media | Watching and responding to posts about the event |
| Timekeeping | Tracking the schedule and signaling the speakers |
| Speaker coordination | Relaying messages between speakers and organizers during the stream |
| Next steps | Sharing links and pointing participants to what follows the event |
The number of people needed grows with the audience. As a guideline, one
person can cover an event of up to about 30 participants, two people up to
about 100, and three or more beyond that.
### Facilitate the conversation
Facilitation keeps the conversation moving and evenly shared. In
panel-style sessions, watch the following.
* **Do not let silence run long.** On a stream, a pause of a few seconds
already feels like a problem. Keep spare questions ready for when a
section ends early.
* **Do not talk too much as the facilitator.** The participants came for the
speakers.
* **Let speakers address each other.** A session where only the facilitator
asks questions becomes a series of interviews.
* **Watch the balance of speaking time.** Bring in speakers who have spoken
less before one voice dominates.
At the opening, state what the session will cover and what it will not.
This sets participants' expectations and reduces dissatisfaction from people
who came for something the event never planned to address.
### Answer every question
Make it the rule to answer every question during the event, not as many as
time allows. Reserve enough time for this; for a 90-minute event, set aside at
least 30 minutes for questions. Collecting questions at registration and
sharing them with the speakers beforehand helps fill this time.
Questions that cannot be answered on the day are answered afterward, for
example in the follow-up message to participants.
## Follow-up
Follow-up checks the result against the purpose and carries what was
learned into the next plan.
Analyze the participant survey while it is fresh, ideally by the next
business day. Hold a retrospective with the speakers as well; they often
have feedback on the plan and the facilitation that participants cannot
see.
Check the result against the metrics set during planning, and also look at
the following from both sides.
| Side | What to look at |
| - | - |
| Quantitative | Registrations and attendance compared with past events on similar themes; whether the date overlapped with other events for the same audience |
| Qualitative | What survey comments have in common, both what worked and what did not; whether participants' level matched the intended target |
Reflect the findings in the next plan. This works only if the purpose,
target, and metrics were written down during planning, and if changes made
between planning and the event were recorded. Without them, there is
nothing to compare the result to.
## Related pages
> [card] [The role of DevRel](/devrel/engineering-culture)
>
> Why a company hosts events at all, and the principles that keep them
> serving the community.
> [card] [Engineer Growth](/organization/engineer-growth)
>
> Team study sessions run on the same cycle of planning, holding, and
> reflecting on a smaller scale.
> [card] [Offline Events](/devrel/offline-event)
>
> What changes when the event happens in a room: venue, layout, supplies,
> and the networking session.
# How to edit technical articles: roles and term checks
Source: https://lib.findy.co.jp/devrel/technical-editing
Defines the three roles of technical editing, how to check technical terms against a term list, and the order in which to edit a draft.
## Overview
Technical editing is the work of taking a draft written by an engineer and
making it accurate, readable, and consistent before it is published in a
technical media outlet such as a company engineering blog or an interview
series.
This page covers what that editing is responsible for, how to check
technical terms, and the order in which to work through a draft.
## What technical editing is
### Three roles
Technical editing has three roles. Each one protects a different thing, so
a draft can pass one and still fail another.
| Role | What it protects | Typical question |
| - | - | - |
| Accuracy | The reader's trust in the content | Is this claim true for the version and conditions the article describes? |
| Readability | The reader's time | Can a reader in the target audience follow the argument without rereading? |
| Consistency | The outlet's credibility as a whole | Is the same thing named the same way here as in every other article? |
Accuracy comes first because an error in a technical article costs more than
an awkward sentence. A reader who follows an incorrect step loses time, and
a reader who notices the error stops trusting the rest of the article.
Readability is judged against the target reader, not the editor. An editor
who already knows the topic will fill gaps without noticing them, so the
check is whether the text works for someone who does not.
Consistency matters at the level of the outlet rather than the single
article. When each article spells the same product or concept differently,
readers start to doubt whether the outlet checks anything at all.
## Checking technical terms
### What to check
Term checks catch errors that a general proofreading pass misses, because
a misspelled product name or an outdated version number reads as perfectly
fluent text.
| Check | What goes wrong | What to do |
| - | - | - |
| Spelling variants | The same thing is written several ways in one article | Pick one form and use it throughout |
| Abbreviations | An abbreviation appears before the reader knows what it stands for | Spell it out on first use, or avoid it if the audience may not know it |
| Proper nouns | A product or project name has the wrong capitalization or spacing | Use the official spelling from the product's own documentation |
| Version and time dependence | A statement is true only for a certain version or at the time of writing | State the version or date the statement applies to |
Version and time dependence needs the most attention. A statement such as
"this option is the default" may be true when written and false a year
later, so the article should say which version it was verified against.
### Examples to avoid and recommend
| Avoid | Recommend | Reason |
| - | - | - |
| Javascript, javascript | JavaScript | Official capitalization |
| Github, github | GitHub | Official capitalization in body text |
| Postgres and PostgreSQL mixed in one article | PostgreSQL throughout | One name per thing within an article |
| front end, front-end, frontend mixed | One form, used throughout (for example, "frontend") | Spelling variants of a common noun |
| K8s on first mention | Kubernetes, with "K8s" only after it is introduced, if at all | Abbreviation before definition |
| "the latest version supports this" | "Version 3.2 supports this" | Time-dependent wording |
### Keep a term list
Checking terms from memory is unreliable, because each editor remembers a
different set of rules. A term list fixes the rules in one place and turns
the check into a comparison.
A practical term list has three columns: the correct form, examples of
incorrect forms, and a note explaining the rule or its source. The note
matters because it lets the next editor decide edge cases instead of
guessing.
> [!TIP]
>
> Check only against the list. Do not "correct" terms that are not in it
> based on intuition, because a confident guess about an unfamiliar name
> introduces new errors. When a new term keeps causing variation, add it to
> the list with its source.
## The editing process
Edit a draft in order from the largest unit to the smallest. Fixing wording
in a paragraph that later gets cut wastes the work, so structure comes
before sentences.
**1. Check the structure**
Confirm the target reader. Check that the headline
promises what the article delivers, and that the sections follow an
order the reader can follow.
**2. Check the facts**
Verify each claim that can be wrong: definitions, classifications,
numbers, version-dependent behavior, and comparisons. Accept as evidence
only primary sources such as official documentation or specifications.
When a claim cannot be verified, ask the author for the source rather
than rewriting it.
**3. Check the terms**
Compare the terms in the draft against the term list. Unify spelling
variants, expand abbreviations on first use, and confirm that proper
nouns and version references are correct.
**4. Adjust the wording**
Shorten long sentences, remove redundant phrasing, and replace jargon
the target reader may not know. Keep each change small and explainable.
**5. Confirm with the author**
Send the edited draft back with the reason for each substantive change.
The author approves the final version before it is published.
Generative AI can help prepare a draft before this process starts, for
example by producing a first outline or listing candidate headlines from a
set of requirements. Its output is a starting point that still goes through
every step above, especially the fact check.
## Caveats
### Respect the author's intent
The article belongs to its author. An editor's change is justified when it
serves accuracy, readability, or consistency; a change made only because the
editor would have phrased it differently is not.
When a passage is unclear, ask what the author meant before rewriting it. A
rewrite based on a wrong guess can change the technical meaning while
sounding more polished, which is worse than the original.
### Avoid over-editing
Over-editing removes the author's voice and makes every article in the
outlet sound alike. It also slows the process, because the author has to
review changes that were never necessary.
Limit each edit to the problem it fixes. When an error is found, correct
that passage only, and leave the surrounding text and the author's style as
they are.
> [!NOTE]
>
> Separate required changes from suggestions when returning a draft.
> Required changes are errors in fact, terms, or the outlet's standards;
> suggestions are improvements the author may accept or decline. Marking the
> difference keeps the author's decisions in the author's hands.
## Related pages
> [card] [The role of DevRel](/devrel/engineering-culture)
>
> Where technical media fits among the ways a company takes part in the
> engineering community.
> [card] [Offline Events](/devrel/offline-event)
>
> Another way to take part in the community: hosting events where
> engineers meet in person.
# What is component testing? Testing behavior, not internals
Source: https://lib.findy.co.jp/frontend/component-testing
Principles and patterns for component tests with Vitest and Testing Library that verify what users observe, not implementation details.
## Overview
A component test renders a component, reproduces user interaction, and verifies the result that appears on the screen. In the Testing Trophy it belongs to the integration layer, which verifies behavior with the backend boundary mocked, and the tools are Vitest and Testing Library. See [Testing Strategy](/frontend/testing-strategy) for the layer model as a whole.
This page covers the principles that decide what a component test verifies, and the patterns for writing stable tests with Vitest and Testing Library. Verifying visual appearance is the job of Storybook and [visual regression testing](/frontend/visual-regression-testing), and is out of scope here.
The shared principles that keep every test trustworthy (verifying resulting state, verifying the whole expected value, and mocking only external boundaries) are covered in [Test Code](/development/testing). This page applies those principles to components.
## Principles
### Verify behavior users can observe, not implementation details
The subject of a component test is what users can see and operate. Testing Library states this as a guiding principle, "The more your tests resemble the way your software is used, the more confidence they can give you", and exposes only APIs that deal with DOM nodes rather than component instances.
A component has two kinds of users: the end user who operates the rendered screen, and the developer who passes props. A test touches the component only from these two positions, and does not depend on implementation details such as internal state, the props passed to child components, or CSS class names.
A test that depends on implementation details becomes untrustworthy in two directions. It fails after a pure restructuring (a false negative), and it passes while the screen is broken as long as the internal values match (a false positive).
```tsx Vitest + Testing Library theme={null}
import { render, screen } from "@testing-library/react";
import { OrderList } from "./OrderList";
import { OrderRow } from "./OrderRow";
const orders = [
{ id: "1001", status: "paid", total: 3200 },
{ id: "1002", status: "pending", total: 1800 },
];
// ❌ Replaces the child component and verifies the props it received
// (passes when the child renders wrongly, fails when the child is inlined)
vi.mock("./OrderRow", () => ({ OrderRow: vi.fn(() => null) }));
render();
expect(OrderRow).toHaveBeenCalledWith(
expect.objectContaining({ status: "paid" }),
expect.anything()
);
// ✅ Renders the real component tree and verifies what the user sees
render();
expect(screen.getByRole("row", { name: /1001/ })).toHaveTextContent("Paid");
expect(screen.getByRole("row", { name: /1002/ })).toHaveTextContent("Pending");
```
### Tell narrow unit tests from broad unit tests
The term unit test has two meanings. A narrow unit test targets a single function: pure logic such as computing a total or normalizing a date range is verified in the unit layer through input and output, with no rendering.
A broad unit test targets one behavior produced by a combination of hooks and components. React hooks often return functions, so verifying each function in isolation does not guarantee that the screen behaves correctly, and the behavior is tested as a whole. The component tests on this page are broad unit tests in this sense.
The two need to be told apart because both run on the same test runner (Vitest) and are often written in the same test file. When the viewpoint that checks a function's input and output and the viewpoint that checks the behavior of the rendered screen mix in one file, one kind of test tends to grow thick while the other stays thin, and nobody notices. When writing a test, be conscious of which viewpoint it verifies and keep the two apart.
> [card] Narrow unit test (unit layer)
>
> Input and output of a pure function: a total, a normalized date, a sort comparator. No rendering, verified with Vitest alone.
> [card] Broad unit test (integration layer)
>
> A behavior produced by components and hooks together. How the screen changes in response to interaction, verified with Testing Library.
### Leave what types can guarantee to the static layer
Component tests stand on top of the static layer. When TypeScript types limit the values that props and state can take, values outside that range (an undefined that cannot be passed, a status that does not exist) are rejected by the compiler, so component tests do not need to verify them. This applies the principle from [Testing Strategy](/frontend/testing-strategy) ("verify everything at the lowest layer that can catch the failure") to the boundary between the static and integration layers.
Types take over verification in many places. If the type guarantees whether a field can be null or undefined, there is no need to test both cases, and only the one the type allows is verified. A status limited to a union of string literals, or props that distinguish required from optional, work the same way. The more values the type rules out of the tests, the more the component tests concentrate on behavior.
```tsx Vitest + Testing Library theme={null}
import { render, screen } from "@testing-library/react";
import { OrderRow } from "./OrderRow";
// The order type, with the possible values limited by the type
type Order = {
id: string;
status: "pending" | "paid" | "shipped";
shippedAt: string | null;
total: number;
};
const order: Order = {
id: "1001", status: "paid", shippedAt: null, total: 3200,
};
// ❌ Verifies values the type already rules out
// (undefined cannot be passed, and an unknown status is a compile error)
render();
render();
// ✅ Verifies only the values the type allows (null, and the three statuses)
render();
expect(screen.getByText("Not shipped")).toBeInTheDocument();
```
This division of labor extends to mocks. When backend responses are replaced with the API provider's types attached, a change in the API contract is caught by the type check in the static layer rather than by the component tests. The concrete method is covered under "Type mock responses with the API provider's types" in the patterns below.
## Patterns with Vitest and Testing Library
The patterns below use an order list screen as the example. The screen consists of a form that filters orders by status and a table that shows the fetched orders. The examples assume Vitest's global APIs (`test`, `expect`, `vi`) and the matchers from `@testing-library/jest-dom`.
### Find elements the way users find them
Testing Library queries have a priority order. The highest priority goes to queries that find elements through cues visible to every user: `getByRole` by role and name, `getByLabelText` by label, and `getByText` by visible text.
`getByTestId` is the last resort. A test attribute is neither visible nor audible to users, and an element that cannot be found by role or name may point to an accessibility problem in the UI itself. `container.querySelector` is not used either, because it depends on DOM structure and fails after a pure restructuring.
```tsx Vitest + Testing Library theme={null}
import { render, screen } from "@testing-library/react";
import { OrderSearch } from "./OrderSearch";
const { container } = render();
// ❌ Depends on test attributes and DOM structure
// (cues users never see; fails when the structure is reorganized)
screen.getByTestId("status-select");
container.querySelector("form > button.primary");
// ✅ Uses the same cues users use to find the element
// (keeps passing through structural changes while label and name hold)
screen.getByLabelText("Status");
screen.getByRole("button", { name: "Search" });
```
### Reproduce interaction with user-event
User interaction is reproduced with `@testing-library/user-event`. `fireEvent` dispatches a single DOM event, while `user-event` reproduces the sequence of events a browser actually fires, such as the focus change on click or the per-key events while typing.
Call `userEvent.setup()` at the start of the test and interact through the returned instance. Interactions are asynchronous, so they are awaited.
```tsx Vitest + Testing Library theme={null}
import { fireEvent, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { OrderSearch } from "./OrderSearch";
render();
// ❌ Fires a single change event, which is not what the user does
// (logic that reacts to focus or key events never runs)
fireEvent.change(screen.getByLabelText("Status"), {
target: { value: "paid" },
});
// ✅ Reproduces the event sequence a browser fires
const user = userEvent.setup();
await user.selectOptions(screen.getByLabelText("Status"), "paid");
await user.click(screen.getByRole("button", { name: "Search" }));
```
### Wait for elements to appear, not for time to pass
An element that appears after data is fetched is awaited with a `findBy` query. `findBy` retries until the element appears and fails after one second by default. A fixed delay is unstable when too short and slows the whole suite when too long.
Absence, or disappearance, is verified with a `queryBy` query. `getBy` throws when nothing matches, so it cannot assert absence. For conditions other than the presence of an element, use `waitFor`.
```tsx Vitest + Testing Library theme={null}
import { render, screen, waitFor } from "@testing-library/react";
import { OrderSearch } from "./OrderSearch";
render();
// ❌ Waits a fixed time before querying
// (fails when the response is slow, stays slow when it is fast)
await new Promise((resolve) => setTimeout(resolve, 500));
screen.getByRole("table");
// ✅ Waits for the element, and verifies the loading state is gone
expect(await screen.findByRole("table")).toBeInTheDocument();
expect(screen.queryByText("Loading")).not.toBeInTheDocument();
// ✅ Conditions other than presence are awaited with waitFor
await waitFor(() => {
expect(screen.getAllByRole("row")).toHaveLength(3);
});
```
### Verify screen-independent hooks with renderHook
`renderHook` runs a hook outside a component and exposes its return value through `result.current`. It is imported from `@testing-library/react`, and calls that update state are wrapped in `act`.
It suits hooks that hold logic shared by several screens, or hooks with no UI of their own. A hook that exists for one screen only is verified through interaction in that screen's component test. Testing it in both places duplicates the same behavior and doubles the places to fix on every change.
```tsx Vitest + Testing Library theme={null}
import { act, renderHook } from "@testing-library/react";
import { useOrderFilter } from "./useOrderFilter";
const orders = [
{ id: "1001", status: "paid", total: 3200 },
{ id: "1002", status: "pending", total: 1800 },
];
// ❌ Tests a screen-specific hook on its own, duplicating
// the behavior already covered by the component test
renderHook(() => useOrderSearchForm());
// ✅ Verifies a hook shared by several screens through its return value
const { result } = renderHook(() => useOrderFilter(orders));
expect(result.current.filtered).toHaveLength(2);
act(() => {
result.current.setStatus("paid");
});
expect(result.current.filtered.map((o) => o.id)).toEqual(["1001"]);
```
### Mock only the backend boundary
The only thing a component test mocks is the boundary with the backend. Responses are replaced at the network boundary with Mock Service Worker (msw). From the component's point of view a real HTTP request is made, so the API client and the data-fetching hook run unchanged, and the test catches mistakes down to how the mocked response is interpreted.
Child components, hooks, and state stores are not replaced. They are the parts that produce the component's behavior, and replacing them is the situation that pattern 3 of [Test Code](/development/testing) describes as mocking the logic under test. A test built that way keeps passing no matter how the implementation changes. For external boundaries other than the network, such as the current time or random values, see the same page.
The default responses are registered in the setup file. A test-specific response, such as an error, is overridden for that test alone with `server.use`, and `resetHandlers` after each test removes the override so tests stay independent.
```typescript vitest.setup.ts theme={null}
import { afterAll, afterEach, beforeAll } from "vitest";
import { setupServer } from "msw/node";
import { http, HttpResponse } from "msw";
export const server = setupServer(
// The default response, shared by every test
http.get("/api/orders", () =>
HttpResponse.json([
{ id: "1001", status: "paid", total: 3200 },
{ id: "1002", status: "pending", total: 1800 },
])
)
);
beforeAll(() => server.listen());
// Remove per-test overrides so tests stay independent
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
```
```tsx Vitest + Testing Library theme={null}
import { render, screen } from "@testing-library/react";
import { http, HttpResponse } from "msw";
import { server } from "../vitest.setup";
import { OrderSearch } from "./OrderSearch";
// ❌ Replaces the data-fetching hook
// (a change in the API response shape goes undetected)
vi.mock("./useOrders", () => ({
useOrders: () => ({ data: [], error: new Error("failed") }),
}));
// ✅ Overrides the response for this test only and verifies the screen
test("shows an error when fetching fails", async () => {
server.use(
http.get("/api/orders", () =>
HttpResponse.json({ message: "unavailable" }, { status: 500 })
)
);
render();
expect(await screen.findByRole("alert")).toHaveTextContent(
"Orders could not be loaded"
);
});
```
### Type mock responses with the API provider's types
As long as msw replaces the responses, the component tests keep passing even after the real API contract changes. To keep the handlers from drifting away from the real API, obtain type information from the API provider and type the handler responses with it. The types come from an OpenAPI document or a GraphQL schema, or from type definitions shared with the backend.
With the types in place, a change in the API contract is caught by the type check in the static layer, not by the component tests. The component tests keep running on mocks that are known to be valid, and guaranteeing the correctness of the mocks through types is what sustains the quality of the tests in this layer. This applies the division of labor with the static layer, described under the principles, to mocks.
```typescript vitest.setup.ts theme={null}
// Types generated from the API provider (an OpenAPI document or GraphQL schema)
import type { Order } from "./api/types";
// ❌ Writes the response shape by hand
// (the misspelled field state goes unnoticed)
// (when the API contract changes, the mock and the tests keep passing)
http.get("/api/orders", () =>
HttpResponse.json([{ id: "1001", state: "paid", total: 3200 }])
);
// ✅ Types the response through the handler's third type argument
// (a renamed field or a changed type fails the type check before tests run)
http.get("/api/orders", () =>
HttpResponse.json([{ id: "1001", status: "paid", total: 3200 }])
);
```
## Related pages
The following pages cover where component tests sit in the layer model, and the layers below and above them.
> [card] [Testing Strategy](/frontend/testing-strategy)
>
> The criteria for choosing a layer, and why component tests form the widest part of the integration layer.
> [card] [Test Code](/development/testing)
>
> The foundation of this page's principles: resulting state, whole expected values, and boundary mocks.
> [card] [E2E Testing](/frontend/e2e-testing)
>
> Protecting the backend wiring that mocks cannot detect, limited to primary journeys.
> [card] [Visual Regression Testing](/frontend/visual-regression-testing)
>
> The appearance side of the same layer: what a DOM query cannot see, verified through stories and snapshots.
# What is E2E testing? A small test suite you can trust
Source: https://lib.findy.co.jp/frontend/e2e-testing
Protect primary user journeys with a small E2E suite that runs against a deployed environment and stays trustworthy.
## Overview
An end-to-end (E2E) test drives the application through a real browser and verifies that a user journey completes across the entire system: frontend, backend, and database working together.
E2E is the only test layer that verifies the system the way users experience it, but it is also the most expensive to run and maintain. The suite therefore stays small: it covers the primary journeys, reliable enough that a failure always means something.
This page explains the principles that keep an E2E suite trustworthy, the patterns for writing stable tests with Playwright, and how to bridge the boundaries with external services. For the general principles of protective test code, see [Test Code](/development/testing).
## Principles
### Cover primary journeys, not every case
E2E tests need a deployed environment, take seconds to minutes each, and can fail for reasons outside the code, such as network conditions, test data, and timing. Every scenario added to the suite raises the cost of a release, so each one must earn its place.
Limit the suite to the journeys where breakage immediately hits the business:
> [card] Authentication
>
> Sign-in and sign-up. When these break, every user is locked out.
> [card] Revenue-critical flows
>
> Checkout, order placement, and other operations that convert directly into revenue.
> [card] Smoke over primary screens
>
> Each key screen loads, and its main action completes.
This level of coverage catches what E2E exists to catch: a broken deployment, or a broken integration between parts that were each correct in isolation.
### Verify details in lower layers
Anything that does not need a real browser against a real backend belongs in a lower layer. Validation branches, conditional rendering, and component logic are verified faster and more precisely by component tests; E2E only needs to confirm that the parts are wired together correctly.
Whether a new scenario belongs in E2E is decided by one question: does this failure only become visible when the whole system runs together? If a component test could catch it, write the component test and leave the E2E suite unchanged.
### Run E2E after deployment as a release check
E2E tests verify a deployed environment, so they run after deployment, when a release merge has deployed to the staging or production environment, rather than in the pull request pipeline. The suite acts as the release check: it confirms that the primary journeys work in the environment users are about to use.
The scenarios differ between staging and production; how to select them is covered in the operations section below.
When the check fails, the result feeds the release decision: halt the rollout or roll back. See [Release](/development/release-strategy) for how deploys stay easy to reverse.
This division keeps pull request feedback fast, because the slowest layer stays off the pull request's critical path, while every release still receives a whole-system verification. See [CI/CD](/development/ci-cd) for the pipeline design this fits into.
### Fix or quarantine flaky tests immediately
A test that fails intermittently without a real defect is a source of false positives: it trains the team to re-run failures instead of reading them, until a real breakage is re-run and ignored as well. In the release pipeline this is fatal, because a failing E2E run must retain the power to stop a release.
When a test turns flaky, fix it or quarantine it the day it is noticed. To quarantine, take the test out of the release check with `test.fixme()` and file the fix as a work item, so the rest of the suite stays trustworthy while the cause is investigated.
```typescript Playwright theme={null}
// Take a flaky test out of the release check until it is fixed
test.fixme("order history shows a placed order", async ({ page }) => {
// ...the scenario stays in the code; only its execution stops
});
```
The patterns in the next section prevent the most common causes. The trust mechanics are the same as in [Test Code](/development/testing): passing and failing must both stay trustworthy.
## Practices with Playwright
The first three patterns address the main sources of E2E instability; the last two keep the cost of the suite flat as screens and roles grow.
### Locate elements the way users find them
CSS classes and DOM structure are implementation details: they change during styling or refactoring without any change in behavior, and every such change breaks the test. That is a false positive.
Locate elements by what users perceive: role, accessible name, and label.
```typescript Playwright theme={null}
// ❌ Depends on markup details (breaks when styling or structure changes)
await page.locator(".btn-primary").click();
await page.locator("#order-list > div:nth-child(2) a").click();
// ✅ Locates by role and accessible name, as a user would
await page.getByRole("button", { name: "Place order" }).click();
await page.getByRole("link", { name: "Order history" }).click();
```
> [!TIP]
>
> When an element has no stable accessible name, prefer adding one (a label or `aria-label`) over falling back to `getByTestId`: it fixes the test and the accessibility gap at once.
### Wait for state, not for time
A fixed sleep is a guess at how long the system takes, and the guess fails in both directions. Too short, and the test fails under load while the system is correct. Long enough to be safe, and the suite slows down on every run.
Playwright's web-first assertions retry automatically until the expected state appears, so the test waits exactly as long as needed.
```typescript Playwright theme={null}
// ❌ Guesses the timing (fails under load, wastes time everywhere else)
await page.waitForTimeout(3000);
expect(await page.locator(".order-row").count()).toBe(3);
// ✅ Retries until the state appears, up to the timeout
await expect(page.getByRole("row", { name: /Order #/ })).toHaveCount(3);
```
### Give each test its own data
Tests that read state left behind by other tests fail in cascades: they cannot run alone, in parallel, or in a different order, and one broken test takes its dependents down with it. Each test prepares the account and records it needs, and asserts only on what it created.
```typescript Playwright theme={null}
// ❌ Depends on state another test created
// (fails when run alone, in parallel, or in a different order)
test("shows the order from the previous test", async ({ page }) => {
await signIn(page, sharedAccount);
await expect(page.getByRole("row", { name: "Order #1" })).toBeVisible();
});
// ✅ Prepares its own account and data, so it can run anywhere
test("order history shows a placed order", async ({ page }) => {
const account = await prepareTestAccount();
const order = await createTestOrder(account);
await signIn(page, account);
await page.getByRole("link", { name: "Order history" }).click();
await expect(page.getByRole("row", { name: order.number })).toBeVisible();
});
```
Make test data recognizable as test data: a fixed prefix combined with a unique suffix such as a timestamp.
The unique suffix prevents collisions between parallel runs, and the recognizable prefix makes leftover data safe to clean up. The external services section below covers how to prepare this data through a test-support API rather than the UI.
### Set up authentication once and reuse it
Signing in through the UI at the start of every test is slow and concentrates failures: when the login screen changes, every test in the suite fails at once.
Playwright separates authentication from scenarios: a setup project signs in once per role, saves the authenticated state to a file with `storageState`, and every test starts already signed in.
```typescript Playwright theme={null}
// ❌ Every test signs in through the UI before its real work
test.beforeEach(async ({ page }) => {
await page.goto("/login");
// ...fill in credentials on every single test
});
// ✅ A setup project signs in once per role and saves the state
import { test as setup } from "@playwright/test";
setup(`authenticate as ${role}`, async ({ page }) => {
await page.goto("/login");
await page.getByLabel("Email").fill(user.email);
await page.getByLabel("Password").fill(user.password);
await page.getByRole("button", { name: "Sign in" }).click();
await page.waitForURL("/dashboard");
await page.context().storageState({ path: authFile(role) });
});
// ✅ Tests reuse the saved state and start signed in
test.use({ storageState: authFile("admin") });
```
Prepare one test account per role (administrator, manager, staff) and run the setup for each. The sign-in flow itself stays covered, because the setup exercises it for every role on every run.
### Generate the screen-by-role smoke from data
The smoke check from the principles, where every primary screen loads for every role, is a matrix, and writing each cell by hand does not scale. Define the screens once as data, together with the roles allowed to see each, and generate the tests in a loop.
```typescript Playwright theme={null}
// Screens defined once as data: path, expected heading, allowed roles
const screens = [
{ path: "/reports", heading: "Reports", roles: ["admin", "manager"] },
{ path: "/settings/members", heading: "Member settings", roles: ["admin"] },
];
// One smoke test per screen per role, generated from the table
// (role is the role this suite runs as; one fixed value per spec file)
for (const { path, heading, roles } of screens) {
test(`${heading} ${path}`, async ({ page }) => {
await page.goto(path);
const expected = roles.includes(role) ? heading : "Dashboard";
await expect(
page.getByRole("heading", { level: 1, name: expected })
).toBeVisible();
});
}
```
The same table verifies both directions: an allowed role sees the screen's heading, and a disallowed role lands on the fallback instead of the protected content.
Adding a screen or a role is a one-line change, and an access-control regression (a screen exposed to the wrong role) fails the same suite that checks rendering.
## Bridging external services
A journey that leaves the browser, such as third-party sign-in, email delivery, or two-factor authentication, cannot be driven by the browser test alone, and depending on the live external service makes the run nondeterministic.
The test environment bridges these boundaries with two mechanisms: stub APIs that stand in for the external service behind the backend, and test-support APIs that let the test prepare and observe state it cannot reach through the UI.
This is the E2E form of the principle in [Test Code](/development/testing): mock the external boundary, never the logic under test. In E2E the whole backend is the logic under test, so the boundary to fix sits behind it, at the edge where the system calls services the team does not control.
### Prepare and observe state through a test-support API
Some state a scenario needs cannot be created or read through the UI: a fresh organization for a signup flow, a one-time password for two-factor authentication, the body of an email the application just sent.
Expose these as test-support endpoints in the test environment: creating and cleaning up test data, issuing codes, and reading delivered mail. With these in place, the scenario crosses the boundary without manual steps.
Effects that happen outside the browser, such as an email arriving, are beyond the reach of web-first assertions, so waiting for state takes a different form here: poll with a bounded timeout instead of sleeping a fixed time.
```typescript Playwright theme={null}
// Create the data the scenario needs through a test-support API
// (runId is a unique identifier per run, such as a timestamp)
const org = await createTestOrg({ name: `e2e-signup-${runId}` });
// ❌ Guesses how long delivery takes (fails when slow, wastes time when fast)
await page.waitForTimeout(15000);
const mail = await fetchLatestMail({ to: org.email });
// ✅ Polls with a bounded timeout until the mail arrives, then reads it
await expect
.poll(() => fetchLatestMail({ to: org.email }), { timeout: 30_000 })
.not.toBeNull();
const mail = await fetchLatestMail({ to: org.email });
```
### Keep stubs and test-support APIs out of production
Test-support endpoints are powerful by design: they create accounts, issue credentials, and read mail. That power makes them dangerous anywhere users can reach.
> [!WARNING]
>
> Require authentication on every test-support endpoint, serve them from a namespace separate from the public API, and enable them only in test environments. A test-support endpoint reachable in production is a security incident waiting to happen.
The same isolation applies to scenarios: journeys that create data through these endpoints run against staging, not production. The operations section below covers how to encode that restriction.
### Watch for drift between stubs and the real service
A stub is a copy of the external service's contract, and copies drift: the provider changes a response shape or an authentication flow, the stub keeps answering the old way, and the suite passes while the real integration is broken. That is a false negative.
A stub that is too permissive hides exactly the failures the integration exists to prevent.
Two defenses work together. Keep each stub thin: implement only the endpoints and fields the application actually reads, so there is less surface to drift.
And keep a small number of scenarios that exercise the real integration against the staging environment, where real external-service accounts can be used safely. The real-integration scenarios catch drift; the stubs keep the rest of the suite deterministic.
## Operating the suite in the release pipeline
### Select scenarios per environment
The same suite does not need to run everywhere in full. Scenarios that create data or call external services run against staging; production runs the read-only smoke: screens render, and journeys without side effects complete.
Encode the restriction in the test itself rather than in pipeline configuration, so the rule survives pipeline changes.
```typescript Playwright theme={null}
test.skip(
process.env.E2E_ENV === "production",
"Scenarios that create data do not run against production"
);
```
### Investigate failures with traces
A failure in a deployed environment is hard to reproduce locally, so collect the evidence at run time. Playwright's trace records every action together with screenshots, console output, and network activity; configure the pipeline to keep traces for failed runs, and a failed run becomes a recording to inspect rather than a mystery to reproduce.
Structuring long scenarios with `test.step` pays off here: the trace shows which step failed, not just which line.
### Treat a retry pass as a failure signal
Automatic retries separate transient infrastructure issues from persistent breakage, and they are worth enabling against a deployed environment.
A test that passes on retry, however, is not a success: it is flaky, and it goes on the fix list. Counting retry passes as success hides exactly the instability that erodes trust in the suite.
### Keep the suite fast enough to gate releases
The suite guards every release, so its runtime sits on the release's critical path. Run tests in parallel, which the per-test data isolation makes safe, and hold the line on suite size: when a new scenario arrives, first check whether an existing scenario already covers the journey, or whether a lower layer could verify it instead.
## Related pages
> [card] [Testing Strategy](/frontend/testing-strategy)
>
> The Testing Trophy layers, and how to decide which layer verifies what.
> [card] [Test Code](/development/testing)
>
> The principles of protective tests: trustworthy passing and failing, and mocking only at boundaries.
> [card] [Component Testing](/frontend/component-testing)
>
> Where verification that stays out of E2E belongs: screen behavior verified on a mocked backend.
> [card] [Release](/development/release-strategy)
>
> Separating deploy from release, and choosing what a release check protects.
# What is a testing strategy? Choosing the right test layer
Source: https://lib.findy.co.jp/frontend/testing-strategy
Assign each verification to the lowest test layer that can catch its failure, using the Testing Trophy as the map of a frontend test suite.
## Overview
A testing strategy is the set of decisions about which test layer verifies what, and with which tool. This page explains the layer model for frontend testing, what each layer is responsible for, and the criteria for placing a new verification in the right layer.
Frontend code mixes concerns that break in different ways: rendering logic, user interaction, visual appearance, and communication with the backend. No single kind of test catches all of these failures at a reasonable cost, so a frontend suite combines several layers, each with a distinct responsibility.
One principle organizes the layers: verify everything at the lowest layer that can catch the failure. Lower layers run faster and point more precisely at the cause, and the higher layers stay reserved for failures that only appear when larger parts of the system run together.
This page covers where each verification belongs, and how the Testing Trophy differs from the Test Pyramid it builds on. How to make each verification strong, so that passing and failing both stay trustworthy, is covered in [Test Code](/development/testing).
## The Testing Trophy
The **Testing Trophy** is a layer model for frontend testing proposed by Kent C. Dodds. It arranges tests into four layers: static, unit, integration, and end-to-end (E2E).
> [card] Static
>
> Type checking and linting analyze the code without running it, and reject whole classes of defects such as type mismatches and references that do not exist.
> [card] Unit
>
> Verifies a single function or module in isolation. Fast and precise, suited to pure logic with many input patterns.
> [card] Integration
>
> Verifies a component tree through rendering and user interaction, with the backend boundary mocked. The widest layer of the trophy.
> [card] E2E
>
> Drives a real browser against a deployed environment and verifies that primary user journeys complete across the whole system.
Lined up by speed and cost, the four layers compare as follows:
| Layer | Speed | Setup and upkeep | Where a failure points |
| - | - | - | - |
| Static | Fastest (instant in the editor) | Lowest | The exact line |
| Unit | Fast | Low | The function and its input |
| Integration | Fast (slower than unit) | Medium (boundary mocks) | The component |
| E2E | Slow | High (deployed environment) | Somewhere along the journey |
The layers trade cost for confidence in opposite directions. A higher layer runs the system closer to the way users experience it, so one passing test covers more and means more; that same test is slower to run, needs more setup, and reports failures further from the cause.
A lower layer is fast, cheap, and precise: a failing type check names the exact line. What it cannot do is prove that the parts work together, because each check sees only a small part in isolation.
The trophy's shape encodes where the balance lands for frontend code. The integration layer holds the largest share of tests because a component test exercises rendering, state, and interaction together, while still running quickly in the pull request pipeline against a mocked backend.
> [!TIP]
>
> Each layer must work independently, and a degradation in the quality a layer owns must be detected by that layer's tests. A type error should not be caught first by a unit test, and an exception thrown by a function should not be caught only by an integration test. Type errors belong to the static layer and exceptions to the unit layer: each layer verifies the product code with a different approach, and together they support robust quality.
Each layer maps to a small, fixed set of tools:
| Layer | Mainly catches | Tools |
| - | - | - |
| Static | Type mismatches, undefined references, known defect patterns | TypeScript, ESLint |
| Unit | Wrong results from a function or module | Vitest |
| Integration (behavior) | A screen misbehaving on user interaction | Vitest + Testing Library |
| Integration (appearance) | Unintended visual changes | Storybook + visual regression testing |
| E2E | Broken wiring between frontend, backend, and database | Playwright |
Lower layers run in the pull request pipeline on every push; the E2E suite runs after deployment as the release check. See [CI/CD](/development/ci-cd) for the pipeline design and [E2E Testing](/frontend/e2e-testing) for why E2E runs post-deploy.
### Static tests
Static tests are the type check and the linter: verification that runs without executing the code. Once configured, they cover the entire codebase on every run at no extra cost per verification, which is why they form the base of the trophy.
The type check rules out invalid states instead of detecting them. A call that the type system rejects does not compile, so no runtime test needs to enumerate those values. Before writing a test for invalid input, check whether a type can make that input impossible.
```typescript TypeScript theme={null}
// ❌ A runtime test enumerates values the type system could reject
test("throws on an unknown status", () => {
expect(() => statusLabel("shipped!")).toThrow();
});
// ✅ A union type turns the invalid call into a compile error,
// and the runtime test becomes unnecessary
type OrderStatus = "pending" | "paid" | "shipped";
function statusLabel(status: OrderStatus): string {
// ...
}
// statusLabel("shipped!"); // compile error
```
The linter complements the type check with known defect patterns that types cannot express: a hook that reads a value missing from its dependency array, or markup that assistive technology cannot interpret. Both checks run in the editor and in the pull request pipeline, so this layer gives the fastest feedback of all.
The limit of this layer is behavior. A function can pass the type check and still return the wrong value; from here upward, the code has to run.
### Unit tests
Unit tests run a single function or module in isolation and verify its output for a given input. They suit pure logic with many input patterns, such as normalizing a date range or computing a total. The tool is Vitest.
```typescript Vitest theme={null}
import { normalizeDateRange } from "./normalizeDateRange";
// Verified through input and output alone: no rendering, no interaction
test("swaps the dates when the range is reversed", () => {
expect(
normalizeDateRange({ from: "2026-10-09", to: "2026-10-01" })
).toEqual({ from: "2026-10-01", to: "2026-10-09" });
});
```
The strength of this layer is speed and precision. A test runs one function, so a failure names the function and the input that went wrong. A custom hook's return value can also be verified here, but anything that involves rendering or interaction belongs to the integration layer.
This layer cannot verify composition. A function that is correct on its own does not guarantee that the screen behaves correctly once the function is wired into a component; that is the job of the integration layer.
### Integration tests
Integration tests combine components and hooks and verify them from a viewpoint close to the user's. The boundary with the backend is mocked, and the result of rendering and interaction is observed through the screen.
This layer holds two kinds of verification. Behavior tests render a component with Testing Library, simulate clicks and typing, and check how the screen changes; backend responses are replaced through a test provider or a mocking tool, so the test also covers how realistic data is displayed. Appearance tests render Storybook stories and detect unintended changes with [visual regression testing](/frontend/visual-regression-testing).
```tsx Vitest + Testing Library theme={null}
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { OrderSearchForm } from "./OrderSearchForm";
// Render the screen and observe how it responds to user interaction
test("shows an error and disables search for an invalid range", async () => {
const user = userEvent.setup();
render();
await user.type(screen.getByLabelText("From"), "2026-10-09");
await user.type(screen.getByLabelText("To"), "2026-10-01");
expect(screen.getByRole("alert")).toHaveTextContent("must be on or after");
expect(screen.getByRole("button", { name: "Search" })).toBeDisabled();
});
```
> [!NOTE]
>
> Unit and integration tests use the same test runner (Vitest), so in practice they are often written without distinction. This page separates them by whether rendering or interaction is involved.
This layer cannot verify the connection to the real backend. As long as the response is mocked, the test keeps passing even after the real API contract changes.
### E2E tests
E2E tests drive a real browser against a deployed environment and verify that a primary journey, from signing in to seeing results, completes through the whole system. The tool is Playwright.
```typescript Playwright theme={null}
import { test, expect } from "@playwright/test";
// The signed-in state is reused via storageState, not repeated through the UI
test("a signed-in user searches orders and sees results", async ({ page }) => {
await page.goto("/orders");
await page.getByLabel("From").fill("2026-10-01");
await page.getByLabel("To").fill("2026-10-09");
await page.getByRole("button", { name: "Search" }).click();
await expect(page.getByRole("table")).toContainText("Order #");
});
```
Only this layer verifies the wiring between frontend, backend, and database. In exchange, it runs slowly and a failure can originate anywhere along the journey, so the suite stays small and limited to primary journeys.
E2E runs after deployment as the release check. For how to design the suite and the Playwright patterns, see [E2E Testing](/frontend/e2e-testing).
## Comparison with the Test Pyramid
The Testing Trophy was proposed as an update to the Test Pyramid. Knowing how the two models differ explains why the trophy has its shape and where the criteria on this page come from.
The **Test Pyramid** is a layer model for automated tests popularized by Mike Cohn. It divides tests into three layers, unit, service, and UI (often called unit, integration, and UI), and calls for many tests at the bottom and few at the top.
The pyramid's reasoning rests on the nature of tests driven through the UI. Such tests are brittle under change, expensive to write, and slow to run, so the pyramid places most verification in unit tests and keeps UI-driven tests to a minimum. The inverted shape, where UI-driven tests make up most of the suite, is the anti-pattern it warns against, and the trophy inherits this part unchanged: tests that run the whole system stay few.
The trophy departs from the pyramid in two places.
First, a static layer is added at the base. The languages the pyramid was designed around came with compile-time type checking as a given; JavaScript did not, so adopting a type checker and a linter is a decision the team makes. The trophy makes that decision an explicit part of the testing strategy, and today TypeScript and ESLint fill the layer.
Second, the widest layer is integration, not unit. The trophy frames testing as a return on investment, where the investment is time and the return is confidence, and it puts the most tests where that return is highest.
A test gives more confidence the more it resembles how the software is used, and integration tests verify rendering and interaction together while still running quickly without a deployed environment, so this layer returns the most. The guideline "Write tests. Not too many. Mostly integration." summarizes this position.
| Aspect | Test Pyramid | Testing Trophy |
| - | - | - |
| Proposed by | Mike Cohn | Kent C. Dodds |
| Layers | Three: unit, service, UI | Four: static, unit, integration, E2E |
| Base layer | Unit | Static |
| Widest layer | Unit | Integration |
| What it optimizes | Fewer brittle, slow UI tests | The most confidence per unit of time |
| Tests that run the whole system | Kept few | Kept few |
The two models are not in conflict. Martin Fowler notes that the gap between teams who favor unit tests and teams who favor integration tests is largely a matter of how each defines a unit, and on this page, too, the line between unit and integration is only whether rendering or interaction is involved.
What matters more than the target shape is the operating rule: place each verification in the lowest layer that can catch its failure. Applying that rule to frontend code produces the trophy, and the next section turns the rule into concrete criteria.
## Choosing a layer
When adding a verification, walk the layers from the bottom and place it in the first one that can catch the failure. Ask four questions in order:
* If a type or lint rule can guarantee it, place it in the static layer.
* If it can be verified as the input and output of a single function, place it in the unit layer.
* If it can be observed through rendering or interaction with the backend mocked, place it in the integration layer.
* If none of these apply and it can only be verified with the whole system running, place it in the E2E layer.
Applying these criteria to one screen, an order search form, spreads its verifications across all four layers:
| Verification | Layer | Reason |
| - | - | - |
| The search parameter names match the API contract | Static | The API client's types reject a typo at compile time |
| A date range is normalized correctly | Unit | Pure input and output with many edge cases |
| An invalid range shows an error and disables the search button | Integration | Needs rendering and interaction, but not a real backend |
| A signed-in user searches and sees results | E2E | Breaks only when frontend, backend, and database run together |
When two layers could catch the same failure, choose the lower one. The lower test runs on every push instead of after deployment, and its failure names the cause instead of the symptom.
This rule is also what keeps the E2E suite small: anything a component test can catch stays out of E2E, and E2E keeps only the journeys that verify the whole system. See the principles in [E2E Testing](/frontend/e2e-testing).
> [!NOTE]
>
> Pushing a verification down does not remove the need for the layers above it. A component test with a mocked backend cannot detect a broken contract with the real API; each layer keeps the failures only it can see.
## Related pages
The following pages cover the integration and E2E layers and the shared principles of protective tests in depth.
> [card] [Component Testing](/frontend/component-testing)
>
> The integration layer in practice: principles and patterns for component tests that verify behavior, not internals.
> [card] [E2E Testing](/frontend/e2e-testing)
>
> Protecting primary user journeys with a small E2E suite, and stable patterns with Playwright.
> [card] [Test Code](/development/testing)
>
> The principles of protective tests: trustworthy passing and failing, and mocking only at boundaries.
> [card] [Visual Regression Testing](/frontend/visual-regression-testing)
>
> The appearance side of the integration layer: stories as the UI specification, and reviewing visual changes in the pull request.
# What is visual regression testing? Detecting visual changes
Source: https://lib.findy.co.jp/frontend/visual-regression-testing
Writing Storybook stories as the UI specification, choosing between the play function and component tests, and reviewing visual changes in the pull request.
## Overview
Visual regression testing (VRT) renders every Storybook story, captures a screenshot, and compares it with the last approved screenshot to detect unintended changes in appearance. In the Testing Trophy it belongs to the integration layer next to component tests: component tests verify behavior, and VRT verifies appearance. See [Testing Strategy](/frontend/testing-strategy) for the layer model as a whole.
Appearance here means what a component test cannot see. A component test queries the DOM, so when a button has lost its padding or a table overflows the viewport, the test still passes. Layout, spacing, color, typography, and how they hold up across screen widths are verified by comparing pixels.
This page covers how to write stories so that they serve as the UI specification, when to use Storybook's play function instead of a component test, and how to run VRT as part of the pull request. Behavior tests with Vitest and Testing Library are covered in [Component Testing](/frontend/component-testing).
## Stories are the UI specification
A **story** is a rendered instance of a component in one specific state: a fixed set of props and a fixed backend response. Collected together, the stories of a component enumerate every state it can show, and that is what makes them a specification rather than a demo.
Stories play three roles at once, and every role depends on the same set of stories being complete.
> [card] UI catalog
>
> Shows how each part and screen renders in the browser the product runs in, without starting the application or preparing data.
> [card] UI variation per state
>
> Identifies the display states one UI can take, such as loading, data patterns, and permissions, and lets you vary args in the Controls panel to see how the UI changes.
> [card] Specification and tests
>
> Verifies that the UI behaves and looks as intended, through VRT, interaction tests run by the Vitest addon, and accessibility checks by the a11y addon, all on the same stories.
A story that is missing a state is missing from all three roles: nobody sees the state in the catalog, nobody can tell it apart from the others, and no test covers it.
### Write one story per visible state
Each state a component can display gets its own named story. For a list that fetches data, that is at least the default state with data, the loading state, the empty state, and the error state. A single story whose state is changed through the Controls panel is not a test case, because nothing renders it in those states.
Define `args` as a typed variable rather than inline in the meta, and take the mock data from the same fixtures as the component tests. When both use the same data, the state the test verifies and the state the story shows are the same state, and a renamed prop fails the type check in the story file as well.
```tsx OrderList.stories.tsx theme={null}
import type { Meta, StoryObj } from "@storybook/react-vite";
import type { ComponentProps } from "react";
import { OrderList } from "./OrderList";
// Fixtures shared with the component tests
import { orders } from "./testing/orders";
type Component = typeof OrderList;
type Story = StoryObj;
// args as a typed variable, so a renamed prop fails the type check here
const args = {
orders,
isLoading: false,
error: null,
} satisfies ComponentProps;
const meta = { component: OrderList, args } satisfies Meta;
export default meta;
// ❌ One story that covers "everything" through the Controls panel
// (nothing ever renders the loading, empty, or error state)
export const Playground: Story = {};
// ✅ One story per visible state; each is a review item and a test case
export const Default: Story = {};
export const Loading: Story = { args: { isLoading: true } };
export const Empty: Story = { args: { orders: [] } };
export const LoadFailed: Story = {
args: { error: new Error("Orders could not be loaded") },
};
```
### Render in the context the component lives in
A component rendered alone on a blank canvas does not show how it looks in the product. A card that stretches to its parent's width fills the whole viewport, and a component that reads the router, the locale, or the theme from context does not render at all.
Decorators wrap every story in the surroundings it needs. Project-wide providers (router, internationalization, theme, the mocked API client) go in the preview file so that every story gets them, and width or layout constraints go on the component's meta. The story then renders under the same conditions as the screen it belongs to, and the snapshot shows what users see.
```tsx .storybook/preview.tsx theme={null}
import type { Preview } from "@storybook/react-vite";
import { AppProviders } from "../src/AppProviders";
const preview: Preview = {
decorators: [
// Every story renders inside the same providers as the application
(Story) => (
),
],
};
export default preview;
```
```tsx OrderCard.stories.tsx theme={null}
import type { Meta } from "@storybook/react-vite";
import { OrderCard } from "./OrderCard";
// ❌ Rendered alone, the card stretches to the full width of the canvas
const metaWithoutLayout = {
component: OrderCard,
} satisfies Meta;
// ✅ A decorator gives the card the width it has inside the order list
const meta = {
component: OrderCard,
decorators: [
(Story) => (
),
],
} satisfies Meta;
export default meta;
```
### Put stories at the top of the component tree
Stories go on the component that assembles a screen or a section, and on reusable parts that appear in several places. A child that only ever appears inside one parent is already covered by the parent's stories, and gets its own only when the parent's stories cannot show all of its states, for example a row with many status variants.
Rendering at the top shows the component in its real composition, which is where layout regressions appear. It also keeps the number of stories, and with it the cost of review and snapshots, proportional to the number of screens rather than the number of files. A story on a child shows the child's own states (boundary values, error text) and does not reproduce the parent's responsibilities.
### Mock the backend boundary the same way as in component tests
Stories mock the same boundary as component tests: the network. With the Mock Service Worker addon, the default handlers are registered in the preview file and a story overrides them in `beforeEach`, so a story can show an error response without changing the component. The test provider of a GraphQL client works the same way.
The loading state is produced by a response that never resolves. This keeps the story deterministic, because a response that resolves after a delay produces a different screenshot depending on when the capture happens.
```tsx .storybook/preview.tsx theme={null}
import type { Preview } from "@storybook/react-vite";
import { http, HttpResponse } from "msw";
import { mswLoader } from "msw-storybook-addon/csf3";
import { orders } from "../src/orders/testing/orders";
// The decorators from the previous example are omitted here
const preview: Preview = {
loaders: [mswLoader()],
// The default response, shared by every story
beforeEach({ msw }) {
msw.use(http.get("/api/orders", () => HttpResponse.json(orders)));
},
};
export default preview;
```
```tsx OrderSearch.stories.tsx theme={null}
import type { Meta, StoryObj } from "@storybook/react-vite";
import { delay, http, HttpResponse } from "msw";
import { OrderSearch } from "./OrderSearch";
const meta = { component: OrderSearch } satisfies Meta;
export default meta;
type Story = StoryObj;
// Uses the default handlers registered in .storybook/preview.tsx
export const Default: Story = {};
// ✅ Overrides the response for this story only
export const LoadFailed: Story = {
beforeEach({ msw }) {
msw.use(
http.get("/api/orders", () =>
HttpResponse.json({ message: "unavailable" }, { status: 500 })
)
);
},
};
// ✅ A response that never resolves keeps the loading state on screen
export const Loading: Story = {
beforeEach({ msw }) {
msw.use(
http.get("/api/orders", async () => {
await delay("infinite");
})
);
},
};
```
## Interaction tests with the play function
A story shows a state that can be reached through props and backend responses. Some states can only be reached through interaction: a menu that is open, a form after a failed submit, a list after a filter has been applied. The **play function** fills this gap.
### Reach a state through interaction, then capture it
`play` runs after the story renders, in a real browser, and receives the rendered canvas and a `userEvent` instance in its context. Queries on `canvas` are the same Testing Library queries as in component tests, `expect` and `fn` come from `storybook/test`, and `step` groups interactions under a label in the Interactions panel. Interactions are asynchronous and are awaited.
An interaction test has two outputs: the assertions inside `play`, and the screen after `play` has finished. The second one is what VRT captures, so a state reached through interaction becomes a snapshot like any other story.
```tsx OrderSearch.stories.tsx theme={null}
import type { Meta, StoryObj } from "@storybook/react-vite";
import { expect, fn } from "storybook/test";
import { OrderSearch } from "./OrderSearch";
const meta = {
component: OrderSearch,
// A spy as the callback, so play can assert that it was called
args: { onSearch: fn() },
} satisfies Meta;
export default meta;
type Story = StoryObj;
// ✅ Reaches the filtered state through interaction; the snapshot
// captures the screen in that state
export const FilteredByPaid: Story = {
play: async ({ canvas, userEvent, args, step }) => {
await step("Filter by status", async () => {
await userEvent.selectOptions(canvas.getByLabelText("Status"), "paid");
await userEvent.click(canvas.getByRole("button", { name: "Search" }));
});
await expect(args.onSearch).toHaveBeenCalledWith({ status: "paid" });
await expect(
await canvas.findByRole("row", { name: /1001/ })
).toBeVisible();
},
};
```
### Use play for states and component tests for behavior
Storybook's documentation notes that interaction tests can be expensive to maintain when applied to every component. On this site an interaction test exists to put the screen into a state worth looking at, and a component test exists to verify behavior branches. Writing the same assertions in both places doubles the maintenance cost without adding confidence.
> [card] Interaction test (play function)
>
> Runs in a real browser, reaches a state through interaction, and leaves the screen there for the snapshot. One per state worth seeing: an open dialog, a filled form, a filtered list.
> [card] Component test (Vitest + Testing Library)
>
> Verifies behavior branches through the DOM, fast and without a browser. One per branch: each validation rule, each status, each error.
The Vitest addon for Storybook runs every story, including its play function, as a Vitest test in a real browser, so interaction tests run in the pull request pipeline on the same runner as the component tests.
> [!NOTE]
>
> Storybook's documentation describes its testing experience as built around component tests, and the Storybook UI labels the run of play functions as "Run component tests". On this site, component test refers to the Vitest and Testing Library tests described in [Component Testing](/frontend/component-testing), and a test written in a story's play function is called an interaction test.
## How VRT works and runs
### How a story becomes a snapshot test
A VRT service builds Storybook, renders every story in a cloud browser, and captures a screenshot. The screenshot is compared pixel by pixel with the **baseline**, the last screenshot of that story that a reviewer accepted, and a story whose pixels differ beyond a threshold is reported as changed.
Comparing pixels rather than the rendered HTML is what makes this a test of appearance. A snapshot of the DOM changes whenever the markup changes, even when nothing visible moved, and stays the same when a stylesheet breaks the layout. The pixel comparison catches the second case and ignores the first.
The examples below use Chromatic. Other tools, such as a self-hosted pipeline that captures stories and compares the images, or the screenshot assertions of a browser automation tool, follow the same model of snapshot, baseline, and review.
### Chromatic
Chromatic is a visual testing service built by the Storybook maintainers. Each time it runs in CI, it builds the Storybook, publishes it at a shareable URL, renders every story in cloud browsers, and compares the snapshots with their baselines. It also works with Playwright and Cypress tests, but the Storybook integration is its primary use.
> [card] Storybook publishing
>
> Every build publishes the Storybook at a shareable URL, so designers and product managers review components without a local environment.
> [card] UI Tests
>
> Compares each story's snapshot with its baseline and reports the changed stories as a status check on the pull request.
> [card] UI Review
>
> Shows the visual changes between the pull request branch and its base branch, independent of baselines, so designers and reviewers can sign off on them.
> [card] TurboSnap
>
> Uses the git history and the bundler's dependency graph to snapshot only the stories affected by the change.
The Visual Tests addon runs the same tests from the Storybook UI, so a developer can review and accept changes locally before pushing, and the accepted baselines carry over to the build in CI.
### Review visual changes in the pull request
The result of a VRT run is not pass or fail but a list of changed stories, and a person decides what each change is. The service reports the changes as a status check on the pull request, and the check does not pass until every change has been reviewed.
Accepting a change makes the new screenshot the baseline for that story. Denying it marks a regression and fails the check, so the author fixes the component and pushes again. Accepted baselines follow the branch: after the pull request merges, the default branch inherits them, so a change is reviewed once rather than on every branch.
Who reviews depends on the change. The author accepts changes they intended and can explain. A change the author did not expect is a regression or a side effect of a shared component, and goes back to the code. A change to the design itself is reviewed by the designer in the published Storybook, which is the same artifact the snapshots came from.
The service finds the baseline by walking the git history to the nearest ancestor commit that has a build, so the pipeline runs on every push, including pushes to the default branch, and checks out the full history. Snapshotting only the stories whose dependency graph changed keeps the cost of each build proportional to the change.
```yaml .github/workflows/visual-regression.yml theme={null}
on:
# Every push, including the default branch, so that baselines exist
# for the branch a pull request is compared against
push:
jobs:
visual-regression:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Full history, so the service can find the baseline build
fetch-depth: 0
- run: npm ci
- run: npm run build-storybook
- uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: storybook-static
# Snapshot only the stories affected by the changed files
onlyChanged: true
```
### Keep snapshots deterministic
A snapshot that differs between two runs of the same code is a false positive, and false positives are what make a team stop reading the list of changes. Every source of variation is removed on the story side.
* **Dates and times.** Pin the current date the component depends on, through a prop or a mocked clock, so that "today" is the same date on every run.
* **Random data.** Fixtures are fixed values, never generated at render time.
* **Animations.** Chromatic pauses CSS animations at their last frame by default. Animations driven by JavaScript are disabled when the story runs under the service.
* **Asynchronous content.** Wait for it in `play` with `findBy` or `waitFor` instead of a fixed delay, so the capture happens when the content is there.
* **Fonts.** Serve web fonts from the project so that the browser does not fall back to a different typeface on one run.
Stories that exist only to run an interaction, or that show content that cannot be made stable, are excluded from snapshots. Sub-pixel rendering noise is absorbed by raising the diff threshold slightly, not by excluding the story.
```tsx OrderCalendar.stories.tsx theme={null}
import type { Meta, StoryObj } from "@storybook/react-vite";
import { OrderCalendar } from "./OrderCalendar";
const meta = {
component: OrderCalendar,
parameters: {
// The default threshold is .063; raise it only to absorb
// sub-pixel rendering noise, never to hide a layout change
chromatic: { diffThreshold: 0.1 },
},
} satisfies Meta;
export default meta;
type Story = StoryObj;
// ❌ "Today" moves every day, so the snapshot changes every day
export const Unpinned: Story = {};
// ✅ Pins the date the component depends on
export const Today: Story = {
args: { today: new Date("2026-04-01") },
};
// ✅ Excludes a story that exists only to run an interaction
export const KeyboardNavigation: Story = {
parameters: { chromatic: { disableSnapshot: true } },
play: async ({ canvas, userEvent }) => {
await userEvent.click(canvas.getByRole("gridcell", { name: "15" }));
await userEvent.keyboard("{ArrowRight}");
},
};
```
### What VRT is for
> [card] Suited
>
> Layout, spacing, color, and typography. Breakpoints and themes rendered as viewport and theme variants. Shared components whose change ripples into many screens. Design review by people without a local environment.
> [card] Not suited
>
> Behavior branches and data correctness, which component tests verify through the DOM. Wiring to the real backend, which E2E tests verify. Content that cannot be made deterministic. Screens with so many states that the snapshot count outgrows what reviewers read.
The cost of VRT scales with the number of stories times the number of variants, and is paid on every build in snapshots and in review time. The story conventions above keep the count proportional to the number of screens, and change-based snapshot selection keeps the cost of each build proportional to the change.
> [!NOTE]
>
> The capture tool behind VRT has to keep up with Storybook's releases, and when its maintenance stops, Storybook itself can no longer be upgraded. Prefer a tool maintained alongside Storybook, or one built on the same browser automation as the rest of the test suite.
## Related pages
The following pages cover where VRT sits in the layer model, the behavior tests it pairs with, and the review it becomes part of.
> [card] [Testing Strategy](/frontend/testing-strategy)
>
> The criteria for choosing a layer, and why appearance and behavior share the integration layer.
> [card] [Component Testing](/frontend/component-testing)
>
> The behavior side of the integration layer: verifying what users can do, with Vitest and Testing Library.
> [card] [Code Review](/development/code-review)
>
> How a pull request is reviewed, and where the review of visual changes fits in.
# Findy Library
Source: https://lib.findy.co.jp/index
A documentation site where Findy, Inc. shares its knowledge on a wide range of topics.
Findy Library is a documentation site where Findy, Inc. openly shares its
knowledge on a wide range of topics. We publish this knowledge in the hope of
raising the bar for the industry as a whole, and of helping anyone who is
stuck on the same problems we have faced. Content is added and updated on an
ongoing basis.
## Find what you need
> [card] [Pull Requests](/development/pull-request)
>
> How to write pull requests that are easy to review
> [card] [Vibe Coding](/ai/vibe-coding)
>
> Building software in dialogue with an AI coding agent
> [card] [Agentic Workflow](/ai/agentic-workflow)
>
> Delegating planning, implementation, and verification to AI agents
> [card] [Task Breakdown](/development/task-breakdown)
>
> How to break work into small, independent units
> [card] [Test Code](/development/testing)
>
> How to write tests that protect the system
> [card] [Skills](/ai/skill)
>
> Packaging workflows so any agent can reproduce them
## Choose how to read
Findy Library serves the same content in two forms from a single source. Pick
how you want to read it.
> [tab] Read in your browser
>
> Pick a category from the navigation tabs and read on. Every page offers a
> language switcher (English / 日本語). [Pull Requests](/development/pull-request)
> is a good place to start.
> [tab] Read as an AI agent
>
> Every page is also delivered as plain Markdown for AI agents. See the
> Quickstart for how to access it.
>
> [Continue to the Quickstart →](/quickstart)
> [!NOTE]
>
> New topics are added over time. Check back regularly, or point your AI agent
> at the [Quickstart](/quickstart) to keep up with the latest content.
Please review the [Terms of Service](/terms-of-service) before using this site.
# How to choose a development approach for your mobile app
Source: https://lib.findy.co.jp/mobile/technology-selection
Frames the mobile technology choice as a question of what you share: three categories by scope, four axes for choosing, and worked examples of the decision.
## Overview
Choosing a development approach means deciding which technology to build an iOS and Android app on. It has to be decided at the very start of product development, and it shapes the development structure, hiring, and maintenance cost that follow.
This decision is often treated as a side-by-side comparison of options such as Pure Native, [Flutter](https://flutter.dev), [React Native](https://reactnative.dev), and [Kotlin Multiplatform](https://kotlinlang.org/multiplatform/). But something has to be settled before any comparison is meaningful: what you intend to share.
Once the scope of sharing is fixed, the decision moves down a level. Choosing the scope is a comparison between three categories; once it is fixed, the comparison is between the technologies within that category. If you decide to share the UI implementation, for instance, the next question becomes whether to use Flutter or React Native. Comparing individual technologies without fixing that scope places options with different premises on the same footing.
This page explains three categories defined by the scope of sharing, four axes for choosing among them, and the criteria that divide the candidates within each category. It closes with worked examples that walk the decision from the situation of an organization and its product. It does not recommend a particular approach.
> [!NOTE]
>
> This area changes quickly. The descriptions on this page reflect the official direction of each technology as of July 2026.
## What to share
Development approaches fall into three categories according to what they share.
| Category | What is shared | Representative approaches |
| - | - | - |
| Share nothing | — | Pure Native (Swift / Kotlin) |
| Share logic only | Business logic | Kotlin Multiplatform, [Swift on Android](https://www.swift.org/documentation/articles/swift-sdk-for-android-getting-started.html) |
| Share the UI implementation | Business logic and UI implementation code | Flutter, React Native, [Compose Multiplatform](https://kotlinlang.org/compose-multiplatform/), [Skip](https://skip.dev) |
What the "share the UI implementation" category shares is the code that builds the UI. It does not mean the screens look identical on both platforms. Some approaches assemble each OS's native UI from a single codebase, and how far the appearance is aligned divides the candidates within the category.
In any of the three categories, moreover, you will write some platform-specific code. A category describes the scope of sharing, not a claim that sharing reaches 100%.
Note that the category attaches not to the name of a technology but to **what you choose to do with it**. Kotlin Multiplatform, for example, falls under "share logic only" when it keeps native UI, and under "share the UI implementation" when combined with JetBrains' Compose Multiplatform.
Which category to choose follows from two things: whether the category is available to you at all, and what you take on once you have chosen it.
## Choosing a category
Before the axes, check whether any condition narrows the candidates. One example is a product that depends on a vendor SDK offered for native only — payment terminals or contactless card reading — where the vendor's own support is part of the requirement. An approach that meets such a condition drops out of the candidates regardless of its technical merits.
With that settled, four axes drive this decision. The last two are what you take on after choosing. They are not discoveries made afterward, so you check them before you decide.
> [card] UI and design effort
>
> **A constraint on what you can choose.** Choosing not to share the UI presupposes enough people to maintain two lines of screen implementation and design.
> [card] Team skills and mobility
>
> **A constraint on what you can choose.** Once the scope of sharing is fixed, the required language is largely fixed too. Where it does not match existing strengths, that gap shows in development speed.
> [card] Keeping up with OS changes
>
> **Something you take on after choosing.** The more layers you depend on, the longer the wait before OS-side changes reach you.
> [card] Layer count and investigation
>
> **Something you take on after choosing.** With a layer in between, you add a step to determine whether a problem originates in your application code or in that layer.
### UI and design effort
Choosing not to share the UI presupposes enough people to maintain two lines of screen implementation and design. Where that premise does not hold, Pure Native drops out of the candidates regardless of its technical merits.
What matters here is that **whether UI implementation and design effort doubles is determined solely by whether you share the UI, independently of whether you share the logic**. Sharing business logic with Kotlin Multiplatform, for example, still leaves you implementing screens separately for iOS and Android. The UI implementation effort is the same as Pure Native, and so is the effort of producing two sets of designs. What is removed is the duplication of whatever you put in the shared layer. How far that layer reaches is a design decision: some setups go beyond business logic and pull in the state that drives the screens. Either way the screens themselves are implemented per platform, so UI implementation and design effort is unchanged.
That effort includes absorbing the differences between platform UI conventions through design. For example, iOS is said to hold a high share of usage in Japan, and it is common to adopt Pure Native and then bring the Android side closer to the iOS appearance. In that case the team pays the cost of maintaining two lines while the result moves toward a unified UI.
### Team skills and mobility
Once the scope of sharing is fixed, the required language and framework are largely fixed along with it. Pure Native requires expertise in each platform, while approaches that share the UI implementation center on fluency in a single language and framework. An approach that matches existing strengths keeps learning and hiring costs down, while one that does not shows that gap in development speed.
What matters here is not only the size of the hiring market. Mobility within the organization is also a factor: whether existing web frontend developers can contribute to mobile development. For a team that already works in TypeScript and React, React Native is an option that avoids adding a new language ecosystem.
That mobility is not unconditional, however. Fluency in TypeScript and React, for example, does not remove the need for platform-specific knowledge such as store submission, certificates and signing, push notifications, and background processing. Sharing removes duplicated implementation, not platform knowledge itself.
What these first two axes determine is not which approach is better but which approaches are feasible.
### Keeping up with OS changes
The more dependency layers you add (frameworks such as Flutter or React Native that carry the sharing), the more waiting is introduced before OS-side changes reach you. This waiting comes in two kinds, and they behave differently.
The first is **deadline-bound catch-up**. Mandatory updates for new OS versions, changes to review requirements, and privacy-related requirements have deadlines set externally. When you have to wait for the dependency layer to respond, the room you have to act on your own shrinks. This is not a question of which features are available, but a risk to your ability to keep shipping.
The second is **catch-up with a new design**. When an OS introduces a new design, whether the dependency layer follows it depends on its design policy. The app keeps working if it does not follow, but the experience gradually drifts away from the OS standard.
Pure Native has no such waiting by construction. This property is why Pure Native is chosen for products that face frequent deadline-bound work, or that place OS features at the center of the product.
When you do choose to share, this waiting cannot be eliminated, but it can sometimes be worked around case by case by writing platform-specific code. What matters for the decision, therefore, is not whether waiting occurs but **how often you will need to write those workarounds**. That frequency follows from how much the product depends on OS capabilities.
### Dependency layers and troubleshooting
More dependency layers mean more steps to isolate a problem. Pure Native lets you investigate directly with each platform's official tooling, whereas a dependency layer adds a step of determining whether a problem originates in your application code or in that layer.
This difference is hard to see in day-to-day development and surfaces during incident investigation and performance work. Investigation takes longer when a problem reproduces on only one platform, or when you have to check whether it matches a known issue in the dependency layer.
### Judging your category from conditions
Applied to a decision, the four axes map to conditions as follows. These are typical examples rather than an exhaustive set.
| Condition | Category it points toward |
| - | - |
| OS features are central to the product, so workarounds will be needed often | Share nothing |
| Fidelity to the platform-standard experience is a requirement, and you want to reduce duplicated logic | Share logic only |
| A unified brand appearance is a requirement. Reducing UI implementation effort takes priority | Share the UI implementation |
It is not unusual for several conditions to point to different categories. When they do, look first for a condition that acts as a cutoff. Where the product depends on new OS features beyond what workarounds can absorb, approaches carrying a dependency layer do not stay in the running at all. If more than one candidate is still standing after that, give priority to the condition that is most expensive to change later. Because a decision about sharing the UI translates directly into volume of implementation, changing it midway carries a larger cost than the others.
## The options
Once the category is fixed, the next step is choosing an approach within it. If you chose to share nothing, the approach is settled as Swift and Kotlin, so what this section covers is the two remaining categories.
### Share the UI implementation
This category contains several approaches. Here we take Flutter and React Native, the pair most often compared, as the example. What separates them is not a technical performance comparison but **whether unifying the UI design is a policy of the framework itself**. Flutter draws its own controls and states unification across operating systems as a design policy. React Native treats each OS standard as the source of truth, and where unification is needed, you reach it by choosing a UI library that carries it.
| Aspect | Flutter | React Native |
| - | - | - |
| Unified UI design | A policy of the framework | Achieved with a UI library |
| How the UI is drawn | Draws its own controls | Backed by native views |
| When the OS changes its design | Look and feel stay the same | Arrives as a native UI update |
| A unified appearance on both platforms | Guaranteed by the policy | Available once you pick a UI library |
Flutter does not use the UI components supplied by the OS; it draws every UI control itself. The [official architectural overview](https://docs.flutter.dev/resources/architectural-overview) cites decoupling from OS dependencies as a benefit of this approach, explaining that the application looks and feels the same even if the OS changes the implementation of its controls. Independence from the OS is positioned as a design goal, not a side effect.
This policy is visible in how the project is run. As of July 2026, Flutter has deferred both [support for the new iOS design](https://github.com/flutter/flutter/issues/170310) and [support for Android's Material 3 Expressive](https://github.com/flutter/flutter/issues/168813). This is stated officially as a deliberate pause to reconsider the architecture rather than a delay.
The important detail is that it applies to both platforms, not just one. Flutter explains the pause as a way to reconsider the architecture for integrating design systems itself, not as a matter of favoring one OS over another.
React Native takes the opposite position, treating each platform's native UI as the source of truth. The [official documentation](https://reactnative.dev/docs/intro-react-native-components) explains that because React Native components are backed by the same views as Android and iOS, the apps look, feel, and perform like any other apps. When an OS changes its design guidance, that change arrives through updates to the native UI, so catch-up is comparatively fast. In exchange, producing a unified appearance across both platforms means absorbing the platform differences yourself.
Treating each OS standard as the source of truth is a policy of the framework, not a limit on what you can build. Open source UI libraries for aligning the appearance across iOS and Android are readily available, and unifying a React Native design with one of them is common practice. In that case the responsibility for holding the design together moves from the framework to your choice and upkeep of the library.
If you choose React Native, the officially recommended setup is React Native together with Expo. The [React Native documentation](https://reactnative.dev/docs/environment-setup) recommends using a framework and names Expo, and the official blog positions it as the only recommended community framework for new apps. Building without a framework continues to be supported, but it is not the default choice.
### Share logic only
Once you have decided to share logic only, Kotlin Multiplatform and Swift on Android are the candidates. Technically the two mirror each other, but for an organization they are asymmetric.
| Aspect | Kotlin Multiplatform | Swift on Android |
| - | - | - |
| Shared language | Kotlin | Swift |
| Language ecosystem at the center | Android | iOS |
| Maturity | Stable in 2023, Google announced support in 2024 | First official SDK in March 2026 |
| Published production cases | Several large-scale services | Limited |
Kotlin Multiplatform uses Kotlin as the shared language, placing the Android language ecosystem at the center. Swift on Android uses Swift, placing the iOS ecosystem at the center. It is a choice of **which language ecosystem sits at the center of the organization**, and the better answer flips between a team strong in iOS and a team strong in Android.
Their maturity differs. Kotlin Multiplatform was introduced as an experimental feature in 2017, became [stable](https://blog.jetbrains.com/kotlin/2023/11/kotlin-multiplatform-stable/) in 2023, and in 2024 [Google announced support for it on Android](https://android-developers.googleblog.com/2024/05/android-support-for-kotlin-multiplatform-to-share-business-logic-across-mobile-web-server-desktop.html). In that announcement Google stated that its support focuses on sharing business logic, the part most agnostic to user interfaces. Adoption by several large-scale services has also been published.
Swift on Android, by contrast, reached [preview](https://www.swift.org/blog/nightly-swift-sdk-for-android/) in 2025 and its [first official SDK](https://www.swift.org/blog/swift-6.3-released/) was released in March 2026. The [official documentation](https://www.swift.org/documentation/articles/swift-sdk-for-android-getting-started.html) describes embedding Swift code as shared libraries with the UI implemented in Java or Kotlin, which places it explicitly in logic sharing. Its history is short and published production cases are limited. Adopting it means proceeding without prior cases to draw on.
### Category boundaries move
Both of the language ecosystems that share logic only have movements toward sharing the UI. The Kotlin ecosystem has Compose Multiplatform and the Swift ecosystem has Skip, both of which extend sharing to the UI. A setup that adopts either falls under "share the UI implementation".
## Walking through the decision
This section brings the page together as a single decision flow. The four axes supply the answer at the category branches, and the criteria that separate candidates within a category supply the rest.
```mermaid theme={null}
flowchart TD
Q1{"Share the UI implementation?"}
Q1 -->|Yes| C3["Share the UI implementation"]
Q1 -->|No| Q2{"Share the logic?"}
Q2 -->|Yes| C2["Share logic only"]
Q2 -->|No| C1["Share nothing"]
C1 --> T1["Pure Native"]
C2 --> Q3{"Which language at the center?"}
Q3 -->|Kotlin| T2["Kotlin Multiplatform"]
Q3 -->|Swift| T3["Swift on Android"]
C3 --> Q4{"How is the UI drawn?"}
Q4 -->|Draw it yourself| T4["Flutter"]
Q4 -->|Build on native views| T5["React Native"]
```
The three cases below settle on a category and an approach from the situation of an organization and its product. They are typical examples, and the same situation can end elsewhere when another condition takes priority.
### Able to staff each OS, with OS features at the center
Pure Native fits this case.
At a size that can staff each OS, the organization can pay for two lines of implementation and design. Once that is settled, the weight of the decision moves to how the app keeps up with OS changes. The more central the new OS features are, the more a structure that waits on a dependency layer costs, so the choice goes to a setup that has no waiting time to begin with.
### An existing TypeScript and React team, no dedicated mobile team
React Native fits this case.
With no one dedicated to each OS, the implementation has to stay in one line. What matters from there is how readily the existing web frontend people can take part. With a team that works in TypeScript and React, mobile development can start without adding a new language to the organization. And on the premise that design is left to each OS standard, there is no work to design a unified appearance yourself.
It is also a choice that takes on leaving the source of truth for design with each OS. Add a unified appearance to the requirements, and choosing and maintaining a UI library to carry it becomes part of the work.
### OS features central, and a unified appearance you cannot move
Flutter fits this case.
A unified appearance points toward sharing the UI implementation and dependence on OS features toward sharing nothing, so the two conditions point to different categories. What gets fixed first is whichever is more expensive to reverse later. The decision about sharing the UI ties directly to the volume of implementation, so it is settled first.
What remains is whether to take Flutter or React Native. What separates them here is **who keeps the unified appearance in place over time**. React Native builds on native views, so when the OS changes its design, that change reaches the app. That is an advantage when the goal is to stay close to each standard, but it works the other way when unification is the requirement: every OS update brings work to absorb the difference on the UI library side. Flutter draws its own controls and is independent of the OS, so its appearance does not change when the OS does. The less a unified appearance can be moved as a requirement, the more this difference weighs.
Keeping up with OS features is then taken on as the frequency of writing workarounds. Flutter holds as the conclusion only while that frequency stays within what was assumed. Beyond it, the premise of sharing the UI falls apart. The landing point is then Pure Native, and the unified appearance is approached by paying for two lines and bringing them together through design.
## Related pages
> [card] [Choosing a Database](/backend/database-selection)
>
> The same shape of decision on the data side — settle the premise first,
> then compare products.
> [card] [Modifiability](/development/modifiability)
>
> Why the price of a structural choice arrives later, as how cheaply the code
> can still be changed.
> [card] [Task Breakdown](/development/task-breakdown)
>
> Once the approach is fixed, split the build into units that merge and
> revert on their own.
# How to develop engineers: goals, feedback, staged learning
Source: https://lib.findy.co.jp/organization/engineer-growth
How a team develops junior engineers through shared goals, frequent feedback, and staged learning, plus team study sessions and the mentor's role when AI agents write code.
## Overview
Developing junior engineers is the work of raising the level of what
early-career engineers can do without support. Junior engineers have not yet
built up the fundamentals and the volume of experience that let them judge
their own code, so the team has to shape what they learn and in what order.
Junior engineers are not limited to new members, and developing them is a
separate concern from onboarding: a new member's adjustment to the team is
covered in [Onboarding](/organization/onboarding).
This page covers development from the team's side, not the learner's. It
describes how to run development through goals, feedback, and staged
learning, how a team learns together, and what the mentor still has to
provide when AI agents are part of daily work.
## How to develop engineers
### Set goals together
Agree on the target before starting. The manager and the member should
share three things: the level the member is aiming for, what
the organization expects of that level, and the period in which to reach it.
Describe the target level in observable terms. "Can implement a specified
feature, including tests, without support" can be checked; "understands the
frontend well" cannot. A skill map that lists the knowledge expected for each
role and level makes these descriptions consistent across the team.
### Share the current state as facts
State the gap between the current level and the target level concretely,
based on actual changes and reviews. A vague assessment leaves the member
unable to tell what to change.
Pair that statement with two others: that the gap itself is not a problem,
and that closing it is a shared task. Giving direct feedback well is a skill,
and the people giving it benefit from practicing it.
### Give feedback in one-on-ones
A one-on-one is a regular conversation between the member and a mentor or
manager. It is not a status report but time for the member: they bring the
topics, such as looking back on recent work, problems they are stuck on, and
their career, and the other person focuses on drawing those out.
For a junior engineer, hold one-on-ones frequently at first and reduce the
frequency as the member grows. Early on, meet often enough that small
questions and blockers are resolved the same day; as the range of work the
member can handle alone widens, space the meetings out.
Use one-on-ones for reflection and feedback, not for planning tasks. Discuss
and coordinate tasks in a separate meeting with the people involved.
In the one-on-one, review a recent pull request together as a retrospective,
looking at what went well, what could be improved, and the reasoning behind
the review comments.
Make feedback and instructions concrete. "Handle this task by changing this,
then this" gives the member something to act on; encouragement or general
advice alone does not. Pair programming is also an effective way to show how
the work is done.
### Learn in stages
Rather than cramming many things in at once, split what the member needs to
learn into the following three perspectives, and have them master each one
separately.
| Stage | What the member works on | Sign that it is in place |
| - | - | - |
| Fundamentals | The knowledge listed in the skill map for the role | Can explain the basics the code relies on |
| Volume | Many small pull requests at the right granularity | Receives feedback daily and applies it |
| Quality and understanding | Writing correct code and understanding why it is correct | Review comments are about design and behavior, not about avoidable mistakes |
Volume comes before quality because each pull request is a feedback
opportunity. Making a small change every day and getting a little
feedback each time builds skill faster than spending a week on one large
change and receiving many comments at once.
Fundamentals matter more, not less, now that AI agents write code. Without
that foundation, it is hard to judge whether the code or explanation an AI
produces is correct, and errors get accepted unnoticed.
### Separate avoidable mistakes from worthwhile difficulty
Mistakes that [self-review](/development/code-review) can catch — typos,
lint errors, leftover debug code — do not depend on skill or experience, so
expect them to disappear early. Difficult and important topics such as
testing, type design, and asynchronous processing are where struggling is
expected.
The question is whether the member is struggling in the right places. More
difficulty on hard topics is a sign of progress. Repeating the same mistake
is the signal to address.
### Prioritize the correct method over speed
Ask the member to follow the correct procedure every time. Before changing
existing code, check that [tests](/development/testing) cover it, and add
tests first if they do not. When researching, read official documentation
and other primary sources.
Speed is not a target in the early period. A correct procedure repeated many
times becomes fast; a fast but incorrect procedure has to be unlearned.
Ask for progress, not results. A member who submits small pull requests
every day and finishes a large task over several weeks is on track. A member
who spends days thinking without submitting anything is not, because no
feedback can reach them.
### Protect time for focus
Early in a member's growth, keep the member's attention on the assigned tasks.
Inquiry handling, incident investigation, and cross-team coordination belong
to more experienced members until the member can deliver without support.
When there is nothing to do, look for work together: reading code side by
side almost always turns up a small refactoring or a missing test.
Reading and writing code comes before output for an audience. Writing
articles and speaking at events are worthwhile, but they should not take time
away from the input that growth depends on.
## Learning as a team
### Short study sessions
A study session is a recurring time in which members present what they have
learned to each other. Keeping each session short makes it sustainable
alongside regular work. A common format is a five-minute presentation
followed by five minutes of questions, held within the team.
Lower the cost of presenting so that sessions continue:
* Do not require slides. A shared screen or a written note is enough.
* Allow a presenter to skip by announcing it before the session.
* Set a theme, such as using AI in development, but allow other topics.
Beyond knowledge transfer, presentations show what each member is working
on and interested in, which helps the team understand each other. Short
sessions are not suited to systematic learning or deep dives; use them
alongside other forms of study.
> [!NOTE]
>
> At Findy, some teams hold short study sessions within the team to catch
> up on generative AI together, with every member presenting in turn.
### Keep the development material editable
Store the onboarding documents, the skill map, and the development guidelines
where every member can propose changes, such as a Git repository. Material
that only its author can update falls behind the team's actual practice.
## The mentor's role with AI
### What still needs people
AI cannot supply what is not written down. Write down the history behind an
architecture and the domain knowledge so that both people and AI agents can
refer to them, as described in [Onboarding](/organization/onboarding). Even
then, judgment about trade-offs and the team's values about how to develop
are learned mostly by working alongside people. When a specification is ambiguous, an AI agent
can proceed on an assumption instead of raising the question, and the
mismatch surfaces later as rework.
The mentor's role shifts from teaching how to write code to creating
opportunities to understand the product and its users: explaining the domain
with diagrams, reading specifications together, and inviting the member to
design discussions and user meetings.
### Build the ability to judge AI output
Using AI is not a problem in itself. The ability to tell whether its output
is correct is what mentoring has to build. A member who cannot yet write
code and tests unaided, or recognize an incorrect answer, cannot verify what
an AI agent produces.
That ability rests on fundamentals. With a grounding in data structures and
algorithms, networking and HTTP, databases, security, and operating systems,
a member can tell where an AI's output is likely to be wrong and check it
against official documentation and other primary sources. Without it, a
plausible mistake goes straight into production.
> [!NOTE]
>
> At Findy, engineers are encouraged to obtain certifications such as the
> Fundamental Information Technology Engineer Examination as a way to build
> their fundamentals.
One approach is to stage AI use:
1. Let the member use AI freely at first, and review the quality of the
resulting pull requests together.
2. If the quality shows gaps, ask the member to solve problems they cannot
yet solve alone without AI, and explain why.
3. Lift the restriction step by step, starting with research and with
changes the member has already made correctly elsewhere.
Once restrictions are lifted, keep one rule: review every pull request an AI
agent creates before merging it. Guiding AI output to correct code through
review is a skill in its own right.
> [!WARNING]
>
> Restricting AI use only works when the reason is explained and the
> restriction is temporary. Without agreement on why, the member experiences
> it as a penalty rather than as part of their growth.
## Related pages
> [card] [Onboarding](/organization/onboarding)
>
> How to support a new member, junior or experienced, until they can work
> autonomously in the organization.
> [card] [Code Review](/development/code-review)
>
> The self-review and review comments that the daily feedback loop runs on.
> [card] [Tech Blog](/organization/tech-blog)
>
> Read this when, with a foundation of input in place, you share what you
> learned as an article outside the company.
# How to onboard new engineers so they can work autonomously
Source: https://lib.findy.co.jp/organization/onboarding
How a team supports new engineers until they work autonomously: setting goals, sharing a checklist, preparing before day one, supporting the first month, and onboarding with AI agents.
## Overview
Onboarding is the support a team gives a new member until they can work
autonomously within the organization. It covers the period from before the
first day until the member moves their own work forward without
step-by-step instruction.
This page covers onboarding from the team's side, not the learner's. It first
defines what onboarding aims for and how to manage it, then describes the
preparation before the first day, how to support the first day, week, and
month, and how AI agents change the work. Developing junior engineers is
covered separately in [Engineer Growth](/organization/engineer-growth).
## What onboarding aims for
The goal of onboarding is a member who can work autonomously within the
organization. Such a member knows how the team develops and makes decisions,
where information lives, and whom to ask, and uses that knowledge to move
their own work forward. Onboarding is the support that helps the member
reach this state; finishing the reading material does not complete it.
Working autonomously does not mean working without help. An autonomous
member asks for help at the right time, raises problems early, and fixes the
outdated documents they find. What onboarding removes is the dependence on
step-by-step instruction, not collaboration.
The first merged change is an early milestone on the way. Shipping one small
change takes the member through the environment setup, the repository
layout, the review process, and the release flow once, which reading about
them does not replace. Removing obstacles on that path before the member
arrives lets the onboarding period go to understanding the product and the
organization instead.
### Set goals with completion criteria
Define what working autonomously means for the member as goals the mentor
and the member can check together. Attach a rough completion criterion to
each goal so that progress is visible.
| Goal | Example completion criterion |
| - | - |
| Can use the accounts and environments needed for development | Can sign in to the staging and production tools with the required permissions |
| Knows how the organization works | Can name whom to ask about each area and where its documents are |
| Understands the main features and screens | Can explain what each main screen does and which APIs it calls |
| Can ship small features and bug fixes | A team-agreed number of pull requests, including starter tasks, are merged |
| Can work with CI/CD and releases | Has created, merged, and verified one release |
| Can handle operational work | Has handled one inquiry and one alert |
Treat the criteria as guides, not pass marks. Adjust them to the member's
experience and area (frontend, backend, infrastructure), and let the mentor
and the member make the final judgment in conversation. Set the expected
duration the same way: shorter for experienced members, longer for members
new to professional development.
### Manage onboarding as a checklist
Keep the onboarding tasks in one checklist, such as an issue created from a
template, and give each task an owner: the manager, the mentor, or the new
member. A shared checklist shows what is done and what is blocked, and
prevents preparation from depending on one person's memory.
Prepare a template for each kind of member whose needs differ, such as
full-time employees, contractors, and interns. Contractors may not need
production access, and a short internship may aim for a merged change on the
first day instead of within the first weeks.
At the start, the mentor and the member customize the checklist to the
member's goals. At the end, they look back on the onboarding together and
feed what they learned into the template, so the next onboarding starts
from an improved version. A sample template appears later on this page.
> [!NOTE]
>
> At Findy, some teams manage onboarding with issue templates for full-time
> employees, contractors, and interns, tagging each task with the person
> responsible.
## Preparation before the first day
Preparation is split between the manager, who handles accounts and
organizational setup, and the mentor, who prepares the work itself.
**1. Request accounts and permissions in advance**
Account issuance often takes days and depends on other departments.
Request access to code hosting, chat, cloud environments, the password
manager, design tools, and AI tools as soon as the start date is fixed.
Decide permissions by role: a contractor may need staging access only.
**2. Make the development environment reproducible**
Write the setup as commands or scripts rather than as prose, and keep them
current. Provide one ordered quickstart that covers obtaining secrets and
setting up AI tools, and points to each repository's README. A setup that
only works with help from a specific person turns the first days into
waiting.
**3. Bring the documentation up to date**
Document task breakdown, pull request granularity, commit conventions,
and review practices, and review existing documents for outdated content
before the member arrives. An AI agent can draft the updates, which the
team then reviews. Values and practices that exist only in people's heads
cannot be learned by reading the code.
**4. Prepare starter tasks**
Select two or three tasks that are neither trivial nor large, and name the
files to change. A task that applies the same kind of fix in several
places works well: the first fix is learned with support, and the rest are
repetition. Keep a stock of such tasks with a label such as "good first
issue" so that selection does not start from zero each time.
**5. Assign a mentor and set up communication**
Decide who answers questions and reviews the member's changes. Agree in
advance that the mentor's own output will drop during this period, so the
mentor is not judged against an unchanged expectation. Add the member to
recurring meetings and the necessary chat channels, and create a personal
channel where the member can log their work.
## Supporting the first day, week, and month
### The first day
Aim for a first pull request on the first day, even a documentation fix. On
the first day:
* Explain the development process, focusing on the rules that block a
merge, such as required approvals.
* Have the member set up the environment by following the quickstart.
* Confirm that the member receives notifications for pull requests, reviews,
and mentions.
* Schedule frequent one-on-ones with the mentor, and reduce the frequency
once the member settles in.
* Start a starter task.
### The first week
* Customize the onboarding checklist together with the mentor.
* Skim the documentation to learn what exists, rather than reading all of it.
* Set a recognizable chat name and icon, and configure review reminders.
* Arrange short one-on-ones with members across functions, such as sales,
support, and planning, so that the member knows whom to ask.
### The first month
* Confirm access to the monitoring, error tracking, and cloud tools.
* Learn the development process, the backlog, and the team's metrics.
* Walk through the main user flows in the staging environment.
* Join reviews once the mentor judges the member ready, and carry out a
release.
* Learn the rules for production data changes by pairing with the mentor.
* Handle one inquiry and one alert, if the member's area includes them.
Ask the member to fix any document or procedure that does not match what
they see. A newcomer notices outdated content that long-time members no
longer read, so each onboarding keeps the documentation current.
### Day-to-day support
Give information in stages. Explaining the whole system on the first day
overloads the member with context that has nothing to attach to yet; each
piece of context is easier to absorb once a task needs it.
Make asking for help the expected behavior. When the member's personal
channel, where they log what they are working on, the error they hit, and
what they have tried, is open to the whole team, several people can offer
help without being asked one by one. A useful rule of thumb is to ask after
about 30 minutes of being stuck instead of continuing alone.
Keep review fast. A starter task that waits days for review teaches nothing
in the meantime. Small pull requests, automated checks, and automated
releases all shorten the loop between a change and its feedback.
> [!NOTE]
>
> At Findy, some teams hold regular retrospectives during onboarding and run
> the resulting actions immediately, checking the effect at the next
> retrospective.
## Sample onboarding issue template
The following template puts the goals and tasks on this page into a checklist
for full-time engineers on GitHub. Place it in `.github/ISSUE_TEMPLATE/` and
adapt the tasks, tools, and completion criteria to your team.
```markdown .github/ISSUE_TEMPLATE/onboarding.md theme={null}
---
name: Onboarding (full-time)
about: Onboarding checklist for a new full-time engineer
title: "[Onboarding] "
labels: onboarding
---
Each task starts with its owner: `[Manager]` `[Mentor]` `[Member]`.
Completion criteria are guides. The mentor and the member make the final
judgment together, and may adjust them to the member's experience and area.
## Onboarding goals
Expected duration:
- [ ] [Member] Can use the accounts and environments needed for development
- Criterion: can sign in to the staging and production tools
- [ ] [Member] Knows whom to ask about each area and where its documents are
- [ ] [Member] Can explain what each main screen does and which APIs it calls
- [ ] [Member] Can ship small features and bug fixes
- Criterion: pull requests merged, including starter tasks
- [ ] [Member] Can work with CI/CD and releases
- Criterion: has created, merged, and verified one release
- [ ] [Member] Can handle operational work (if the member's area includes it)
- Criterion: has handled one inquiry and one alert
- [ ] [Mentor][Member] Look back on this onboarding and update this template
## Preparation before the first day
### Manager
- [ ] [Manager] Request accounts: code hosting, chat, cloud, password manager, AI tools
- [ ] [Manager] Create the member's personal work-log channel
### Mentor
- [ ] [Mentor] Review the documentation for outdated content
- [ ] [Mentor] Select 2-3 issues labeled `good first issue`
- [ ] [Mentor] Add the member to recurring meetings and chat channels
## First day
- [ ] [Mentor] Explain the development process and the rules that block a merge
- [ ] [Member] Set up the environment by following the quickstart
- [ ] [Member] Confirm notifications for pull requests, reviews, and mentions
- [ ] [Member] Schedule one-on-ones with the mentor
- [ ] [Member] Start a starter task and open a pull request
## First week
- [ ] [Member] Customize this checklist with the mentor
- [ ] [Member] Skim the documentation to learn what exists
- [ ] [Member] Set a chat display name and icon, and configure review reminders
- [ ] [Member] Arrange short one-on-ones with members across functions
## First month
- [ ] [Member] Confirm access to monitoring, error tracking, and cloud tools
- [ ] [Member] Walk through the main user flows in the staging environment
- [ ] [Member] Join reviews and carry out one release
- [ ] [Mentor][Member] Learn the rules for production data changes by pairing
- [ ] [Member] Handle one inquiry and one alert (if the member's area includes them)
- [ ] [Member] Fix any document that does not match what you see
```
## Onboarding with AI
### What AI changes
With an AI agent, a new member can explore an unfamiliar codebase, ask about
its structure, and draft a task breakdown largely on their own. The time
between joining and starting implementation becomes much shorter, and the
mentor spends less time explaining code line by line.
AI cannot supply what is not written down, such as the history behind an
architecture or domain knowledge. Leaving that knowledge to the mentor's
explanations means repeating it for every new member, and the member's AI
agent cannot use it at all. Writing it down serves both.
### Prepare the context AI reads
Write down what has so far been passed on by word of mouth. Record
architecture decisions together with the reasons behind them, and keep
domain terms and business rules in a glossary. Store these documents where both people and AI agents
read them, such as in the repository. Part of the mentor's role is then to
turn what they explain into documents, so that the next member does not need
the same explanation.
Document the team's rules and package recurring workflows as
[skills](/ai/skill), so a new member's agent follows team practice from the
first day. Include the AI tools in the quickstart so that setting them up is
part of the environment setup. Keep cleaning up outdated code as well: an
agent that reads old patterns in the codebase can reproduce them.
## Related pages
> [card] [Engineer Growth](/organization/engineer-growth)
>
> When the new member is early in their career, how to develop them through
> goals, feedback, and staged learning.
> [card] [Task Breakdown](/development/task-breakdown)
>
> Read this when splitting starter tasks into units small enough to merge
> one at a time with a new member.
> [card] [Tech Blog](/organization/tech-blog)
>
> How to proceed when a new member writes their first article as a joining
> story.
# How to run a company tech blog, from pitch to publication
Source: https://lib.findy.co.jp/organization/tech-blog
How to publish externally through a company tech blog: the editorial roles and workflow, the pitch review before writing and the quality review after writing, choosing themes and managing expression risk, writing the article, and publishing and promoting it.
## Overview
A tech blog is a technical publication through which a company shares knowledge about its engineering with people outside the company. Each article is written under an individual's name, but readers take it as the company's view.
This page covers both the people who run a tech blog as an organization and the people who write the articles. It first defines the operating structure and the writing workflow, then covers choosing themes, managing expression and information risk, writing the article, and publishing and promoting it, and closes with how Findy runs its tech blog in practice.
## Where a tech blog fits
Among the forms of external communication, a tech blog takes the role of explaining decisions and their reasons at length and leaving them in a form that can be read later. Unlike a talk or an event, an article keeps being found through search for a long time, so a single article remains as evidence of the organization's technical standard.
What distinguishes it from a personal blog is where responsibility lies. Metaphors, strong assertions, and comparisons with other companies' products that are acceptable on a personal blog are read as the company's position on an official publication. Running a tech blog therefore needs a way for the organization to confirm that content can be published, not only a way for writers to write what they want.
At the same time, if the confirmation process is too heavy, writers drop away and publishing stops. The goal of running a tech blog is to keep writers able to write continuously while maintaining the quality and safety of the articles.
## How the blog is run
### Divide the roles
Running a tech blog involves at least three roles.
| Role | Responsibilities |
| - | - |
| Writer | Plans the article, writes it, and completes a self-review before requesting review |
| Manager | Reviews the article from a position that knows the writer's work |
| Editorial team | Confirms that the article's direction is consistent with the blog as a whole and that the expression carries no risk |
Assigning the editorial team as a team and treating approval from any one member as sufficient keeps reviews from concentrating on specific people.
### Define the writing workflow
An article is checked twice: before writing starts and after it is finished. Finding a mismatch in direction after writing has begun leads to a large rewrite.
**1. Register the plan**
Register the article plan in your task management tool and set the due dates for the first draft and the review, and the planned publication date. Setting dates up front lets reviewers reserve time.
**2. Get the overall plan reviewed**
Summarize a working title, an outline of what you intend to write (bullet points are fine), and the conclusion, and ask your manager and the editorial team to review it. At this stage the review checks whether the theme is suitable for the tech blog and whether the conclusion is clear, not the quality of the prose.
**3. Evaluate the value of the pitch**
Before writing begins, evaluate whether the plan contains knowledge that is new to readers. The criteria are described in the next section.
**4. Write the draft and self-review it**
Write the draft following the writing guidelines and checklist, and check its quality yourself before requesting review.
**5. Get the article reviewed**
Ask your manager and the editorial team to review the draft, address their comments, and obtain approval.
**6. Schedule and publish**
After confirming the title, the post-reading navigation, and the featured image, schedule the publication date and time.
**7. Promote the published article**
Share the article in internal channels and on personal social media so it reaches more readers.
### Review the pitch before writing and the quality after writing
The check before writing is called the pitch review, and the check after writing is called the quality review. They check different things. The pitch review decides whether the article is worth writing; the quality review decides whether it is ready to publish.
The pitch review checks that every one of the following criteria is met.
| Criterion | What to check | Example that does not pass |
| - | - | - |
| Non-obviousness | The claim is not already known to experienced readers | Ends with a truism such as "testing matters" |
| Originality | At least two elements available only from this article, such as numbers, details of a failure, procedures, or before/after comparisons | A rehash of official documentation or existing articles |
| Actionability | At least one thing readers can change the next day | Ends with "keep this in mind" |
| Target reader | The role and experience level (junior, mid-level, senior) are clear | It is impossible to tell who the article is for |
| So what? | You can answer "so what?" by saying whose what changes | "AI is convenient" |
The quality review checks the article against the structure, notation, and self-review points described in "Write the article."
> [!TIP]
>
> For both the pitch review and the quality review, leave the result as a comment on the plan's issue or the article's pull request. Reviewers then do not need to recheck the criteria that were already evaluated and can spend their time on the rest.
## Choose a theme
### Recommended themes
Themes based on the company's concrete experience suit a tech blog.
| Theme | What to watch for when writing |
| - | - |
| Sharing technical knowledge | Avoid content that is too simple, such as just trying a tutorial |
| Case studies, successes and failures, and retrospectives | Include the background and the reasons for decisions |
| Experience with development processes, agile, and team building | Write about what happened in your team, not general theory |
| Contributions to open source as an organization | Show the content and background of the contribution concretely |
| Hiring, introducing the organization, and collaboration between teams | Add concrete examples that convey how the organization actually works |
| Industry and technology trends, information from abroad | Confirm the facts and cite sources |
| Reports on technical events and seminars | Write about the content that stood out and what you learned |
| Joining stories and engineering career paths | Center on the company and organization rather than personal impressions |
Because themes affect the company's branding, even a recommended theme may not be publishable. Themes not on the list can be discussed in the review of the overall plan.
### Themes to avoid
The following themes carry too much risk for an official company publication and should be avoided.
| Theme | Why to avoid it |
| - | - |
| Comparisons of tools or products | The company does business with vendors, and raising one lowers another |
| Criticism, negation, or fault-finding | Taken as the opinion of the company as a whole |
| Criticizing or naming competitors | Affects relationships between companies |
| Confidential information, personal information, or other companies' information | Even already-public information requires checking whether republishing it is appropriate |
| The company's future strategy or the KPIs it tracks | Lets outsiders infer business decisions. Acceptable when close to general knowledge |
| Content that violates the law | Copyright infringement, unauthorized access, scraping that violates terms of service |
| Unverified information | When quoting, link to the source |
| Overly casual content | A strong element of joking is inappropriate for a company publication |
## Manage expression and information risk
### Ethics of expression
The standard for judging expression risk is not the writer's intent but how readers could receive it. If an article causes a backlash, "that was not my intent" does not hold.
On an official company publication, avoid the following expressions.
* Comparing people to animals, objects, or machines (dehumanization). Comparing people to animals has historically been used to justify discrimination.
* Applying workplace and HR vocabulary such as "assigned," "manage," or "report" to animals or fictional beings.
* Thought experiments using extreme settings such as animals, aliens, or robots. Even if the body says "this is a metaphor," the title or a heading alone gets clipped and spread.
Before publishing, check for possible misreadings with the following four tests.
| Test | What to check |
| - | - |
| Title-only test | How someone who sees only the title, without reading the body, would interpret it |
| Clipping test | How a part of the article would look without context if spread on social media |
| Most-hurt-person test | Who could be hurt by this article, and how they would feel from their position |
| International test | How readers abroad, especially in English-speaking regions, would take the expression |
### Sensitive information
Screenshots and photos capture unintended information. In screenshots of internal chat or documents, blur icons, names, timestamps, and project names. Light blurring can remain legible, so cover them fully. In desk photos, also check screens visible on monitors and notes on the desk.
Source code can reveal internal structure or vulnerabilities through variable names and numbers. When including sample code, replace company-specific variable, function, and class names with generic ones, and do not include API keys, tokens, internal URLs, or IP addresses.
> [!WARNING]
>
> Writers themselves confirm that images and screenshots are safe to share before adding them, without waiting for review.
## Write the article
### Structure
Readers expect a different structure depending on the type of article.
| Article type | Recommended structure | Approximate length |
| - | - | - |
| Technical explanation | Background and problem → options considered → implementation details → results (before/after) → outlook → summary | 3,000–5,000 Japanese characters |
| Event report | Event overview → content → what you learned → who it is recommended for | 2,000–3,000 Japanese characters |
| Experience or reflection | — | 2,000–3,500 Japanese characters |
| Detailed tutorial | — | 5,000–8,000 Japanese characters |
For experience or reflection articles and detailed tutorials, no fixed structure is defined; only the approximate length is given.
Prioritize a clear claim with evidence over length. Still, an extremely short article gives an impression of thin content, and an overly long one makes readers drop off. If an article grows long, consider splitting it into a series.
Use headings starting from h2, and phrase them by their content rather than "first" or "second." A good target is that reading only the h2 headings conveys the whole article. Place a table of contents right after the self-introduction, before the body begins.
### Title
The title affects whether an article is read as much as its content does. Make the title convey the conclusion, and put a concrete keyword such as a tool or technology name at the beginning.
Avoid patterns that AI tends to generate, such as "3 lessons from…," "How failure turned into growth…," "The complete guide to…," "…explained thoroughly," "The road to…," and "The secret of…." Short titles are memorable, but conveying the content takes priority.
### Introduction and summary
In the introduction, make the following clear at the start so readers can judge whether the article is relevant to them.
* Which tool, technology, or event the article is about
* The intended reader and what they will learn
* The background or motivation for writing
In the summary, write the conclusion you most wanted to convey, the knowledge or actions readers can take away, and the outlook. Opening with "How was it?" or closing only with "I hope this is helpful" leaves no conclusion with the reader.
### Showing numbers and evidence
When claiming an improvement, show before and after as numbers. Write "reduced from 2 hours to 5 minutes" rather than "processing became faster," and a verifiable value such as "maintained above 90%" rather than "nearly 100% coverage."
Accompany numbers with the measurement environment (production, staging, or local), the sample size or period, and the baseline for comparison. When quoting external information, add numbered references in the text and list links to official documentation and event pages as references at the end of the article.
### Tone and notation
Keep the tone neither too stiff nor too casual. Prefer expressions that lead forward, such as "in addition to …, … is increasingly required," over openings rooted in anxiety, such as "… is becoming hard to get value from." When writing about a problem, first mention the strengths of the tool or method.
Keep notation consistent within the article.
* Write product and technology names in their official form (GitHub, JavaScript, Cloud Run).
* Do not put spaces between English words and Japanese text.
* In Japanese, use 「次の」 rather than 「以下」 to introduce what follows.
* Limit bold to one or two places per heading, and keep italics, underlines, color, and horizontal rules to a minimum.
* Do not break lines after every sentence within a paragraph; separate paragraphs with blank lines.
Heavy use of bullet points, lists always aligned to three items, and mechanical lists in the form "**Item**: description" tend to make text look AI-generated. Write content that needs explanation as prose.
### Self-review
Before requesting review, reread the article three times from different perspectives. A single read leaves oversights.
| Perspective | What to check |
| - | - |
| Writer | Can you state the main message in one sentence? Is there evidence for it? Do the title and conclusion match? |
| Reader | Is it understandable without prior knowledge? Does it answer "why?" and "specifically?" Is there something to take away? |
| Critic | Does it anticipate counterarguments and exceptions? Is there anything that could read as criticism of others, boasting, or condescension? Could a personal opinion be mistaken for the company's official view? |
Also check that the table of contents and the link to the careers page are present, that no placeholder text such as "TODO" remains, and that no links are broken, and confirm the appearance in the preview.
## Publishing and promotion
### Before publishing
Before publishing, confirm that all review comments are resolved, that you have revisited the title, that post-reading navigation (links to the careers page and related articles) is in place, and that the featured image is set. Creating featured images from a shared design gives the blog a consistent look. If you change the title, recreate the image as well.
### Timing
Use your blog's analytics to identify the days and times when articles are read, and schedule the publication accordingly. At the moment of publication, also announce the article from the official social media account.
### Promotion and analysis
After publishing, the writer shares the article in internal channels and on their own social media, and asks colleagues to spread it as well. Colleagues reading and reacting to the article becomes the trigger for it to reach outside the company.
Check readership with an analytics tool and a search performance tool. Because the effect of external communication is hard to attribute to individual articles, evaluate the activity as a whole over a sufficient period rather than evaluating writers by the numbers of each article.
### Correcting a published article
When an error is found after publishing, correct the article. Before correcting it, pull the latest state from the blog service. If you edit while the content edited directly in the blog service differs from your local copy, those updates are lost.
## How Findy runs its tech blog
Findy publishes its tech blog on Hatena Blog and manages article manuscripts in a GitHub repository. Reviewing articles through pull requests, the same way as code, lets engineers write and review in the same flow as their everyday development.
To sync Hatena Blog with the GitHub repository, Findy uses [Hatena-Blog-Workflows-Boilerplate](https://github.com/hatena/Hatena-Blog-Workflows-Boilerplate/), published by Hatena. The GitHub Actions workflows for pulling and syncing drafts and reflecting published articles are based on this boilerplate.
### From writing to publication
**1. Manage the plan in GitHub Projects**
Create a task in the tech blog's GitHub Projects board and open an issue from the article template. In the issue, fill in a working title, the summary and conclusion, and the due dates for the first draft, the review, and the planned publication, and set the status to "Todo."
**2. Get the plan reviewed in the issue**
Mention your direct manager and the editorial team's GitHub team as reviewers. The editorial team is assigned as a team, and approval from any one member is sufficient.
**3. Evaluate the pitch with Claude Code**
A Claude Code command for pitch review evaluates the plan against five criteria: non-obviousness, originality, actionability, target reader, and so what. It can evaluate the content of the issue, or collect the plan interactively before evaluating. Writing starts only after a PASS, and the result is posted as a comment on the issue.
**4. Create a draft on Hatena Blog and sync it to GitHub**
In the Hatena Blog editor, save a draft with a unique title such as `username-date`. Running the GitHub Actions workflow that pulls drafts with that title automatically creates a pull request containing the draft.
**5. Edit the article on the pull request**
Pushes to the draft pull request are synced to the Hatena Blog draft through GitHub Actions, so you can check the rendering in the preview. Images added to the repository's year/month directories and referenced from the article are uploaded to Hatena Blog.
**6. Review quality with Claude Code**
A Claude Code command for quality review reviews the article. Repeat fixing and re-reviewing until the score reaches 90 or higher, then post the result as a comment on the pull request.
**7. Get reviewed by your manager and the editorial team**
Assign your manager and the editorial team as reviewers on the pull request and obtain approval.
**8. Publish with a scheduled post**
Merge the pull request while keeping the `Draft: true` line that marks it as a draft, then set the publication date and time in the Hatena Blog editor to schedule the post. At the same time, enable posting to X on publication so the official account announces it.
**9. Share it inside and outside the company**
After publishing, share the article in company-wide and engineering Slack channels and in your own times channel, and ask colleagues to spread it on social media.
### What the quality review command does
The quality review command runs the following steps in order, based on the writing guidelines.
| Step | Content |
| - | - |
| Risk check | Detects backlash risk, sensitive information, comparison or criticism, and unsupported assertions. If there is a problem, fix it and run again |
| Lint check | Mechanically detects typos, inconsistent notation, spacing, and Markdown syntax |
| Self Review | Checks the article against the checklist and the three perspectives and scores it out of 100 |
| Fix Plan | Below 90, presents concrete rewrites |
| Consistency with the plan and overall check | Confirms that the article matches the plan in the issue and that the article flows consistently as a whole |
| Comment on the pull request | At 90 or above, posts the review result to the pull request after confirmation |
The guideline file in the repository is the single source of truth, referenced both by the Claude Code commands and by reviews using GitHub Copilot Chat in Agent mode. Whichever tool a writer uses, they are reviewed against the same standard.
### Operating rules
> [accordion] Publication timing
>
> To maximize reach, articles are published on Monday or Friday (the next business day if it is a holiday) between 7:00 and 10:00. Scheduled posts are set for 7:00.
> [accordion] End of the article
>
> Every article ends with a link to the careers page along with a standard sentence.
> [accordion] Product names
>
> Product and company names are written in their official form, such as Findy, ファインディ株式会社, Findy Team+, Findy Tools, Findy Freelance, and Findy Conference. Forms such as "FINDY" or "株式会社ファインディ" are not used.
> [accordion] Featured image
>
> For a consistent look, featured images use a designated color scheme from a shared design template.
> [accordion] Preparation for first-time writers
>
> Create a Hatena ID, tell an administrator, and be added as a member of the Hatena Blog. Set your name and icon in your Hatena profile so readers know who wrote the article.
## Related pages
> [card] [The role of DevRel](/devrel/engineering-culture)
>
> The role that external communication, including the tech blog, plays for an organization.
> [card] [Engineer Growth](/organization/engineer-growth)
>
> Read this when placing article writing within growth through learning and sharing.
> [card] [Onboarding](/organization/onboarding)
>
> How to support new members, who often write a joining story, until they work autonomously in the organization.
# How to Measure Developer Productivity
Source: https://lib.findy.co.jp/productivity/how-to-measure
Explains DORA's Four Keys metrics, the three dimensions of DevEx (developer experience), what happens when a metric becomes a target (Goodhart's law), and common measurement anti-patterns.
## Overview
This page covers what to measure when improving developer productivity, and where
measurement goes wrong. It explains two widely used frameworks: DORA's Four
Keys and DevEx (developer experience). It then examines the failure mode they
share: metrics that improve on paper while actual productivity stays flat or
declines.
[Understanding Developer Productivity](/productivity/why-measure) defines
developer productivity and organizes it into three levels. This page builds on
that foundation: once you know why you measure, the next questions are what to
measure and how to avoid its pitfalls.
## Four Keys (DORA metrics)
The Four Keys are four metrics of software delivery performance identified by
DORA (DevOps Research and Assessment), a long-running research program on
high-performing technology organizations. Two measure throughput and two
measure stability.
| Metric | What it measures | Category |
| - | - | - |
| Deployment frequency | How often changes are deployed to production | Throughput |
| Lead time for changes | Time from code commit to deployment in production | Throughput |
| Change failure rate | Share of deployments that cause a failure requiring immediate remediation | Stability |
| Failed deployment recovery time | Time to recover when a deployment fails | Stability |
A central finding of this research is that throughput and stability are not a
trade-off. High-performing teams deploy frequently and recover quickly while
keeping failure rates low, because the same practices — small changes, automated
testing, continuous integration and delivery — drive both.
### Points to note when using the Four Keys
The Four Keys measure the delivery pipeline, not value. In the three levels of
[Understanding Developer Productivity](/productivity/why-measure), they
correspond to level 1: they show how efficiently and reliably changes reach
production, but not whether those changes were worth building. Pair them with
level 2 and 3 perspectives rather than treating them as the whole picture.
Note that lead time for changes starts at code commit. The upstream portion —
from idea to the start of implementation — is outside its scope, so a short
lead time does not mean ideas reach users quickly end to end.
The definitions and performance levels are also not fixed. DORA refines metric
definitions in its annual reports.
The 2024 report added a fifth metric, deployment rework rate: the share of
unplanned deployments caused by production incidents. The same report
regrouped failed deployment recovery time from stability to throughput. As of
2026, the [DORA metrics guide](https://dora.dev/guides/dora-metrics/) still
presents this five-metric model: lead time for changes, deployment frequency,
and failed deployment recovery time under throughput, and change failure rate
and deployment rework rate under stability.
Performance clusters such as "Elite" are likewise derived from each year's
survey data rather than fixed thresholds. Treat published benchmarks as
reference points. When measuring, fix your own definitions and prioritize your
team's trend over cross-company comparison.
## DevEx (developer experience)
DevEx is the day-to-day experience engineers have while doing
their work: how it feels to build, test, review, and ship changes in a given
environment. Rather than counting output directly, the DevEx approach improves
productivity by improving the conditions under which developers work.
Research on DevEx organizes the factors that shape this experience into three
dimensions.
> [card] Feedback loops
>
> The speed and quality of responses developers get from systems and people:
> builds, tests, CI results, code review, and deployment.
> [card] Cognitive load
>
> The amount of mental processing a task requires. Complex systems, unfamiliar
> frameworks, and poor documentation all increase it.
> [card] Flow state
>
> The state of full immersion and concentration in a task. Interruptions,
> unplanned work, and unclear goals break it.
### Feedback loops
Slow feedback forces developers to wait or switch tasks, which produces
interruptions and delays and accumulates frustration. Fast feedback lets
developers learn quickly and correct course while the context is still fresh.
To improve feedback loops, work on both tools and processes: shorten build and
test times, speed up handoffs between people such as code review and approvals,
and streamline the interactions between teams that sit on the delivery path.
### Cognitive load
Cognitive load is the amount of mental processing required to complete a task.
It rises when the codebase is complex, when documentation is missing or
outdated, and when developers must learn new tools or domains mid-task. High
cognitive load means more time and effort for the same outcome.
To improve cognitive load, reduce what developers must hold in their heads:
organize code and documentation, remove unnecessary obstacles in everyday
procedures, and set up platform teams that provide self-service tooling.
### Flow state
Flow state is the condition of being fully immersed in a task with focus and
energy. Developers who frequently reach flow produce more and report higher
satisfaction and growth.
The main obstacles are interruptions and delays,
followed by lack of autonomy, unclear goals, and unstimulating work.
To improve flow state, protect blocks of uninterrupted time: cluster meetings,
limit unplanned work, batch support requests, and give developers autonomy
over challenging, meaningful tasks.
### Measuring DevEx
DevEx is measured from two complementary angles. Perceptions capture how
developers feel about their work and environment, typically through surveys.
Workflows capture how work actually moves through systems and processes,
typically through tooling data.
Neither alone is sufficient: perceptions catch
problems that system data misses, and system data grounds perceptions in facts.
| Dimension | Perception examples | Workflow examples |
| - | - | - |
| Feedback loops | Satisfaction with test speed and output Satisfaction with time to deploy to production | Time to produce CI results Code review turnaround time Deployment lead time |
| Cognitive load | Perceived codebase complexity Ease of understanding documentation | Time to get answers to technical questions Manual steps required to deploy |
| Flow state | Perceived ability to focus without interruption Satisfaction with clarity of task goals | Number of blocks of uninterrupted time Frequency of unplanned tasks and requests |
On top of dimension-level metrics, overall indicators — perceived ease of
delivering software, employee engagement, and perceived productivity — serve as
north-star measures of the whole experience.
## Goodhart's law (when a metric becomes the target)
Goodhart's law states that when a measure becomes a target, it ceases to be a
good measure. Metrics are proxies: deployment frequency stands in for delivery
capability, and lead time stands in for the smoothness of the development
process. When the number itself is rewarded, people find ways to move the
number that bypass the capability it was meant to reflect.
This is why metrics should drive team improvement, not individual evaluation.
Once a metric feeds into performance reviews, optimizing the number becomes
rational behavior, and the metric stops reflecting reality.
For example, suppose lead time for changes feeds into individual evaluation.
Team members start picking up quick, small fixes first and avoiding bugs that
need investigation or large refactorings. Lead time gets shorter, but the hard
problems stay untouched and technical debt accumulates.
Watching multiple
metrics together also helps: gaming one metric usually shows up as degradation
in another, such as a lower change failure rate paired with a falling
deployment frequency.
## Measurement anti-patterns
The following patterns improve a metric without improving — and often while
harming — actual productivity. They share a common root: targeting the number
itself instead of the capability behind it.
### Raising deployment frequency by deploying more often
High deployment frequency is the result of capabilities such as CI/CD
automation, small change sizes, and automated testing. Increasing the deploy
count without those capabilities raises the change failure rate, increases time
spent on incident response, and eats development time with deployment work.
Build the underlying practices first, and let frequency rise as a consequence.
### Improving lead time on paper
Because lead time for changes starts at commit, committing only after all
implementation is finished makes the number shorter without making development
faster.
Coarse commits also make history harder to read and rollbacks harder to
perform, and the hidden early phase hides exactly the problems measurement was
supposed to reveal. Commit in small steps and let the metric reflect reality.
Splitting pull requests more finely than the work requires has the same
structure. Mechanical changes that span many files belong in one pull request.
Splitting them per file inflates the pull request count while adding split and
review overhead. Treat pull request counts as a check on granularity, not a
number to maximize.
Likewise, moving tests into a separate pull request to keep
size down leaves untested code on the main branch and makes forgetting the
tests easy. Code and its tests belong in the same pull request.
### Cutting review time by skipping it
Skipping code review is the fastest way to shorten the review phase and the
most expensive. Review catches bugs, raises quality, spreads knowledge, and
reduces single-person dependencies.
Instead of removing it, remove what makes
it slow: smaller pull requests, automated detection of mechanical issues with
linters and CI, and balanced reviewer load.
### Lowering the change failure rate by avoiding deploys
Deploying less often lowers the number of chances to fail. But each deployment
now carries more changes, which raises the risk of unexpected interactions,
widens the blast radius, and lengthens the time to isolate causes. Reduce the
failure rate by making each change smaller and better tested, not by deploying
less.
Underreporting has the same effect from the other side. When the failure rate
is computed from hotfix counts, handling genuine incidents through the normal
flow keeps the number low while the failures still happen. The unrecorded
failures never surface in retrospectives, so the team loses the chance to
improve. Measure correctly first; make the number better second.
### Targeting survey scores
The same thing happens when DevEx perception metrics become targets. If
satisfaction scores are set as goals or tied to the evaluation of teams or
managers, respondents start answering more favorably than reality warrants.
Scores rise while the problems developers face disappear from view.
Use surveys
to find where problems are. Rather than competing for high scores, dig into the
causes behind low-scoring items and turn them into improvements.
### Surveying without acting on the results
If surveys keep coming but nothing changes as a result, developers conclude
that answering is pointless. Participation drops, and the means of measuring
perception stops working.
Run surveys only as often as you can act on the
results. Then tell respondents what you learned and what you changed.
## Related pages
> [card] [Understanding Developer Productivity](/productivity/why-measure)
>
> The premise of this page: the definition of developer productivity, the three levels, and why measurement matters.
> [card] [CI/CD](/development/ci-cd)
>
> The automation that underpins deployment frequency and lead time, covered as concrete pipeline design.
> [card] [Code Review](/development/code-review)
>
> How to shorten review turnaround without skipping review, including tooling and self-review.
> [card] [Task Breakdown](/development/task-breakdown)
>
> How to split work into appropriately sized changes — the capability behind small pull requests.
# What is developer productivity? Definition and levels
Source: https://lib.findy.co.jp/productivity/why-measure
Explains the definition of developer productivity, the three levels of productivity with measurement and initiatives for each, why improvement matters, and cautions when pursuing it.
## Overview
Developer productivity is the ratio of the output obtained to the input
invested in development. The term covers a wide range, however: what people
picture when they hear it varies from a team's work efficiency to the value a
whole product delivers. Discussions of developer productivity therefore start
by making the definition explicit.
First, this page organizes what developer productivity is and why improving
it matters. It then covers the product goal as a premise, the definition of
output and input, the three levels of productivity with measurement and
initiatives for each, what improvement brings, and finally cautions when
pursuing it.
## Before talking about developer productivity
### Start from the product's goal
For most products built by a business, creating the product itself is not the
goal; the goal is the result obtained through the product. What matters are
the KPIs achieved by users adopting the product, and the revenue and profit
that follow. A product that cannot support its business cannot continue.
Improving developer productivity is considered on this premise: contribution
to that goal.
### Identify where to work on it
A product is built through a sequence of activities: problem discovery,
planning, design, engineering, and QA. Developer productivity sometimes
refers to the productivity of the product as a whole, not just engineering.
If any stage is unproductive, or coordination between stages is poor, overall
product productivity stays low even when engineering productivity is high.
When starting small, however, the part a team can control most directly is
the engineering-specific portion. Cross-organizational efforts take time for
information sharing and aligning on problems, so start by raising
productivity within your own scope or your team's, then expand from there.
## Defining developer productivity
Productivity is expressed as `output obtained ÷ input invested`. The output
and input can take many forms.
| Kind | Typical items |
| - | - |
| Output | Number of released features and fixes Lines of code developed Number of resolved bugs and issues Value delivered (user satisfaction, contribution to revenue) Quantity and quality of documentation |
| Input | Time spent on development Human resources invested (number of engineers) Budget used for development Cost of infrastructure and tools Time and budget invested in educating and training the team |
What to treat as output and input differs by organization, team, and project.
What matters is making explicit what counts as output, what counts as input,
and what your organization calls developer productivity.
Sharing the definition and its measurement method across the whole
organization, and improving continuously, leads to product success.
Conversely, without a shared definition, perceptions diverge and the effort
stops being understood.
## The three levels of developer productivity
Developer productivity is viewed at three levels (Levels 1–3), defined by
what counts as the "result".
| Level | Result being measured | Example viewpoints |
| - | - | - |
| Level 1: Work volume | How efficiently a given amount of work was completed | Whether an efficient development environment is in place Whether engineers have the needed skills Whether the service itself has a good structure |
| Level 2: Expected value | How much of the expected value was released | Whether the right tasks that serve the product's goal are selected Whether tasks are prioritized appropriately |
| Level 3: Realized value | Concrete contribution to the actual service | How much revenue changed because of the product How far KPIs were achieved |
### Level 1: Work volume productivity
Level 1 evaluates productivity purely in terms of work volume, without
considering contribution to value or revenue. Because it relates directly to
engineering and can be controlled by engineers alone, it is the easiest
level to work on and the quickest to show visible results.
#### Measurement
Start by quantifying the daily activity of individuals and the team.
Observing metrics such as the following at fixed intervals and graphing them
over time reveals work volume and its trend.
* Commits and pull requests per day
* Average time pull requests stay open
* Time spent on code review
* Average time to fix bugs
* Implementation rework rate (rework completed within implementation, such
as review fixes)
* Automated test coverage
* Build success rate and duration
#### Improvement initiatives
* Improving maintainability (thorough documentation, stronger unit tests,
regular refactoring)
* Automating repeated tasks such as builds and deployments
* Making code review efficient (catching trivial errors early with linters
and CI/CD)
* Strengthening teamwork through pair programming and knowledge-sharing
sessions
### Level 2: Expected value productivity
Level 2 considers how much value each initiative brings to the product, not
just the amount of work. Because the impact on actual value appears only
some time after release, it focuses on how much of the *expected* value was
released. In many cases,
Scrum or agile development frameworks are used to measure how many valuable
tasks were realized.
#### Measurement
Track whether the right tasks are selected and expected value flows to
release without waste. Indicators such as the following can be used.
* Share of valuable features (the proportion of developed features that
actually bring value to customers or the business)
* Lead time from idea to value delivery (time from conception until value
actually reaches customers)
* Specification rework rate (rework caused by ambiguous or changed
requirements and poor coordination between stages)
* Requirements documentation coverage and frequency of requirement changes
during development
#### Improvement initiatives
* Building a strategic roadmap that clarifies value and priority
(prioritization with weighted scoring or RICE scores)
* Validating value through market and user interviews
* Managing risk by estimating the loss of not addressing something
### Level 3: Realized value productivity
Level 3 evaluates concrete contribution to the actual service, such as
revenue and KPIs. Raising productivity at this level is the ultimate goal,
but the causal link between engineering investment and results is not always
clear, which makes it the hardest level to evaluate.
#### Measurement
Track how delivered features led to business results, following the
product's KPIs. Indicators such as the following can be used.
* Product KPIs (active user counts, conversion rates, and so on)
* Changes in revenue and customer counts attributable to the product
* Operating margin and infrastructure cost reduction (contribution on the
cost side)
* User satisfaction
#### Improvement initiatives
Improving Level 3 cannot be completed by engineering alone, and the right
initiatives differ depending on the product and the organization's
structure. With that premise, examples include the following.
* Define the product's KPI tree and connect each feature or initiative, at
the planning stage, to the KPI it contributes to
* Build mechanisms to measure the adoption and effect of released features,
verifying the link between initiatives and business results
* Create cross-role feedback loops that bring the customer voice gathered
by sales and customer success back into development
* Have engineers participate in planning and problem discovery, validating
the necessity and target users of a feature from the development side as
well
Every one of these requires involving everyone connected to the product —
product managers, designers, QA, sales, and customer success. Deep
collaboration across roles is required, so even teams that reach Level 2
through mature agile development often struggle with Level 3 improvement.
At every level, both kinds of understanding matter: grasping visualized
results qualitatively, and knowing quantitatively how the numbers actually
move. Combining quantitative data with the qualitative sense of day-to-day
problems lets you see productivity from multiple angles.
## Why improving developer productivity matters
### Social background
In Japan, the working population is shrinking due to population decline and
aging, and producing results with limited headcount requires working
efficiently with the power of technology. Work-style reform that no longer
assumes long hours, and the spread of DX (digital transformation) that
improves business processes through digitalization, also drive the demand
for productivity.
### Background in engineering
Changes in engineering itself also call for higher productivity.
> [card] The spread of remote work
>
> With processes no longer visible, more teams and companies focus on
> contribution to results, and individuals need to work efficiently.
> [card] High-quality products as the baseline
>
> Competition with advanced products from around the world requires
> delivering usable, capable products faster, in response to user demand.
> [card] Standardization of technology
>
> With growing use of OSS and external SaaS, teams need the ability to
> select and combine many technologies.
> [card] Data-driven product improvement
>
> As the saying "measure, don't guess" suggests, development is expected
> to combine measured facts and to visualize engineering's own
> productivity as it goes.
### What improvement brings
Improving developer productivity becomes a factor directly tied to
organizational growth and success.
| What you gain | Summary |
| - | - |
| More results from less investment | Hiring engineers takes time, and new hires need a catch-up period. Making the most of existing resources to raise productivity is key to staying competitive |
| Clearer problems through visualization | When productivity is quantified into concrete numbers, the flow of work and its problems become clear, and organizational weaknesses and opportunities can be found and addressed early |
| An improvement cycle | Highly productive teams build continuous improvement into daily work, and that cycle produces further productivity gains |
| Contribution to the product cycle | As developer productivity improves, the release cycle shortens, enabling faster response to market changes |
| A positive effect on recruitment | An organization with little technical debt and visible improvement is an attractive environment where engineers can grow, which also benefits employer branding |
## Cautions when pursuing improvement
### Do not over-pursue it
Excessive pursuit of developer productivity causes problems such as overwork
and quality degradation. It also invites behavior whose goal is protecting
the numbers — rubber-stamping reviews to keep a metric from dropping, or
developing locally and opening a pull request only at the end — which strays
from the point of improving productivity. Proceed while watching the
organization's condition, not blindly.
> [!WARNING]
>
> Metrics are for improving the organization and the team, not for
> evaluating individuals. When a metric becomes an evaluation target,
> optimizing the number itself takes priority and the metric stops
> reflecting reality. This phenomenon is known as Goodhart's law.
### Do not build the wrong thing
No matter how efficiently a team develops, building the wrong thing brings
the delivered value to zero. More important than productivity improvement is
delivering something truly valuable. Consider the following to raise
delivered value.
> [card] Why, when, and who will use it
>
> Examine the necessity, timing, and target users of a feature from the
> engineer's viewpoint too, rather than taking requesters' or product
> managers' information at face value.
> [card] Can it be realized without development?
>
> Keep delivered value while minimizing invested resources by combining
> existing features or using external services and libraries.
> [card] Can the design be simpler?
>
> Reduce mixed purposes and branching in features so that maintenance and
> modification effort does not balloon.
> [card] Is staged release possible?
>
> Release the most important part first, get feedback early, and make
> course corrections or stop decisions quickly.
Engineers are not mere implementers; they should actively think about
development that leads to business value. Improving developer productivity
is meaningful only when combined with the right direction.
## Related pages
> [card] [CI/CD](/development/ci-cd)
>
> Automating builds and deployments — one of the Level 1 initiatives named
> here, as a concrete pipeline.
> [card] [Code Review](/development/code-review)
>
> Where review time actually goes, and how to spend less of it on what tools
> can check.
> [card] [Test Code](/development/testing)
>
> Coverage is a Level 1 metric; this is how to make the tests behind the
> number worth counting.
# Quickstart for AI agents: llms.txt, Markdown, and MCP
Source: https://lib.findy.co.jp/quickstart
How an AI agent reads Findy Library: the llms.txt index, per-page Markdown, and the search MCP server.
## Overview
Findy Library is published so that AI agents can read it directly, not only
people. Every page is available as plain Markdown, and the whole site is indexed
for agents. This page describes the three access paths an agent uses.
## 1. Discover what exists
`llms.txt` is an index that lists every page with a short description, so an
agent can decide what to read before fetching anything else. `llms-full.txt`
contains the entire site as a single file.
```bash theme={null}
curl https://lib.findy.co.jp/llms.txt # index of all pages
curl https://lib.findy.co.jp/llms-full.txt # the entire site in one file
```
## 2. Read a page as Markdown
Append `.md` to any page path to get its raw Markdown. The response is the same
content people see, without HTML to scrape.
```bash theme={null}
curl https://lib.findy.co.jp/development/pull-request.md
```
## 3. Search with the MCP server
Findy Library exposes a search MCP server at `https://lib.findy.co.jp/mcp`,
which lets an MCP-capable agent query the docs directly instead of fetching
pages one by one. No authentication is required.
Register the server with your MCP client:
```bash Claude Code theme={null}
claude mcp add --transport http findy-library https://lib.findy.co.jp/mcp
```
```json Cursor (mcp.json) theme={null}
{
"mcpServers": {
"findy-library": {
"url": "https://lib.findy.co.jp/mcp"
}
}
}
```
```json VS Code (.vscode/mcp.json) theme={null}
{
"servers": {
"findy-library": {
"type": "http",
"url": "https://lib.findy.co.jp/mcp"
}
}
}
```
Once connected, ask a question and the agent retrieves the passages most
relevant to it through the search tool.
## Related pages
> [card] [MCP](/ai/mcp)
>
> What the search server in step 3 is built on, and how an agent connects to
> tools like it.
> [card] [Pull Requests](/development/pull-request)
>
> A good page to read first — or to fetch as Markdown — once the access path
> is set up.
> [card] [Vibe Coding](/ai/vibe-coding)
>
> Working with an AI coding agent day to day, once it can read this library.
# Terms of Service
Source: https://lib.findy.co.jp/terms-of-service
The terms of service governing the use of Findy Library, the documentation site provided by Findy Inc.
The Findy Library Terms of Service (the "Terms") set forth the conditions for
using "Findy Library" (the "Service"), a documentation site provided by Findy
Inc. (the "Company"). Any person who uses the Service (a "User") is deemed to
have agreed to these Terms.
## Article 1 (Description of the Service)
The Service publishes and provides documents and content on software
development and other technical domains created by the Company (including
text, diagrams, code examples, and all other information; collectively, the
"Content").
## Article 2 (Scope of License)
The Company grants Users, on the condition that they comply with these Terms,
a royalty-free right to view and consult the Content as reference information
for personal or internal business use. This license does not constitute an
assignment or transfer of any copyright or other intellectual property rights
in the Content (see Article 7).
## Article 3 (Prohibited Acts)
In using the Service, Users must not engage in any of the following acts:
1. Reproducing all or part of the Content and providing it to third parties
through redistribution, republication, sale, or any other means, whether
or not the Content has been modified
2. Presenting the Content as if it were created by a party other than the
Company, or causing others to misidentify it as such
3. Using scraping, crawling, or other automated means to obtain the Content
exhaustively or in bulk (excluding use by AI agents as provided in
Article 4)
4. Interfering with, or creating a risk of interference with, the operation
of the Service, the provision of the Content, or any other business of
the Company
5. Violating laws, regulations, or public order and morals
6. Any other act that the Company reasonably determines to be inappropriate
in light of the purpose of the Service
## Article 4 (Use by AI Agents)
The Service does not prevent AI agents or other programs from referring to
the Content as an information source and using it to generate answers or
other output, and the Company anticipates such use.
However, when providing answers or other output generated through such use
to third parties, the User shall endeavor to indicate, to the extent
practicable, that the Content originates from "Findy Library." If such use
involves any act falling under the items of Article 3, it constitutes a
violation of these Terms.
## Article 5 (Attribution)
When quoting, referencing, or reprinting the Content, Users shall clearly
indicate the name "Findy Library" as the source.
## Article 6 (Use of Access Analytics Tools)
The Service may use Google Analytics or other access analytics tools to
understand usage of the Service. These tools may use cookies or similar
technologies to collect information about usage in a form that does not
identify individuals.
## Article 7 (Intellectual Property Rights)
Copyrights and other intellectual property rights in the Content belong to
the Company or to third parties who have provided content to the Company.
The license granted under Article 2 does not constitute an assignment or
transfer of these rights.
## Article 8 (Disclaimer)
1. The Company makes no warranty whatsoever as to the accuracy,
completeness, usefulness, currency, or fitness for a particular purpose
of the Content.
2. The Company shall not be liable for any damage incurred by Users or third
parties as a result of the use of the Content (including use by AI
agents), except where such damage is caused by the willful misconduct or
gross negligence of the Company.
3. The Company may change the content of the Service or suspend or terminate
the provision of the Service without prior notice, and shall not be
liable for any damage incurred by Users as a result.
## Article 9 (Response to Violations)
1. If the Company determines that a User has violated any item of Article 3,
the Company may demand that the User cease the violating act, delete
posted materials, or take other necessary measures, and may also seek
injunctive relief, claim damages, and take other legal action.
2. If the Company determines that a violation described in the preceding
paragraph has occurred or is likely to occur, the Company may suspend the
provision of all or part of the Service without prior notice.
## Article 10 (Amendment of the Terms)
The Company may amend these Terms without obtaining the individual consent
of Users when the Company deems it necessary, by notifying Users through its
official website or by any other method the Company reasonably determines to
be appropriate. If a User uses the Service after the amended Terms have
taken effect (regardless of the method of use, including whether or not via
the website), the User is deemed to have agreed to the amendment.
## Article 11 (Governing Law and Jurisdiction)
These Terms are governed by the laws of Japan. If a lawsuit arises between
the Company and a User, the Tokyo Summary Court or the Tokyo District Court,
depending on the amount in dispute, shall have exclusive jurisdiction as the
court of first instance.
## Article 12 (Publication of the Terms)
Because the Service has no member registration or other procedure that
identifies Users, the Company does not conduct individual consent procedures
for these Terms. The Company informs Users of these Terms by placing a link
to them in the footer of the Service website and by publishing them on
content pages within the Service. If a User uses the Service (regardless of
the method of use, including whether or not via the website), the User is
deemed to have agreed to these Terms.
## Article 13 (Severability)
Even if any provision of these Terms or any part thereof is determined to be
invalid or unenforceable under laws or regulations, only that provision or
part shall be invalid, and the remaining provisions of these Terms shall
remain in full force and effect.
## Supplementary Provisions
Established and effective as of July 21, 2026.