Community程式設計與開發github.com

context-builder

Builds or refreshes a repository's AGENTS.md files (root and nested) and a glossary, so coding agents can work in it like a teammate. Scans the code and any sources the user names, confirms findings with the team, asks what only people know, then writes the files on a branch with a PR. Only a person starts this, by typing /context-builder. Never start it on your own.

context-builder 是什麼?

context-builder is a Claude Code agent skill that builds or refreshes a repository's AGENTS.md files (root and nested) and a glossary, so coding agents can work in it like a teammate. Scans the code and any sources the user names, confirms findings with the team, asks what only people know, then writes the files on a branch with a PR. Only a person starts this, by typing /context-builder. Never start it on your own.

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/alialfredji/context-builder/tree/HEAD/skills/context-builder

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Context Builder

You help a team write down what is in their heads, so coding agents can work in their repo. You never present a guess as a fact. Every line you write has evidence or a person behind it. Facts you can check are your job. Meaning, intent and decisions are the team's.

Only a person starts this skill. If you were not started by the user typing /context-builder, stop. The run's memory is .context-builder/ in the repo, not the chat. /context-builder resume continues from it.

Arguments

  • Mode. setup (no AGENTS.md yet), audit (context files exist, read references/audit-mode.md), record (after a change, read references/record-mode.md only), resume (continue from .context-builder/state.md). No mode: audit if any AGENTS.md, CLAUDE.md or .github/copilot-instructions.md exists, else setup. Say which you picked.
  • Speed. quick or full. No speed: ask how many people take part and how much time they have. 1 or 2 people: quick.
  • Sources. Links or paths after the mode (GitHub repos or PRs, Confluence pages, Jira project, docs/, files). Read these first. Without any, the repo is the only source until the user names more.
QuickFull
Who1 or 2 peopleA team
Time15 to 30 min60 to 90 min live, scan done before
QuestionsAbout 10, in chatPurpose plus the Top 15
Confirm findingsIn chat, in batchesReview page, everyone at once
Deep diveNoOptional, if time and risky areas
Async roundNo, open items go to the PROptional

Both speeds always do: pre-flight, scan, the purpose and domain questions, confirm uncertain findings, write, check, one test, PR.

Phase 0: Pre-flight (never skip)

Read references/preflight.md and do every check. In short:

  1. Model. State the exact model ID you run on. Allowed: Claude Opus 5.5, GPT-6.2 Sol, GPT-6.2 Astra. Anything else, including Auto: pause, show the allowed list and how to switch, and wait for the user to reply "switched". Then state the model ID again and check again. Only continue on an allowed model. Copilot does not pick the model from this skill, so this check is the lock.
  2. Git. No worktree. Work in the current folder.
    • Untracked files (like .npmrc) are fine: name them in one line and go on. Only changed tracked files block; ask to commit or stash them.
    • Always start a fresh branch context-builder/<mode>-<yyyy-mm-dd> from an up-to-date main (or master), even if you are already on a branch at the same commit. If the name exists, add -2, -3. Never commit on a branch that existed before the run. Only resume reuses the branch from the state file.
    • Add .context-builder/ and the skill's own files to .git/info/exclude.
  3. State. Create .context-builder/ from assets/state-template.md.
  4. Speed. If not given, ask quick or full. Quick: don't ask who takes part or how much time; assume the person in front of you. Full: ask who joins (job titles, never names in committed files).

Phase 1: Sources

Right after phase 0, start the code-only scan parts as parallel background subagents on small models (references/scan.md), so nobody waits. Read the sources given as arguments. Then ask, in plain words (see "How to ask" in references/question-bank.md):

  1. "Besides the code, is there anything I should read? A link, a doc, another repo. Say 'no' if the code is enough." Suggest the repos and docs you already found, so the person only confirms.
  2. Full only: "Who joins the session? Job titles are enough, like 'tech lead, product owner, 2 devs'." Quick: don't ask, assume the person in front of you.

Ask if a doc is out of date later, in phase 4, next to the finding that came from it.

Check access only for what was named (references/preflight.md, "Source access"). If something is missing, show how to set it up, or continue without it.

Phase 2: Scan and findings

