From agency
Set up and maintain an Agency Knowledge Base from a GitHub repo. Covers authoring an outline, interactively refining the TOC, and generating content. Use when setting up KB, editing KB outline, or running agency-kb.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agency:kb-githubThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are the primary intelligence behind generating a knowledge base from source code. The CLI (`agency-kb`) is a thin utility — **you** do the research, exploration, outline generation, and refinement.
scripts/install.shscripts/pyproject.tomlscripts/run.shscripts/src/agency_kb/__init__.pyscripts/src/agency_kb/analyze.pyscripts/src/agency_kb/api_client.pyscripts/src/agency_kb/async_typer.pyscripts/src/agency_kb/cli.pyscripts/src/agency_kb/config.pyscripts/src/agency_kb/export.pyscripts/src/agency_kb/generate.pyscripts/src/agency_kb/init.pyscripts/src/agency_kb/repo_scanner.pyscripts/src/agency_kb/review.pyscripts/src/agency_kb/schemas.pyYou are the primary intelligence behind generating a knowledge base from source code. The CLI (agency-kb) is a thin utility — you do the research, exploration, outline generation, and refinement.
The KB is a collection of documents in Agency. Each document has a filesystem-like path (integrations/slack, admin/security/sso), content in markdown, and metadata linking it to source code via globs. Collections are created manually in the Agency UI — this skill does not create them.
Every conversation starts here. Run the status command to check what's set up:
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh status
This checks local files (config, .env, outline, PROMPT.md) and queries the remote collection. Read its output and route accordingly:
sync --all --publish to generate content for themGoal: get from zero to a published collection. Walk the user through every sub-step — don't skip ahead.
Before doing anything else, gather everything you need in a single message. Don't drip-feed questions one at a time. Ask for all of these at once:
To get started, I need a few things:
- Collection ID — from the Agency UI (see below for how to find it)
- Agency API key — from Agency settings (see below)
- Anthropic API key — from console.anthropic.com
- Product website or docs URL — so I can understand your product
How to get your Collection ID:
- In Agency, go to Knowledge in the left sidebar, then Knowledge Base
- If you don't have a collection yet: click Create New Collection, give it a name, and choose visibility (Internal = for your team's questions, Public = used in customer responses)
- Find your collection in the list, hover over it, click the ⋯ menu, and select Copy Collection ID
How to get your Agency API key:
- In Agency, go to Settings > API
- Click Create API Key, give it a name like "Knowledge Base Sync", and click Create
- Copy the key immediately — it's only shown once (note: there's no visual feedback when you click copy, but it does work)
Anthropic API key:
- Go to https://console.anthropic.com/settings/keys
- Create a new key or copy an existing one
Wait for the user to provide all of these before proceeding.
Once you have everything:
Write .agency-kb/config.yaml:
collection_id: <their-collection-id>
api_base_url: https://api.agency.inc/external
Write .agency-kb/.env:
AGENCY_API_KEY=<their-agency-key>
ANTHROPIC_API_KEY=<their-anthropic-key>
Verify .agency-kb/.env is gitignored. Check if .gitignore exists and includes .env or .agency-kb/.env. If not, add it. Tell the user: "I've added .agency-kb/.env to .gitignore to keep your keys out of version control."
You need to understand the product before writing anything.
Globapp/**/page.tsx, React Router, etc.)package.json, pyproject.toml, etc.)Write .agency-kb/PROMPT.md before the outline. This gives the LLM product-specific context when generating article content later. Include:
Example:
# Product context
Acme CRM is a sales pipeline tool for B2B teams. Users are sales reps and managers.
## Terminology
- "deal" not "opportunity"
- "pipeline" not "funnel"
- "workspace" not "organization"
## Tone
Concise, second person, practical. Like Linear or Notion help docs.
## Navigation
Main sidebar: Inbox, Pipeline, Contacts, Reporting, Settings.
## Notes
- Mobile app is in beta — don't document it yet
- Admin features are under Settings > Organization
If PROMPT.md already exists, read it and ask if the user wants to update it with what you learned from web research.
Draft the outline and present it to the user before writing JSON:
Outline rules:
integrations/slack, admin/security/sso)After the user approves, write .agency-kb/outline.json.
Run init to validate, then publish:
# Preview
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh init --collection-id=<id>
# Publish stubs (only works on empty collections)
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh init --publish
Then generate full content. Run all articles with concurrency — this is the default, don't make the user ask for it:
# Preview locally
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh sync --all
# Publish to Agency
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh sync --all --publish
Before running sync, tell the user approximately how many articles will be generated so they know what to expect in terms of time and API usage. For example: "This will generate 24 articles. With concurrency of 4, it should take a few minutes and use roughly X Anthropic API calls."
Init is complete when full content is published. Only then can the user move to sync or review.
Goal: update existing articles based on code changes.
# Incremental (only changed articles)
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh sync --publish --diff-base=origin/main
# Full regeneration
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh sync --all --publish
# Preview locally first (omit --publish)
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh sync --diff-base=origin/main
Results are saved to .agency-kb/upload/ for review before publishing. Without --publish, nothing is uploaded.
For CI (GitHub Actions):
- name: Update knowledge base
env:
AGENCY_API_KEY: ${{ secrets.AGENCY_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
pip install agency-kb
agency-kb sync --publish --diff-base=origin/main
Goal: find coverage gaps and add new articles to an existing collection.
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh review
This writes .agency-kb/review/gaps.json listing uncovered source files.
Read the gaps file and explore the uncovered source files. Not every gap needs an article — focus on user-facing features. Present proposals to the user and get approval.
For each approved article, write a .json file to .agency-kb/review/:
{
"title": "Feature Name",
"path": "category/feature-name",
"topics": ["Topic 1", "Topic 2"],
"globs": ["src/features/feature/**/*.ts"],
"source_id": "github:owner/repo:main",
"metadata": {
"source_type": "github",
"owner": "owner",
"repo": "repo",
"branch": "main",
"globs": ["src/features/feature/**/*.ts"]
}
}
Get source_id, owner, repo, branch from an existing article's metadata in .agency-kb/download/.
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh review --publish
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh sync --all --publish
| Command | What it does |
|---|---|
agency-kb status | Check local config and remote collection state |
agency-kb init | Validate config and outline, preview bootstrap artifacts |
agency-kb init --publish | Publish initial docs to an empty collection |
agency-kb sync | Export, analyze, generate locally (--path-prefix, --all, --diff-base) |
agency-kb sync --publish | Generate and upload to Agency |
agency-kb review | Scan for uncovered files, write review/gaps.json |
agency-kb review --publish | Create stub articles from proposals in review/ |
agency-kb validate-outline | Check outline.json syntax |
sh ${CLAUDE_SKILL_DIR}/scripts/run.sh <command>
Auto-installs on first use. Reads API keys from .agency-kb/.env.
sync is driven by the collection in Agency, not the local outlinenpx claudepluginhub agency-inc/skills --plugin agencyHarvests knowledge from external sources like sibling repos, local directories, files, or web URLs into the project's KB system with provenance tracking.
Bootstraps repo-local wiki knowledge system with YAML pages, raw manifests, Python scripts for validation/ingest/provenance, auto-updates, and configs for Claude Code/Cursor/Windsurf. For durable project context and wiki-first rules.
Orchestrates parallel knowledge base generation from codebases using spatial analysis, map-reduce architecture, and sub-agents for concepts, architecture, modules, and patterns. Supports feature learning from archived features.