-
Notifications
You must be signed in to change notification settings - Fork 1
feat: SKILL.mdを修正 #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,39 +24,43 @@ Use this skill for feature work, bug fixes, refactors, or reviews in this reposi | |
| - The frontend builds a typed client with `hc<AppType>('/')` and calls: | ||
| - `GET /api/weapons/random?count=<n>` | ||
| - `GET /api/results` | ||
| - `POST /api/results` | ||
| - Local Vite dev proxies `/api` to `http://localhost:3000`. | ||
| - Result history is stored in Cloudflare KV under a single bounded key (`results`) rather than one key per record. | ||
|
|
||
| ## Working rules for this repo | ||
|
|
||
| - Treat `src/app.tsx` as the current source of truth for user-visible behavior. | ||
| - Keep frontend and API changes aligned. If you change an API response shape, update the typed client usage in `src/app.tsx` in the same task. | ||
| - Be careful with the boundary between real data and placeholders: | ||
| - `useSWR('results', ...)` fetches live result data from KV. | ||
| - `cards` in `src/app.tsx` are currently hardcoded sample history entries. | ||
| - Do not assume the rendered history UI is already wired to backend data. | ||
| - History is live data now: | ||
| - `useSWR('results', ...)` reads current history from `GET /api/results`. | ||
| - After `POST /api/results`, the frontend updates the SWR cache directly instead of forcing a refetch. | ||
| - Keep the frontend cache update logic aligned with the backend retention limit. | ||
| - `src/constants/weapon.ts` appears to be legacy or unused. Confirm usage before editing it. | ||
| - `tsconfig.json` includes only `src`, even though the frontend imports types from `functions/`. If type changes behave strangely, inspect this include boundary first. | ||
| - `package.json` is configured for `husky` and `lint-staged`. Avoid assuming hooks are consistently installed. | ||
| - Free-tier-conscious behavior matters here. Prefer bounded KV usage and avoid extra reads when the UI can update from the mutation response. | ||
|
|
||
| ## Safe change workflow | ||
|
|
||
| 1. Read `src/app.tsx` and the relevant route files before editing. | ||
| 2. Prefer the existing API shape and component patterns unless the task clearly requires a change. | ||
| 3. For backend changes, verify the corresponding Cloudflare binding exists in `wrangler.toml`. | ||
| 4. For frontend changes, check whether data is live or placeholder before wiring UI logic. | ||
| 4. For history changes, update both `functions/api/routes/result.ts` and the SWR mutation logic in `src/app.tsx`. | ||
| 5. Run the narrowest useful verification available after edits. | ||
|
|
||
| ## Verification | ||
|
|
||
| - Install dependencies: `npm install` | ||
| - Frontend dev server: `npm run dev` | ||
| - Production build: `npm run build` | ||
| - Lint scripts: `npm run lint:script` | ||
| - Lint styles: `npm run lint:style` | ||
|
|
||
| If a task touches Cloudflare runtime behavior, note that local verification may also require a Pages/Workers dev setup that is not fully captured by current package scripts. | ||
|
|
||
| ## Known pitfalls | ||
|
|
||
| - `functions/api/routes/weapon.ts` builds the SQL `LIMIT` clause from the query string directly. Be cautious when changing request handling there. | ||
| - `index.html` still has the default Vite title, so product polish tasks may need to update app metadata. | ||
|
Comment on lines
60
to
-61
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| - `functions/api/routes/result.ts` keeps only the newest `MAX_HISTORY_ITEMS` entries. If you change that value, update the frontend cache trimming logic too. | ||
| - `src/app.tsx` disables several SWR revalidation paths and relies on mutation results for freshness. If you change that strategy, reevaluate KV read volume. | ||
| - `wrangler.toml` contains concrete binding IDs. Do not rotate or replace them casually. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/app.tsxsetsrevalidateOnMount: false(and also disables focus/reconnect revalidation) and there’s noSWRConfigfallback/other mount-time trigger insrc/, so the history list may not be fetched on initial page load. This makes the statement thatuseSWR('results', ...)“reads current history fromGET /api/results” potentially misleading; consider clarifying the docs or adjusting the app’s initial fetch strategy so history is actually loaded on mount.