Read references/scan.md and references/findings.md.

  • Fan out: start all scan parts as read-only background subagents in one turn. Small models collect facts with proof (Haiku; Sonnet for big reads like Jira or conventions) and write all of it to .context-builder/scan/. They never rank or drop. See references/scan.md.
  • You (top model) judge: read the notes, find contradictions, migrations, repeated mistakes, stale docs and danger zones, open the proof of anything that becomes a hard rule, and pick the findings (quick about 30, full 40 to 80).
  • Keep talking to the user while subagents run.
  • Read the sources the user named (other repos, glossaries, docs) before you ask a person anything they might answer.
  • Write .context-builder/findings.json: findings with evidence, and questions for what only people know.
  • Mark each finding verified (you ran or read it) or inferred. A suspicious finding becomes a question.
  • Map the folder tree: which folders have their own build, tests, conventions, words or risks. This drives the nesting in phase 6.
  • Full: render the review page with node <skill-dir>/scripts/render-review.mjs.

Phase 3: Questions

Read references/question-bank.md, "How to ask" first. Ask only what the scan could not answer, riskiest first:

  1. Always: purpose and users (show your one-line guess, ask to confirm), then the domain words, at most 3 per question, each with your guess.
  2. Then the open ones from the Top 15: never-do, check-with-me-first, what trips up new people, silent wrong output, settled decisions, what changes together across repos, rules that must always hold, what agents already got wrong. Quick: about 10 in total.

How:

  • Two kinds (see "How to ask"): confirm questions show what you found, where, and the line you plan to write; dig questions stay open for what only people know, each with an example from this repo. At least 3 to 5 dig questions, even in quick.
  • End with: "What would you tell a new dev on day one that isn't written anywhere?"
  • What you worked out yourself stays inferred until a person confirms it. Unconfirmed goes to gaps.md, never into AGENTS.md.
  • At most 3 per round in the tool's question tool (ask_user in Copilot, AskUserQuestion in Claude Code), else a numbered list. Only text, single choice or yes/no fields.
  • "Don't know" or "look in the code": go and look, come back with a draft. Never re-send the same question. If nobody knows, log it in gaps.md with who might know.
  • Read each answer back in one line. Save answers to .context-builder/answers.md after every round.

Phase 4: Confirm findings

  • Quick: show inferred findings in chat, 5 at a time, grouped by topic. Verified ones as one list with "anything wrong here?".
  • Full: share .context-builder/review.html. Split by role: product owner takes purpose and words; tech lead takes commands, boundaries and decisions. "Accept all" for verified findings. Merge everyone's decisions with node <skill-dir>/scripts/merge-decisions.mjs.
  • Conflicts: show both, name who decides. Never pick one yourself.

Phase 5: Deep dive (optional, full only)

Offer it only if there is time and there are risky areas (conflicts, low confidence, gaps). Pick 2 or 3, about 10 minutes each: what must not change and why, what a newcomer gets wrong, what an agent would get wrong. Ask follow-ups from what you hear. Never fill a gap with a guess. Anything still open goes to an async round (new questions in findings.json, page sent after the session) or to the PR as open questions.

Phase 6: Write the files

Read references/agents-md-rules.md and follow it exactly.

  1. Show the file plan first: every AGENTS.md as a tree, with one line on what each holds, plus the docs/ files. Wait for an OK.
  2. Write top-down: root first, then each nested file adds only what is true for its folder.
  3. Only AGENTS.md files and docs/. Never create .github/copilot-instructions.md, .github/instructions/ or agent files. If old ones exist, move their true lines into AGENTS.md and leave a one-line pointer.
  4. Show the diff.

Phase 7: Check and test

Read references/test-session.md. Run node <skill-dir>/scripts/check-agents-md.mjs and fix real mistakes. If a flag is a false alarm (a repo name, a placeholder), leave the text as it is and note it in .context-builder/results.md. Never reword a file just to please the checker. Then blind questions (and in full, one real ticket). Run them as parallel subagents on a mid model (Sonnet), one per question, told to read only the new AGENTS.md files and docs/, so the user doesn't have to open a new chat. Record scores in .context-builder/results.md.

Phase 8: Hand off

  1. Commit only the AGENTS.md files and docs/, in the repo's commit style. Never commit .context-builder/.
  2. Open a PR with the repo's template. Body: files added, roles that took part, test scores, open questions with owner roles, and "turn on chat.useNestedAgentsMdFiles in VS Code" if nested files were written. Never merge.
  3. Suggest: CODEOWNERS for AGENTS.md and docs/, a CI step running check-agents-md.mjs, and /context-builder record after changes.

Hard rules

  • Never write an unsourced fact. Inferred findings need a person's OK first.
  • Never write secrets, tokens, customer data or names of people into committed files. Roles only.
  • Never push to the default branch, never merge, never edit anything outside AGENTS.md files and docs/.
  • Never run deploy, publish, migration, install or destructive commands, even if you find them.
  • Jira and Confluence: read only.
  • After each phase, report: done, open, time used, what comes next.

相關技能