decide
Use to record an architecture decision as an ADR in docs/adr through a merge request.
- License 许可
- MIT
- 最近更新
- 2026-10-30
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- decide
- description
- Use to record an architecture decision as an ADR in docs/adr through a merge request.
03 SKILL.md 正文
Record a decision
Steps
- Go to the workspace root: the nearest directory, walking up from where you are, where
test -f .agents/kit.jsonsucceeds. Run every command below from there. - Ask the person for:
title: one line;- context: what forces the decision;
- decision: what we do;
- rejected alternatives, each with the reason it was rejected;
- consequences: what changes after the decision;
- affected keys, such as
repo:payments-workerordomain:payments; - the ADR this decision replaces, such as
adr:0001, or none. Every affected key must exist, see.agents/rules/keys-and-links.md: arepo:name is inrepos.json, adomain:directory is indomains/, and so on. Drop or correct, together with the person, every key that does not exist. Never invent content the person did not give.
- Find the workspace default branch: run
git symbolic-ref --short refs/remotes/origin/HEADand remove theorigin/prefix; when the command fails, usemain. Call it<default>. Then run, one by one:git switch <default>git pull --ff-only
- Choose the number
NNNNand the slug, then create the branch. Do this after the pull, so the number is taken from the fresh default branch.- Run
ls docs/adr/ | grep -E '^[0-9]{4}-.*\.md$' | tail -1 | cut -c1-4. It prints the highest number, for example0002. - When it prints nothing,
NNNNis0001. Otherwise runprintf '%04d\n' "$(expr <highest> + 1)", for exampleprintf '%04d\n' "$(expr 0002 + 1)"prints0003. - Slug: the title in lowercase, every run of characters other than
a-zand0-9replaced by one-, and-removed from both ends. Runprintf '%s' "<title>" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g; s/^-+//; s/-+$//'. ForUse Kafka for payment eventsit printsuse-kafka-for-payment-events. - When the slug command prints nothing (the title has no Latin letters or digits, for example a Russian title), ask the person for a short English slug made only of
a-z,0-9and-, such asuse-kafka. Use it as<slug>. - Run
git switch -c adr-NNNN-<slug>.
- Run
- Run
cp .agents/templates/adr.md docs/adr/NNNN-<slug>.mdand edit the new file:key: adr:NNNN;title: <title>;status: proposed;date:the output ofdate +%F;affects:the keys as an inline list, for exampleaffects: [repo:payments-worker, domain:payments], oraffects: [];- the heading
# ADR-NNNN: <title>; - replace the placeholder text of
## Context,## Decisionand## Consequenceswith the person's words, and add one table row| <option> | <reason> |per rejected alternative under## Alternatives. Example frontmatter and heading:
When the decision replaces an older ADR, open that older file in--- key: adr:0003 title: Use Kafka for payment events status: proposed date: 2026-09-13 affects: [repo:payments-worker, domain:payments] --- # ADR-0003: Use Kafka for payment eventsdocs/adr/and change itsstatus:line tostatus: superseded. This change goes into the same merge request as the new ADR. - If
command -v python3succeeds, runpython3 tools/generate.py. Otherwise apply## Recipe: index. - Run the check. First run
command -v python3.- When it succeeds (Python is present): run
python3 tools/check.py. Fix findings only in the files this skill changed:docs/adr/NNNN-<slug>.md,.agents/index.json, and the older ADR when you marked itsuperseded. Run it again. Stop running it when no finding names any of these files. If findings in other files remain, do not fix them; list them in the report. - When it fails (Python is missing): do not run the check. Remember the line
check not run: python3 missingfor the report.
- When it succeeds (Python is present): run
- Commit: run
git add docs/adr/NNNN-<slug>.md .agents/index.json. When you marked an older ADRsupersededin step 5, also rungit add docs/adr/<older file>.md, so it is in the same commit. Then rungit commit -m "docs(adr): propose NNNN <slug>". - Run
git pull --rebase origin <default>. Then follow## Conflicts and renumbering. - Push and open the merge request by
.agents/rules/merge-requests.md, with titleADR-NNNN: <title>and branchadr-NNNN-<slug>. - Report to the person:
- the file
docs/adr/NNNN-<slug>.md; - the branch
adr-NNNN-<slug>; - the merge request link, or the instruction to open it;
- the remaining check findings in other files, when there are any;
- as the last line, the check result, or
check not run: python3 missing.
- the file
Recipe: index
.agents/index.json lists all adr: entries first, in number order, then all diagram: entries. To add your ADR:
- Build the line
"adr:NNNN": "docs/adr/NNNN-<slug>.md": two spaces, then the entry. - Insert it directly after the last line that starts with
"adr:. When there is no such line, insert it as the first entry, directly after the line{. When the whole file is the single line{}, replace that line with three lines:{, your entry line,}, as in Example 1. - When an entry line comes before your line, make sure that entry line ends with
,; add the comma when it is missing. - When an entry line comes after your line, end your line with
,. When your line is the last entry, it has no comma. - Keep two-space indentation and no trailing spaces. The file ends with
}and a newline.
Example 1. The index is empty:
{}
After adding 0001-use-kafka:
{
"adr:0001": "docs/adr/0001-use-kafka.md"
}
Example 2. Before, with one ADR and one diagram:
{
"adr:0001": "docs/adr/0001-use-kafka.md",
"diagram:payments": "docs/diagrams/payments.md"
}
After adding 0002-split-ledger:
{
"adr:0001": "docs/adr/0001-use-kafka.md",
"adr:0002": "docs/adr/0002-split-ledger.md",
"diagram:payments": "docs/diagrams/payments.md"
}
Conflicts and renumbering
Do not run python3 tools/check.py in steps 1-4: while your number collides, check reports a duplicate number on the other ADR. Step 5 runs it after renumbering.
- List all conflicted files:
git diff --name-only --diff-filter=U. When it prints nothing, go to step 4. - First check the whole list for any file other than
.agents/index.json. If there is one:- Run
git rebase --abort. - For each such file, show the person both versions, each under its label:
Your branch:withgit diff <default>...adr-NNNN-<slug> -- <file>, andDefault branch:withgit show origin/<default>:<file>. - Stop and wait for the person. Do not touch
.agents/index.json.
- Run
- Only when
.agents/index.jsonis the sole conflicted file:- Run
git checkout --ours -- .agents/index.json. During a rebase--oursis the default branch version. - Rebuild the index: if
command -v python3succeeds, runpython3 tools/generate.py. Otherwise apply## Recipe: index, but when the file already has a line starting with"adr:NNNN"for another file, add nothing: step 4 adds your entry under a new number. - Run
git add .agents/index.json. - Run
GIT_EDITOR=true git rebase --continue. When it stops on conflicts again, go back to step 1.
- Run
- After a successful rebase, run
ls docs/adr/NNNN-*. When it shows only your file, go to step 5. When it shows another file with your number, renumber your ADR:- Choose the next free number
MMMMwith only the first two bullets of step 4 of## Steps: thels docs/adr/ | ... | cut -c1-4command, then theprintf '%04d\n'command. Keep your slug. Do not create or switch branches: stay onadr-NNNN-<slug>. - Run
git mv docs/adr/NNNN-<slug>.md docs/adr/MMMM-<slug>.md. - In that file change
key: adr:NNNNtokey: adr:MMMMand the heading to# ADR-MMMM: <title>. - Run
git grep -n "adr:NNNN". Change toadr:MMMMonly the references you added in this branch;git diff origin/<default>...HEADshows them. Leave the references to the other ADR as they are. - Update the index: if
command -v python3succeeds, runpython3 tools/generate.py. Otherwise delete the line"adr:NNNN": "docs/adr/NNNN-<slug>.md"with your slug when it is present, fix the comma of the line before it, and add"adr:MMMM": "docs/adr/MMMM-<slug>.md"by## Recipe: index. - Run
git add -A docs/adr .agents/index.jsonand every file where you changed a reference, thengit commit -m "docs(adr): renumber <slug> to MMMM". - From here on use
MMMMinstead ofNNNNin the file name, the title and the report. The branch keeps its name.
- Choose the next free number
- Run the check, only now, after step 4. First run
command -v python3.- When it succeeds (Python is present): run
python3 tools/check.py. Fix findings only in the files this skill changed: your ADR file,.agents/index.json, the older ADR when you marked itsuperseded, and every file where you changed a reference in step 4. Run it again. Stop running it when no finding names any of these files. If findings in other files remain, do not fix them; list them in the report. - When you fixed a file, run
git add <file>for each fixed file, thengit commit --amend --no-edit. - When it fails (Python is missing): do not run the check. Remember the line
check not run: python3 missingfor the report.
- When it succeeds (Python is present): run
Accepting an ADR
Acceptance usually happens later, in a new session. adr-NNNN-<slug> below is the branch of the merge request; after renumbering it keeps the old number, while the file has the new one. In steps 7 and 8 use the number of the file: after step 3, ls docs/adr/*-<slug>.md shows it. Run every command from the workspace root (step 1 of ## Steps).
- Run
git fetch origin. - Run
git switch adr-NNNN-<slug>. - Run
git pull --ff-only. - After review, in the same merge request and before merging, edit the ADR frontmatter:
- change
status: proposedtostatus: accepted; - add the line
approved: {by: <reviewer name>, date: YYYY-MM-DD}with the review date fromdate +%F.checkrejects an ADR withstatus: acceptedthat has noapprovedmark, so never set one without the other.
- change
- A replaced ADR gets
status: supersededin the merge request of the new ADR that replaces it, never in a separate one: step 5 of## Stepsedits the older file and step 8 adds it to the same commit. - Run the check. First run
command -v python3.- When it succeeds (Python is present): run
python3 tools/check.py. Fix findings only in your ADR file, the file this section changed. Run it again. Stop running it when no finding names that file. If findings in other files remain, do not fix them; list them to the person. - When it fails (Python is missing): do not run the check. Tell the person
check not run: python3 missing.
- When it succeeds (Python is present): run
- Run
git add docs/adr/NNNN-<slug>.md. - Run
git commit -m "docs(adr): accept NNNN <slug>". - Run
git push origin adr-NNNN-<slug>.
Without Python
- In step 6, and in
## Conflicts and renumbering, apply## Recipe: indexinstead ofpython3 tools/generate.py. - Skip
python3 tools/generate.pyandpython3 tools/check.pyeverywhere. - End the report with the line:
check not run: python3 missing
04 同仓库更多 Skills
verify
Use when a change in __SERVICE__ must be checked before review
work-record
Use when you finished work on a tracker task and it must be recorded in the workspace through a merge request.
task-new
Use to create one story in a stream from the stream profile's story template, link it from its scope screens and open a merge request.
task-decompose
Use to split a stream at the decomposition stage into stories - list scope screens without a story, create the accepted stories and close the stage through a merge request.
task-context
Use to gather the context of a story key or a tracker id - its story, stream stage, scope screens, repositories, decisions, mockups and work records.
repos-sync
Use to update clones of your repositories under repos/ and see their branch, lag and uncommitted changes.