From df519780b6689c3625c27593b3a68c5b382f418d Mon Sep 17 00:00:00 2001 From: "k.hiro1818" Date: Sun, 11 Oct 2026 05:26:17 +0000 Subject: [PATCH] docs: add add-tasks skill and link it from add-contest-table-provider Co-Authored-By: Claude Sonnet 5.5 --- .../add-contest-table-provider/SKILL.md | 2 +- .../instructions.md | 2 +- .agents/skills/add-tasks/SKILL.md | 15 ++++++++ .agents/skills/add-tasks/instructions.md | 35 +++++++++++++++++++ .claude/skills/add-tasks | 1 + AGENTS.md | 13 +++---- .../how-to-add-contest-table-provider.md | 2 +- 7 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 .agents/skills/add-tasks/SKILL.md create mode 100644 .agents/skills/add-tasks/instructions.md create mode 120000 .claude/skills/add-tasks diff --git a/.agents/skills/add-contest-table-provider/SKILL.md b/.agents/skills/add-contest-table-provider/SKILL.md index 286fefe9c..99a3e774e 100644 --- a/.agents/skills/add-contest-table-provider/SKILL.md +++ b/.agents/skills/add-contest-table-provider/SKILL.md @@ -8,6 +8,6 @@ Add a new contest table provider for: $ARGUMENTS > When in doubt at any step, use AskUserQuestion before proceeding. -0. **Seed check** — grep `prisma/tasks.ts` for the contest_id(s); report count + task_ids; if absent or incomplete, ask the user to paste the missing rows (source: `https://kenkoooo.com/atcoder/resources/problems.json`). Do not fetch it yourself: atcoder.jp is unreachable, and WebFetch truncates problems.json, so a miss there is not evidence of absence +0. **Seed check** — grep `prisma/tasks.ts` for the contest_id(s); report count + task_ids; if absent or incomplete, collect them per `add-tasks` [§Collect rows](../add-tasks/instructions.md) (never fetch problems.json yourself) 1. **Gather requirements** — infer the implementation pattern; confirm per [instructions.md §Requirements](instructions.md) 2. **Implement** — follow [instructions.md](instructions.md) for the confirmed pattern across 5 layers (TDD) diff --git a/.agents/skills/add-contest-table-provider/instructions.md b/.agents/skills/add-contest-table-provider/instructions.md index c052159f7..0d2c9f2de 100644 --- a/.agents/skills/add-contest-table-provider/instructions.md +++ b/.agents/skills/add-contest-table-provider/instructions.md @@ -49,7 +49,7 @@ Step 0 (seed check) is already done. Confirm the following before touching code: ### Implement -- [ ] `CONTEST_TYPES_BY_ID` or `CLASSIFICATION_RULES` in `src/lib/contests/utils/classification.ts` +- [ ] `CONTEST_TYPES_BY_ID` or `CLASSIFICATION_RULES` in `src/lib/contests/utils/classification.ts`, or the maps in `prefixes.ts` (exact vs prefix match: see `add-tasks` [§Classify](../add-tasks/instructions.md)) - [ ] `contestTypePriorities` in `src/lib/contests/utils/priority.ts` - After priority insertion, all later entries shift +1 → **update JSDoc numeric ranges** (4 category names are immutable) - Fix hardcoded priority-diff expected values in `src/test/lib/utils/task.test.ts` only when they involve a shifted entry (±1 each) diff --git a/.agents/skills/add-tasks/SKILL.md b/.agents/skills/add-tasks/SKILL.md new file mode 100644 index 000000000..6d2fb5678 --- /dev/null +++ b/.agents/skills/add-tasks/SKILL.md @@ -0,0 +1,15 @@ +--- +name: add-tasks +description: Add tasks of contests that an existing ContestType already covers to prisma/tasks.ts, with classification tests first. Use for "問題を追加しましょう" issues. Hands off to add-contest-table-provider when a new ContestType or provider is needed. +argument-hint: ' [ ...]' +--- + +Add tasks for: $ARGUMENTS + +> When in doubt at any step, use AskUserQuestion before proceeding. + +1. **Classify** — decide the ContestType and prefix group per [instructions.md §Classify](instructions.md); a new ContestType or provider → stop and switch to `add-contest-table-provider` +2. **Collect rows** — grep `prisma/tasks.ts`; ask the user to paste missing rows from problems.json; never fetch it yourself +3. **Tests first** — add fixture cases per [instructions.md §Tests](instructions.md); confirm **RED** +4. **Implement** — add the contest name to `prefixes.ts` → **GREEN**; insert rows per [instructions.md §Insert](instructions.md) +5. **Verify** — `pnpm format` / `pnpm lint` / `pnpm check` / `pnpm test:unit` / `git diff --check` diff --git a/.agents/skills/add-tasks/instructions.md b/.agents/skills/add-tasks/instructions.md new file mode 100644 index 000000000..6676dca1b --- /dev/null +++ b/.agents/skills/add-tasks/instructions.md @@ -0,0 +1,35 @@ +# Add Tasks — Checklist + +--- + +## Classify + +- Groups in `src/lib/contests/utils/prefixes.ts` match differently: + - `ABC_LIKE` / `ARC_LIKE`: exact match — a sequel (e.g. `diverta2019-2` next to `diverta2019`) needs its own key + - `AGC_LIKE` / `ATCODER_UNIVERSITIES` / `ATCODER_OTHERS`: prefix match — check an existing key does not already swallow the new id with the wrong type + - AOJ: regex (`regexForJag`, `regexForAojUniversity`) — no map edit if the id already matches; otherwise widening the regex also affects `getContestNameLabel` and `AojGenerator.canHandle`, so switch to `add-contest-table-provider` +- Rules are first-match-wins (`CLASSIFICATION_RULES` in `classification.ts`); confirm no earlier rule (`abc\d{3}`, `past`, `joi`, ...) catches the id +- Use the official contest name; Japanese if one exists + +## Collect rows + +- Source: `https://kenkoooo.com/atcoder/resources/problems.json` +- atcoder.jp is unreachable and WebFetch truncates problems.json, so a miss there is not evidence of absence — ask the user to paste the rows +- Use `id` / `problem_index` / `name` / `title` verbatim; do not derive `id` from contest_id + +## Tests + +Add cases to the fixtures the contest type exercises (all under `src/lib/contests/fixtures/` unless noted): + +- [ ] `contest_type.ts` — always +- [ ] `contest_name_labels.ts` — when the type has a label generator (OTHERS, UNIVERSITY, AOJ\_\*); ABC_LIKE / ARC_LIKE fall back to the uppercased id, so skip +- [ ] `contest_name_and_task_index.ts` — AOJ types +- [ ] `src/test/lib/utils/test_cases/task_url.ts` — AOJ types +- [ ] `pnpm test:unit src/lib/contests/` — **RED** + +## Insert + +- [ ] Place rows after the existing block of the same group in `prisma/tasks.ts` +- [ ] Contests newest first; tasks within a contest in descending index (F → A) +- [ ] For more than a few rows, generate the entries with a script instead of hand-typing +- [ ] `grep -c` the new ids to confirm the count diff --git a/.claude/skills/add-tasks b/.claude/skills/add-tasks new file mode 120000 index 000000000..1a63f6dbb --- /dev/null +++ b/.claude/skills/add-tasks @@ -0,0 +1 @@ +../../.agents/skills/add-tasks \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index a55dace4d..8002e436f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -54,12 +54,13 @@ Before planning or changing a matching path, read the corresponding document und Use project-specific workflows from `.agents/skills/` when a task matches a skill description. Each `.agents/skills//instructions.md` is a plain Markdown checklist — read it directly when doing that task by hand, not only when an agent loads it automatically. -| Skill | Purpose | -| ---------------------------- | ------------------------------------------------ | -| `add-contest-table-provider` | Add a ContestType / ContestTableProvider via TDD | -| `dep-upgrade` | Analyze and execute a major dependency upgrade | -| `extract-approach` | Extract learnings from a just-solved problem | -| `verify-test-strength` | Verify test detection power via mutation testing | +| Skill | Purpose | +| ---------------------------- | ----------------------------------------------------- | +| `add-contest-table-provider` | Add a ContestType / ContestTableProvider via TDD | +| `add-tasks` | Add tasks of existing ContestTypes to prisma/tasks.ts | +| `dep-upgrade` | Analyze and execute a major dependency upgrade | +| `extract-approach` | Extract learnings from a just-solved problem | +| `verify-test-strength` | Verify test detection power via mutation testing | Add a row here whenever a skill is added, renamed, or removed. diff --git a/docs/guides/how-to-add-contest-table-provider.md b/docs/guides/how-to-add-contest-table-provider.md index f1b028c1c..dd43c4758 100644 --- a/docs/guides/how-to-add-contest-table-provider.md +++ b/docs/guides/how-to-add-contest-table-provider.md @@ -7,7 +7,7 @@ ## 事前確認 - [ ] `ContestType`(`src/lib/contests/types/contest.ts`)— 既存で対応できるか?複数 contest_id を統一表示するなら複合型 -- [ ] `classifyContest()`(`src/lib/contests/utils/classification.ts`)— 新 contest_id に正しい ContestType を返すか +- [ ] `classifyContest()`(`src/lib/contests/utils/classification.ts`)— 新 contest_id に正しい ContestType を返すか。`prefixes.ts` の `ABC_LIKE` / `ARC_LIKE` は完全一致、他グループは前方一致なので、続編(例: `diverta2019-2`)は完全一致グループでは個別にキーを追加する - [ ] `prisma/tasks.ts` にデータが存在するか(複合型は `prisma/contest_task_pairs.ts` も) - [ ] 実装パターン判定(後述4パターン) - [ ] JOI: 2026 年より `joi{YYYY}ho` → `joi{YYYY}sf`。regex は `(ho|sf)` 対応済み