بنقرة واحدة
index
Use when indexing codebase components or external resources for future specs.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when indexing codebase components or external resources for future specs.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when a spec has tasks.md and should enter autonomous task execution.
Use when starting curdx-flow, creating a spec, resuming work, or routing intent.
Use when handling curdx-flow flags, state files, delegation, execution loops, or skill entrypoint rules.
Use when curdx-flow needs user decisions after codebase facts are discovered.
Use when a spec has design.md and needs implementation tasks.
Use when showing curdx-flow slash skills, options, workflow, or troubleshooting.
| name | index |
| description | Use when indexing codebase components or external resources for future specs. |
| argument-hint | [--path=dir] [--type=types] [--exclude=patterns] [--dry-run] [--force] [--changed] [--quick] |
| allowed-tools | Read Write Agent Bash AskUserQuestion Glob Grep WebFetch ListMcpResourcesTool |
| disable-model-invocation | true |
You are running the codebase indexing command. This scans the repository to generate component specs in specs/.index/.
Use native task UI tracking if TaskCreate is available; otherwise keep this checklist inline:
Parse from $ARGUMENTS:
| Option | Format | Default | Description |
|---|---|---|---|
--path | --path=<dir> | Project root | Limit scan to directory |
--type | --type=<types> | All | Comma-separated: controllers,services,models,helpers,migrations |
--exclude | --exclude=<patterns> | See below | Comma-separated exclude patterns |
--dry-run | Flag | false | Preview without writing |
--force | Flag | false | Regenerate all (ignore existing) |
--changed | Flag | false | Only git-changed files |
--quick | Flag | false | Skip interviews, batch only |
Default excludes: node_modules, vendor, dist, build, .git, __pycache__, *.test.*, *.spec.*, *_test.*, test/, tests/, spec/, specs/
Validation: --force + --changed together is an error. --path must exist. --type values must be valid. --changed requires git (git rev-parse --git-dir).
Generate the cheap topology cache before component scanning:
mkdir -p specs/.index
node "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/lib/project-topology.mjs" \
--goal "$ARGUMENTS" > specs/.index/project-topology.json
node "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/lib/project-topology.mjs" \
--goal "$ARGUMENTS" \
--format context-map > specs/.index/context-map.md
Use this snapshot to decide which roots are relevant. If project-topology.json contains missingRoots, stop indexing and show the accessFix value exactly.
Ask via AskUserQuestion:
| # | Question | Key |
|---|---|---|
| 1 | External documentation URLs to index? | externalUrls |
| 2 | MCP servers or skills to document? | externalTools |
| 3 | Specific directories to focus on? | focusAreas |
| 4 | Code areas lacking comments needing extra attention? | sparseAreas |
Store responses in ./specs/.index/.index-state.json under interviewResponses.
| Category | Glob Pattern | File Pattern |
|---|---|---|
| Controllers | **/controllers/**/*.{ts,js,py,go} | *controller*, *Controller* |
| Services | **/services/**/*.{ts,js,py,go} | *service*, *Service* |
| Models | **/models/**/*.{ts,js,py,go} | *model*, *Model* |
| Helpers | **/helpers/**/*.{ts,js,py,go} | *helper*, *Helper*, *util* |
| Migrations | **/migrations/**/*.{ts,js,sql} | *migration* |
--type if set), run Glob with --path as base. If no --path is provided, scan each accessible code root from project-topology.json. Filter out excludes.--changed: filter to git diff --name-only HEAD results only--force and spec exists: compare SHA-256 hash (first 8 chars via shasum -a 256), skip if unchangedexport (const|function|class|interface|type) \w+ (TS/JS), ^def \w+\( / ^class \w+ (Python), ^func \w+\( (Go)Process resources from interview responses. Classify each: URL (http(s)://), MCP server (mcp-*/mcp_*), or Skill (/ prefix or contains "skill").
For each URL in externalUrls:
templates/external-spec.mdspecs/.index/external/url-<sanitized-name>.mdFor each MCP server in externalTools:
specs/.index/external/mcp-<server-name>.mdFor each skill in externalTools:
plugins/*/.claude-plugin/plugin.jsonspecs/.index/external/skill-<plugin>-<command>.mdPattern: <type>-<sanitized-name>.md. Sanitize: lowercase, replace non-alphanumeric with hyphens, collapse consecutive hyphens, max 50 chars.
Ensure directories: mkdir -p specs/.index/components specs/.index/external
For each scanned component:
--dry-run: collect for preview, do NOT writetemplates/component-spec.md, fill template variables:
{{SOURCE_PATH}}, {{CONTENT_HASH}}, {{CATEGORY}}, {{TIMESTAMP}}{{COMPONENT_NAME}}, {{AUTO_GENERATED_SUMMARY}}, {{EXPORTS}}, {{METHODS}}{{DEPENDENCIES}}, {{KEYWORDS}}, {{RELATED_FILES}}specs/.index/components/<category>-<basename>.md.index-state.jsonNaming: <singular-category>-<lowercase-basename>.md (e.g., controller-users.md)
Load templates/external-spec.md, fill {{SOURCE_TYPE}}, {{SOURCE_ID}}, {{FETCH_TIMESTAMP}}, {{RESOURCE_NAME}}, {{CONTENT_SUMMARY}}, {{SECTIONS}}, {{KEYWORDS}}, {{RELATED_COMPONENTS}}.
Load templates/index-summary.md, aggregate counts by category, list all components and externals. Write to specs/.index/index.md.
If --dry-run: write nothing. Display preview table:
Dry Run - Would generate:
| File | Category | Source | Status |
|------|----------|--------|--------|
Total: N files
Ask via AskUserQuestion:
| # | Question | Key |
|---|---|---|
| 1 | Found {{count}} components. Seem complete? | componentCount |
| 2 | External resources look correct? | externalResources |
| 3 | Any areas to re-scan or adjust? | adjustments |
Handle feedback: re-scan missing areas, re-filter if too many, re-process changed externals.
Update specs/.index/.index-state.json with lastIndexed, componentCount, externalCount, categories, hashes.
Display:
Index complete for '{{project_name}}'.
Output: specs/.index/
| Category | Count |
|----------|-------|
| Controllers | {{count}} |
| Services | {{count}} |
| Models | {{count}} |
| Helpers | {{count}} |
| Migrations | {{count}} |
| External Resources | {{count}} |
| **Total** | **{{total}}** |
Next: Run /curdx-flow:start to create specs that reference indexed components.
| Scenario | Action |
|---|---|
| No components found | Warn, suggest --path=src/ or broader patterns. Still create specs/.index/ |
| External URL unreachable | Warn and skip, continue others |
| MCP server unavailable | Warn and skip, continue others |
Git unavailable + --changed | Fatal error, suggest --force |
| Permission denied on file | Skip file with warning, continue |
Hash unchanged (no --force) | Skip silently, count in summary |
| Template missing | Use inline minimal fallback |
| State file corrupted | Reset state, full scan |
| Monorepo detected | Preserve package context in paths, group by package in summary |
Never abort the entire index for recoverable errors. Show error/warning summary at end.