Subagent Knowledge Profile Generator
Generate a persistent PROJECT-KNOWLEDGE.md that captures deep domain knowledge
about a codebase, designed to fit in a subagent prompt context window.
Locating your own reference files
Every references/*.md mention below is relative to this skill's own
install location, not to the project being profiled (--project) — your
working directory is the target project, so a bare relative path will not
resolve. Resolve it once, in one Bash call, at the top of the workflow:
SKILL_HOME=$(ls -d ~/.claude/plugins/cache/hideki-plugins/subagent-gen/*/skills/subagent-gen 2>/dev/null | sort -V | tail -1)
echo "$SKILL_HOME"
Re-derive $SKILL_HOME in the same Bash call as any later read — shell
state doesn't persist between separate Bash tool calls. This is also the
"skill resource dir" to pass to the synthesis subagent in Phase 3 (its own
input contract expects it as an absolute path, not a relative one).
Arguments
Parse these from the user's invocation. All are optional with defaults:
| Argument |
Default |
Description |
--project |
cwd |
Path to the project to profile |
--name |
(auto) |
Profile name — used as filename in ~/.claude/knowledge/. Auto-derived from manifest or directory name |
--output |
~/.claude/knowledge/{name}.md |
Override the canonical output path |
--update |
false |
Refresh an existing profile incrementally |
--depth |
standard |
quick (2K words), standard (4K words), deep (~6K words) |
--focus |
all |
Comma-separated subset: structure, architecture, conventions, domain |
--list |
false |
List all available profiles in ~/.claude/knowledge/ and stop |
Workflow
Phase 0: List Profiles (if --list)
If --list is passed, list all *.md files in ~/.claude/knowledge/:
ls -la ~/.claude/knowledge/*.md 2>/dev/null
For each file, parse the header line to extract project name, generation date, depth, and
source path. Display as a table:
| Profile |
Generated |
Depth |
Source Path |
| {name} |
{date} |
{depth} |
{path} |
Then stop — do not proceed to profiling.
Feedback Check
If feedback/log.md exists and has 5 or more entries, read the last 10 entries.
If a pattern is apparent (same issue in 3+ entries, or average rating below 3):
- Tell the user: "Recurring feedback detected: [brief pattern]. Consider running
/skill-improve --skill subagent-gen."
- Continue with normal execution.
Phase 1: Identify Target Project
- Use
--project path or current working directory
- Verify it contains source files (not empty or config-only)
- Derive
--name if not provided:
- Read
package.json → use name field
- Read
pyproject.toml → use [project] name
- Read
Cargo.toml → use [package] name
- Fallback: use the directory basename, lowercased, hyphens for spaces
- If
--update, check for existing profile at ~/.claude/knowledge/{name}.md first,
then fall back to .agent/local/PROJECT-KNOWLEDGE.md
- Read
.gitignore to understand exclusion patterns
If the directory is empty or has no source files, report "No source files found" and stop.
Phase 2: Reconnaissance (Inline)
Quick inline scan — no subagents needed. Gather metadata for Phase 3.
- Read root manifests: Look for
package.json, pyproject.toml, Cargo.toml, go.mod,
pom.xml, build.gradle, *.sln, *.csproj, Gemfile, composer.json, mix.exs,
CMakeLists.txt, Makefile, Dockerfile, docker-compose.yml
- Directory tree: Use Glob/Bash to map top 3 levels of the directory tree
- File census: Count source files vs test files vs config files by extension
- Detect stack: From manifests, identify:
- Primary language(s) and version(s)
- Framework(s)
- Build system / package manager
- Test runner(s)
- Whether it's a monorepo (multiple package.json / workspace config)
Produce a metadata block in this format to pass to Phase 3 agents:
PROJECT METADATA
================
Name: {project name from manifest}
Path: {absolute path}
Language(s): {e.g., TypeScript 85%, Python 15%}
Framework(s): {e.g., Next.js 14, FastAPI}
Build: {e.g., pnpm, turborepo}
Test runner: {e.g., vitest, pytest}
Monorepo: {yes/no — packages: ...}
Source dirs: {e.g., src/, api/, packages/}
Test dirs: {e.g., __tests__/, tests/, e2e/}
File count: {e.g., 342 source, 89 test, 45 config}
Phase 3: Parallel Deep Exploration
Read "$SKILL_HOME"/references/exploration-dimensions.md for the full pattern catalog for each dimension.
Spawn Explore-type subagents in parallel. Each agent receives:
- The project path
- The metadata block from Phase 2
- Its specific exploration instructions from the dimension catalog
Agent Configuration by Depth
--depth=quick — 2 agents:
| Agent |
Combined Dimensions |
| structure-architecture |
Structure + Architecture: directory layout, entry points, module boundaries, how modules connect, data flow, layering |
| conventions-domain |
Conventions + Domain: naming patterns, error handling, key abstractions, API surface, config |
--depth=standard — 4 agents:
| Agent |
Dimension |
| structure-agent |
Directory layout, entry points, module boundaries, build outputs |
| architecture-agent |
Module connections, dependency graph, data flow, layering, state management |
| conventions-agent |
Naming patterns, error handling, logging, validation, testing patterns |
| domain-agent |
Business/domain concepts, key abstractions, API surface, configuration |
--depth=deep — 4 agents with expanded scope:
Same agents as standard, but each samples more files (20-30 instead of 10-15) and traces
deeper dependency chains. Architecture agent also maps middleware chains and plugin systems.
Agent Prompt Template
For each agent, construct a prompt like:
You are analyzing a codebase to build a deep knowledge profile.
PROJECT METADATA
================
{paste metadata block from Phase 2}
YOUR DIMENSION: {dimension name}
=================================
{paste the relevant section from "$SKILL_HOME"/references/exploration-dimensions.md}
INSTRUCTIONS:
- Explore the project at {project path}
- Follow the exploration patterns and grep signals listed above
- Sample {10-15 | 20-30} files across different directories
- For every finding, include the concrete file path and specific detail
- Do NOT include vague descriptions — every bullet must have a file path or function name
- Output your findings in the exact markdown format specified in the dimension catalog
Report back your findings as a structured markdown block.
Focus Filtering
If --focus is set to specific dimensions (e.g., --focus=structure,domain), only spawn agents
for those dimensions. Skip the others.
Monorepo Handling
If the project is a monorepo with multiple packages:
- Ask the user which package(s) to profile, or whether to profile the root structure
- If profiling specific packages, scope each agent's exploration to those package directories
- If profiling root, focus on workspace config, shared utilities, and cross-package patterns
Large Project Handling (>5000 files)
- Warn the user about project size
- Suggest using
--focus to narrow scope
- Instruct agents to use sampling: read representative files from each directory rather than
exhaustive scans
- Cap the number of files each agent reads to 30
Phase 4: Synthesize Profile (delegated)
Hand the metadata block + all collected agent findings to
@agent-subagent-gen:subagent-gen along with:
- target depth (
quick / standard / deep)
--focus filter
--output path
--update flag (if set)
- the skill resource dir so the subagent can read
"$SKILL_HOME"/references/profile-template.md
and "$SKILL_HOME"/references/prompt-integration-guide.md
The subagent does the synthesis, quality-checks every bullet (every line
must carry a file path / identifier / pattern name / concrete value),
enforces word-count targets, preserves <!-- USER: ... --> blocks in
update mode, writes the profile to the canonical path, and creates the
.agent/local/PROJECT-KNOWLEDGE.md symlink (falling back to copy on
Windows without Developer Mode).
The subagent returns:
{
"profile_path_global": "~/.claude/knowledge/{name}.md",
"profile_path_local": ".agent/local/PROJECT-KNOWLEDGE.md",
"word_count": 4123,
"depth": "standard",
"sections_preserved_from_user": ["..."],
"key_findings": ["..."],
"gitignore_suggestion": ".agent/local/"
}
Phase 5: Present Summary
Use the subagent's return value to show the user:
- Profile name and word count
- Global path:
~/.claude/knowledge/{name}.md (accessible from any project)
- Local path:
.agent/local/PROJECT-KNOWLEDGE.md (symlinked for convenience)
- 3-5 key findings highlights (most interesting / non-obvious)
- If
gitignore_suggestion came back, mention adding .agent/local/ to
.gitignore
- How to use the profile (read
"$SKILL_HOME"/references/prompt-integration-guide.md):
- Same project:
Read .agent/local/PROJECT-KNOWLEDGE.md for context, then: <task>
- Cross-project:
Read ~/.claude/knowledge/{name}.md for context, then: <task>
- List all profiles:
/subagent-gen --list
Error Handling
| Situation |
Behavior |
| Empty directory / no source files |
Report and stop |
| Monorepo detected |
Ask user which packages to focus on |
| Very large project (>5000 files) |
Warn, suggest --focus, use sampling |
--update but no existing profile |
Fall back to fresh generation |
| Agent exploration fails or times out |
Report partial results, note incomplete dimensions |
| Unrecognized language/framework |
Profile what can be inferred from file structure and naming |
| Symlink creation fails (Windows) |
Copy the file instead, warn about manual sync |
--name conflicts with existing profile |
Ask user to confirm overwrite or choose a different name |
~/.claude/knowledge/ doesn't exist |
Create it automatically |
Retrospective
After completing the workflow, reflect on the entire execution session:
- Consider: Were there mid-session corrections? Rejected outputs? Plan changes? Errors?
- Ask the user: "Quick feedback on this run? (1-5 rating, note any issues, or press enter to skip)"
- If the user provides feedback OR if corrections/issues occurred during this session:
a. Create
feedback/ directory if it does not exist (header: # Feedback Log + blank
line + <!-- Append new entries at the top. Do not edit previous entries. -->)
b. Prepend a new entry after the header:## <ISO-8601 timestamp>
- **Skill Version**: <version from this file's frontmatter>
- **Task**: <brief description>
- **Outcome**: success | partial-success | failure | error
- **Rating**: <N>/5 (or "—" if not provided)
- **Corrections**: <mid-session corrections, or "none">
- **Issues**: <specific problems, or "none">
- **User Note**: <user's verbatim feedback, or "—">
---
- If the user skips AND no corrections or issues occurred, end without recording.
Behavior Scenarios
Scenario: Generate fresh profile for a standard project
Given the user is in a project directory with source code and no existing profile
When the user says "profile this project" or "generate project knowledge"
Then the skill scans the project, launches parallel exploration agents,
synthesizes findings into PROJECT-KNOWLEDGE.md, saves to .agent/local/,
and shows how to use the profile in subagent prompts
Scenario: Update an existing profile after codebase changes
Given a PROJECT-KNOWLEDGE.md already exists in .agent/local/
When the user says "update project profile" or invokes with --update
Then the skill reads the existing profile, focuses exploration on changed files,
preserves user-customized sections (<!-- USER: ... -->), regenerates machine
sections, and shows what changed
Scenario: Quick profile for a small task
Given the user needs a lightweight profile fast
When the user says "quick project profile" or invokes with --depth=quick
Then the skill runs 2 combined agents, produces a ~2000-word profile,
and completes faster than standard depth
Scenario: Profile a specific project path (not cwd)
Given the user wants to profile a project in a different directory
When the user says "profile project at D:\Projects\my-app"
Then the skill uses the specified path as the project root for all exploration
Scenario: Very large monorepo project
Given the project has over 5000 files or is a monorepo with multiple packages
When the user invokes the skill
Then the skill warns about size, asks which packages to focus on (if monorepo),
uses sampling strategies to stay within token budget, and generates a profile
scoped to the selected packages
Scenario: Use a profile from another project
Given the user has profiled Project A and is now working in Project B
When the user spawns a subagent with "Read ~/.claude/knowledge/project-a.md for context"
Then the subagent has deep knowledge of Project A while working in Project B
Scenario: List all available profiles
Given the user has generated profiles for multiple projects
When the user says "list project profiles" or invokes with --list
Then the skill lists all profiles in ~/.claude/knowledge/ with name, date, and source path
References
"$SKILL_HOME"/references/exploration-dimensions.md — Pattern catalog for each exploration dimension (what to look for, grep signals, sampling strategy, output format)
"$SKILL_HOME"/references/profile-template.md — Exact PROJECT-KNOWLEDGE.md template with section specs and placeholder examples
"$SKILL_HOME"/references/prompt-integration-guide.md — How to load the generated profile into subagent prompts (inclusion patterns, selective loading, examples)
1---2name: subagent-gen3description: Generate a persistent PROJECT-KNOWLEDGE.md profile for any codebase that gives subagents instant deep domain expertise. Analyzes project structure, architecture, code conventions, tech stack, data flow, and domain concepts. The profile is designed to be loaded into Agent tool prompts so subagents can answer deep codebase questions like an expert teammate. Use when the user asks to profile a project, generate project knowledge, create a codebase profile, build a context pack, analyze a codebase for subagents, or says "profile this project". Trigger phrases include "profile project", "generate project knowledge", "codebase profile", "subagent context", "knowledge profile", "project profile", "profile this codebase", "build project knowledge", "create context pack", "generate codebase knowledge", "index this project", "make subagent", "generate subagent", "deep knowledge", "project expert".4---56# Subagent Knowledge Profile Generator78Generate a persistent PROJECT-KNOWLEDGE.md that captures deep domain knowledge9about a codebase, designed to fit in a subagent prompt context window.1011## Locating your own reference files1213Every `references/*.md` mention below is relative to this skill's own14install location, not to the project being profiled (`--project`) — your15working directory is the target project, so a bare relative path will not16resolve. Resolve it once, in one Bash call, at the top of the workflow:1718```bash19SKILL_HOME=$(ls -d ~/.claude/plugins/cache/hideki-plugins/subagent-gen/*/skills/subagent-gen 2>/dev/null | sort -V | tail -1)20echo "$SKILL_HOME"21```2223Re-derive `$SKILL_HOME` in the same Bash call as any later read — shell24state doesn't persist between separate Bash tool calls. This is also the25"skill resource dir" to pass to the synthesis subagent in Phase 3 (its own26input contract expects it as an absolute path, not a relative one).2728## Arguments2930Parse these from the user's invocation. All are optional with defaults:3132| Argument | Default | Description |33|----------|---------|-------------|34| `--project` | cwd | Path to the project to profile |35| `--name` | (auto) | Profile name — used as filename in `~/.claude/knowledge/`. Auto-derived from manifest or directory name |36| `--output` | `~/.claude/knowledge/{name}.md` | Override the canonical output path |37| `--update` | `false` | Refresh an existing profile incrementally |38| `--depth` | `standard` | `quick` (~2K words), `standard` (~4K words), `deep` (~6K words) |39| `--focus` | `all` | Comma-separated subset: structure, architecture, conventions, domain |40| `--list` | `false` | List all available profiles in `~/.claude/knowledge/` and stop |4142## Workflow4344### Phase 0: List Profiles (if `--list`)4546If `--list` is passed, list all `*.md` files in `~/.claude/knowledge/`:4748```bash49ls -la ~/.claude/knowledge/*.md 2>/dev/null50```5152For each file, parse the header line to extract project name, generation date, depth, and53source path. Display as a table:5455| Profile | Generated | Depth | Source Path |56|---------|-----------|-------|-------------|57| {name} | {date} | {depth} | {path} |5859Then stop — do not proceed to profiling.6061### Feedback Check6263If `feedback/log.md` exists and has 5 or more entries, read the last 10 entries.64If a pattern is apparent (same issue in 3+ entries, or average rating below 3):65- Tell the user: "Recurring feedback detected: [brief pattern]. Consider running `/skill-improve --skill subagent-gen`."66- Continue with normal execution.6768### Phase 1: Identify Target Project69701. Use `--project` path or current working directory712. Verify it contains source files (not empty or config-only)723. **Derive `--name`** if not provided:73 - Read `package.json` → use `name` field74 - Read `pyproject.toml` → use `[project] name`75 - Read `Cargo.toml` → use `[package] name`76 - Fallback: use the directory basename, lowercased, hyphens for spaces774. If `--update`, check for existing profile at `~/.claude/knowledge/{name}.md` first,78 then fall back to `.agent/local/PROJECT-KNOWLEDGE.md`795. Read `.gitignore` to understand exclusion patterns8081If the directory is empty or has no source files, report "No source files found" and stop.8283### Phase 2: Reconnaissance (Inline)8485Quick inline scan — no subagents needed. Gather metadata for Phase 3.86871. **Read root manifests**: Look for `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`,88 `pom.xml`, `build.gradle`, `*.sln`, `*.csproj`, `Gemfile`, `composer.json`, `mix.exs`,89 `CMakeLists.txt`, `Makefile`, `Dockerfile`, `docker-compose.yml`902. **Directory tree**: Use Glob/Bash to map top 3 levels of the directory tree913. **File census**: Count source files vs test files vs config files by extension924. **Detect stack**: From manifests, identify:93 - Primary language(s) and version(s)94 - Framework(s)95 - Build system / package manager96 - Test runner(s)97 - Whether it's a monorepo (multiple package.json / workspace config)9899Produce a **metadata block** in this format to pass to Phase 3 agents:100101```102PROJECT METADATA103================104Name: {project name from manifest}105Path: {absolute path}106Language(s): {e.g., TypeScript 85%, Python 15%}107Framework(s): {e.g., Next.js 14, FastAPI}108Build: {e.g., pnpm, turborepo}109Test runner: {e.g., vitest, pytest}110Monorepo: {yes/no — packages: ...}111Source dirs: {e.g., src/, api/, packages/}112Test dirs: {e.g., __tests__/, tests/, e2e/}113File count: {e.g., 342 source, 89 test, 45 config}114```115116### Phase 3: Parallel Deep Exploration117118Read `"$SKILL_HOME"/references/exploration-dimensions.md` for the full pattern catalog for each dimension.119120Spawn Explore-type subagents in parallel. Each agent receives:121- The project path122- The metadata block from Phase 2123- Its specific exploration instructions from the dimension catalog124125#### Agent Configuration by Depth126127**`--depth=quick`** — 2 agents:128129| Agent | Combined Dimensions |130|-------|-------------------|131| structure-architecture | Structure + Architecture: directory layout, entry points, module boundaries, how modules connect, data flow, layering |132| conventions-domain | Conventions + Domain: naming patterns, error handling, key abstractions, API surface, config |133134**`--depth=standard`** — 4 agents:135136| Agent | Dimension |137|-------|-----------|138| structure-agent | Directory layout, entry points, module boundaries, build outputs |139| architecture-agent | Module connections, dependency graph, data flow, layering, state management |140| conventions-agent | Naming patterns, error handling, logging, validation, testing patterns |141| domain-agent | Business/domain concepts, key abstractions, API surface, configuration |142143**`--depth=deep`** — 4 agents with expanded scope:144Same agents as standard, but each samples more files (20-30 instead of 10-15) and traces145deeper dependency chains. Architecture agent also maps middleware chains and plugin systems.146147#### Agent Prompt Template148149For each agent, construct a prompt like:150151```152You are analyzing a codebase to build a deep knowledge profile.153154PROJECT METADATA155================156{paste metadata block from Phase 2}157158YOUR DIMENSION: {dimension name}159=================================160{paste the relevant section from "$SKILL_HOME"/references/exploration-dimensions.md}161162INSTRUCTIONS:163- Explore the project at {project path}164- Follow the exploration patterns and grep signals listed above165- Sample {10-15 | 20-30} files across different directories166- For every finding, include the concrete file path and specific detail167- Do NOT include vague descriptions — every bullet must have a file path or function name168- Output your findings in the exact markdown format specified in the dimension catalog169170Report back your findings as a structured markdown block.171```172173#### Focus Filtering174175If `--focus` is set to specific dimensions (e.g., `--focus=structure,domain`), only spawn agents176for those dimensions. Skip the others.177178#### Monorepo Handling179180If the project is a monorepo with multiple packages:1811. Ask the user which package(s) to profile, or whether to profile the root structure1822. If profiling specific packages, scope each agent's exploration to those package directories1833. If profiling root, focus on workspace config, shared utilities, and cross-package patterns184185#### Large Project Handling (>5000 files)1861871. Warn the user about project size1882. Suggest using `--focus` to narrow scope1893. Instruct agents to use sampling: read representative files from each directory rather than190 exhaustive scans1914. Cap the number of files each agent reads to 30192193### Phase 4: Synthesize Profile (delegated)194195Hand the metadata block + all collected agent findings to196`@agent-subagent-gen:subagent-gen` along with:197198- target depth (`quick` / `standard` / `deep`)199- `--focus` filter200- `--output` path201- `--update` flag (if set)202- the skill resource dir so the subagent can read `"$SKILL_HOME"/references/profile-template.md`203 and `"$SKILL_HOME"/references/prompt-integration-guide.md`204205The subagent does the synthesis, quality-checks every bullet (every line206must carry a file path / identifier / pattern name / concrete value),207enforces word-count targets, preserves `<!-- USER: ... -->` blocks in208update mode, writes the profile to the canonical path, and creates the209`.agent/local/PROJECT-KNOWLEDGE.md` symlink (falling back to copy on210Windows without Developer Mode).211212The subagent returns:213214```json215{216 "profile_path_global": "~/.claude/knowledge/{name}.md",217 "profile_path_local": ".agent/local/PROJECT-KNOWLEDGE.md",218 "word_count": 4123,219 "depth": "standard",220 "sections_preserved_from_user": ["..."],221 "key_findings": ["..."],222 "gitignore_suggestion": ".agent/local/"223}224```225226### Phase 5: Present Summary227228Use the subagent's return value to show the user:229230- Profile name and word count231- **Global path**: `~/.claude/knowledge/{name}.md` (accessible from any project)232- **Local path**: `.agent/local/PROJECT-KNOWLEDGE.md` (symlinked for convenience)233- 3-5 key findings highlights (most interesting / non-obvious)234- If `gitignore_suggestion` came back, mention adding `.agent/local/` to235 `.gitignore`236- How to use the profile (read `"$SKILL_HOME"/references/prompt-integration-guide.md`):237 - **Same project**: `Read .agent/local/PROJECT-KNOWLEDGE.md for context, then: <task>`238 - **Cross-project**: `Read ~/.claude/knowledge/{name}.md for context, then: <task>`239 - **List all profiles**: `/subagent-gen --list`240241## Error Handling242243| Situation | Behavior |244|-----------|----------|245| Empty directory / no source files | Report and stop |246| Monorepo detected | Ask user which packages to focus on |247| Very large project (>5000 files) | Warn, suggest `--focus`, use sampling |248| `--update` but no existing profile | Fall back to fresh generation |249| Agent exploration fails or times out | Report partial results, note incomplete dimensions |250| Unrecognized language/framework | Profile what can be inferred from file structure and naming |251| Symlink creation fails (Windows) | Copy the file instead, warn about manual sync |252| `--name` conflicts with existing profile | Ask user to confirm overwrite or choose a different name |253| `~/.claude/knowledge/` doesn't exist | Create it automatically |254255### Retrospective256257After completing the workflow, reflect on the entire execution session:2582591. Consider: Were there mid-session corrections? Rejected outputs? Plan changes? Errors?2602. Ask the user: "Quick feedback on this run? (1-5 rating, note any issues, or press enter to skip)"2613. If the user provides feedback OR if corrections/issues occurred during this session:262 a. Create `feedback/` directory if it does not exist (header: `# Feedback Log` + blank263 line + `<!-- Append new entries at the top. Do not edit previous entries. -->`)264 b. Prepend a new entry after the header:265 ```markdown266 ## <ISO-8601 timestamp>267 - **Skill Version**: <version from this file's frontmatter>268 - **Task**: <brief description>269 - **Outcome**: success | partial-success | failure | error270 - **Rating**: <N>/5 (or "—" if not provided)271 - **Corrections**: <mid-session corrections, or "none">272 - **Issues**: <specific problems, or "none">273 - **User Note**: <user's verbatim feedback, or "—">274 ---275 ```2764. If the user skips AND no corrections or issues occurred, end without recording.277278## Behavior Scenarios279280```gherkin281Scenario: Generate fresh profile for a standard project282 Given the user is in a project directory with source code and no existing profile283 When the user says "profile this project" or "generate project knowledge"284 Then the skill scans the project, launches parallel exploration agents,285 synthesizes findings into PROJECT-KNOWLEDGE.md, saves to .agent/local/,286 and shows how to use the profile in subagent prompts287288Scenario: Update an existing profile after codebase changes289 Given a PROJECT-KNOWLEDGE.md already exists in .agent/local/290 When the user says "update project profile" or invokes with --update291 Then the skill reads the existing profile, focuses exploration on changed files,292 preserves user-customized sections (<!-- USER: ... -->), regenerates machine293 sections, and shows what changed294295Scenario: Quick profile for a small task296 Given the user needs a lightweight profile fast297 When the user says "quick project profile" or invokes with --depth=quick298 Then the skill runs 2 combined agents, produces a ~2000-word profile,299 and completes faster than standard depth300301Scenario: Profile a specific project path (not cwd)302 Given the user wants to profile a project in a different directory303 When the user says "profile project at D:\Projects\my-app"304 Then the skill uses the specified path as the project root for all exploration305306Scenario: Very large monorepo project307 Given the project has over 5000 files or is a monorepo with multiple packages308 When the user invokes the skill309 Then the skill warns about size, asks which packages to focus on (if monorepo),310 uses sampling strategies to stay within token budget, and generates a profile311 scoped to the selected packages312313Scenario: Use a profile from another project314 Given the user has profiled Project A and is now working in Project B315 When the user spawns a subagent with "Read ~/.claude/knowledge/project-a.md for context"316 Then the subagent has deep knowledge of Project A while working in Project B317318Scenario: List all available profiles319 Given the user has generated profiles for multiple projects320 When the user says "list project profiles" or invokes with --list321 Then the skill lists all profiles in ~/.claude/knowledge/ with name, date, and source path322```323324## References325326- `"$SKILL_HOME"/references/exploration-dimensions.md` — Pattern catalog for each exploration dimension (what to look for, grep signals, sampling strategy, output format)327- `"$SKILL_HOME"/references/profile-template.md` — Exact PROJECT-KNOWLEDGE.md template with section specs and placeholder examples328- `"$SKILL_HOME"/references/prompt-integration-guide.md` — How to load the generated profile into subagent prompts (inclusion patterns, selective loading, examples)