Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

init-deep初始化深度

Agent Skill

init-deep 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

250

周安装

10

GitHub Stars

123

下载量

81
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:init-deep(初始化深度)
来源仓库:https://github.com/techdufus/oh-my-claude
仓库路径:skills/init-deep
安装命令:
npx skills add https://github.com/techdufus/oh-my-claude --skill init-deep
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/techdufus/oh-my-claude --skill init-deep

简介

用于查找、检索和筛选相关信息,适合根据关键词快速定位候选结果。

  • 可结合任务场景或来源线索进行信息聚合,支持技能库探索和匹配。
  • 安装前建议确认权限范围和维护状态,避免触发不必要的联网或文件操作。
  • 安装命令为 npx skills add https://github.com/techdufus/oh-my-claude --skill init-deep。
  • 适用于 Codex、Claude、Cursor、Gemini CLI,需通过 GitHub 仓库安装。

SKILL.md

Init Deep Skill

Create a minimal root CLAUDE.md with nested CLAUDE.md files throughout the repository for true progressive disclosure.

Key Insight

Claude automatically loads CLAUDE.md from any directory it reads. Instead of centralizing documentation in .claude/docs/, place CLAUDE.md files directly in relevant directories. When Claude reads src/api/users.ts, it also loads src/api/CLAUDE.md - contextual guidance exactly when needed.

Closest Wins: When multiple CLAUDE.md files apply, the one closest to the file being edited takes precedence. A rule in src/api/CLAUDE.md overrides the same topic in root CLAUDE.md.

When This Skill Activates

CategoryTrigger Phrases
Initialize/init-deep, deep init, initialize deeply, setup claude deeply
Migraterefactor claude.md, migrate claude.md, restructure claude
Structurenested claude, progressive disclosure, contextual claude

CLI Variants

/init-deep              # Update: modify existing + create new where needed
/init-deep --fresh      # Delete all CLAUDE.md files, regenerate from scratch
/init-deep --max-depth=2 # Limit nesting depth (default: unlimited)
FlagBehavior
(none)Additive - creates missing, preserves existing
--freshDestructive - deletes all CLAUDE.md, starts clean
--max-depth=NLimits nested CLAUDE.md to N levels deep

Philosophy: Instruction Budget

Claude has ~150-200 instruction capacity before diminishing returns. A bloated root CLAUDE.md means wasted context on every interaction.

Solution: Minimal root + nested CLAUDE.md files that load only when relevant directories are accessed.

Size Limits (Strict)

FileLinesStatus
Root CLAUDE.md50-150Optimal range
Root CLAUDE.md150+Needs refactoring
Nested CLAUDE.md30-80Optimal range
Nested CLAUDE.md80+Too verbose

Telegraphic style required. No verbose explanations. Each line must carry weight.

Deduplication Rules

Child CLAUDE.md files NEVER repeat parent content:

  • If root says "use TypeScript" - children don't repeat it
  • If root defines import order - children inherit it
  • Child files add domain-specific rules only

Review Phase Requirement: Before finalizing, scan all generated CLAUDE.md files for duplicated guidance. Remove duplicates from children, keep in nearest common ancestor.


Directory Scoring System

Not every directory needs a CLAUDE.md. Use weighted scoring to decide.

Scoring Formula

Score = (file_count * 3) + (reference_centrality * 3) + (symbol_density * 1) + (export_count * 1)
FactorWeightHow to Measure
File count3xNumber of files in directory
Reference centrality3xHow many imports/exports reference this dir
Symbol density1xFunctions, classes, types defined
Export count1xPublic API surface

Score Thresholds

ScoreAction
>15Definitely gets CLAUDE.md
8-15Only if distinct domain (tests, api, components)
<8Parent CLAUDE.md covers it

Quick Heuristics

When scoring isn't practical, use these rules:

DirectoryCreate CLAUDE.md?Reason
tests/YESTesting patterns are domain-specific
src/components/YESComponent patterns are specialized
src/api/YESAPI design patterns are critical
src/hooks/MAYBEIf project has custom hooks
src/utils/MAYBEIf utility patterns are non-obvious
src/services/MAYBEIf services have specific patterns
src/MAYBEFor general coding conventions
scripts/RARELYOnly if complex build system
node_modules/NEVERNot your code
dist/NEVERGenerated code

Two Operating Modes

Mode 1: Fresh Project (No CLAUDE.md)

Create minimal root + nested structure from scratch.

Mode 2: Existing CLAUDE.md

Analyze, categorize, and migrate content to nested CLAUDE.md files.


Workflow

Phase 1: Discovery

Goal: Understand current state and scope.

Actions:

  1. Check if root CLAUDE.md exists
  2. Scan for common directories that should have nested CLAUDE.md
  3. Check for existing nested CLAUDE.md files
  4. Detect if .claude/docs/ exists (old pattern to migrate)
  5. Calculate directory scores for prioritization

Dynamic Agent Scaling:

ConditionAction
Files >100Spawn additional Explore agents
Depth >=4Increase exploration scope
Multiple languagesSpawn language-specific analysis

Concurrent Execution: Launch all exploration agents in parallel (one message, multiple Task calls). Do not wait for one to finish before starting others.

Directory Detection Patterns:

src/           # Source code root
tests/         # Test files
test/          # Alternative test directory
lib/           # Library code
api/           # API layer (may be under src/)
components/    # UI components
hooks/         # React/custom hooks
utils/         # Utility functions
services/      # Service layer
scripts/       # Build/dev scripts
packages/      # Monorepo packages
apps/          # Monorepo apps

Nested directory patterns (check inside src/):

src/api/
src/components/
src/hooks/
src/utils/
src/services/
src/lib/
src/routes/
src/pages/
src/stores/
src/models/

Detection Script:

# Find directories that should have CLAUDE.md
for dir in tests test src lib api components hooks utils services scripts packages apps; do
  if [ -d "$dir" ]; then
    echo "FOUND: $dir/"
  fi
done

# Check src/ subdirectories
if [ -d "src" ]; then
  for subdir in api components hooks utils services lib routes pages stores models; do
    if [ -d "src/$subdir" ]; then
      echo "FOUND: src/$subdir/"
    fi
  done
fi

Phase 2: Interview

Goal: Gather essential project info.

For Fresh Projects, Ask:

Question 1: Project Description

What does this project do? (One sentence)

Example: "A CLI tool for managing Kubernetes deployments"

Question 2: Package Manager

Which package manager does this project use?

Options:
- npm (default, will not be documented)
- pnpm
- yarn
- bun
- none (not a JS/TS project)

Question 3: Non-Standard Commands

Any build, test, or lint commands that differ from standard?

Leave blank if using standard commands (npm test, npm run build).
Only specify if different, e.g., "pytest -v" or "make release"

Question 4: Nested CLAUDE.md Selection

I detected these directories. Which should have their own CLAUDE.md?

Detected:
- [x] tests/
- [x] src/components/
- [x] src/api/
- [ ] src/utils/
- [ ] scripts/

Select all that would benefit from contextual guidance.
(Default: tests/ and any domain-specific src/ directories)

For Existing CLAUDE.md Migration, Ask:

Found existing CLAUDE.md ({N} lines). Options:

1. Analyze and migrate - Extract content to nested CLAUDE.md files
2. Replace - Create fresh minimal structure (backup original)
3. Cancel - Keep existing structure

Phase 3: Analysis (Existing CLAUDE.md Only)

Goal: Categorize existing content for migration.

Metrics to Calculate:

MetricHowThreshold
Line CountTotal non-empty lines>150 = needs migration
Instruction CountCount MUST/NEVER/ALWAYS/should>30 = instruction overload
Hardcoded PathsRegex for file paths>10 = staleness risk
SectionsCount ## headers>8 = fragmented

Content Categorization:

Map existing content to potential nested locations:

Content TypeDestination
Project description, tech stackRoot CLAUDE.md
Package manager, build commandsRoot CLAUDE.md
Task-to-location mappingRoot CLAUDE.md
Agent workflow guidanceRoot CLAUDE.md
Testing patterns, mocking, coveragetests/CLAUDE.md
Component patterns, naming, propssrc/components/CLAUDE.md
API design, endpoints, error handlingsrc/api/CLAUDE.md
Hook patterns, naming, dependenciessrc/hooks/CLAUDE.md
Utility patterns, when to usesrc/utils/CLAUDE.md
Service patterns, external integrationssrc/services/CLAUDE.md
Coding conventions (general)Root or src/CLAUDE.md

Analysis Output Template:

## CLAUDE.md Analysis

### Metrics
| Metric | Value | Status |
|--------|-------|--------|
| Total Lines | 245 | MIGRATE |
| Instructions | 52 | HIGH |
| Hardcoded Paths | 18 | WARNING |

### Content Migration Plan
| Lines | Content | Destination |
|-------|---------|-------------|
| 1-15 | Project description | Root CLAUDE.md |
| 20-45 | Testing patterns | tests/CLAUDE.md |
| 50-95 | Component conventions | src/components/CLAUDE.md |
| 100-140 | API design patterns | src/api/CLAUDE.md |
| 145-180 | General coding style | src/CLAUDE.md |
| 185-245 | Outdated/stale content | REMOVE (with approval) |

Phase 4: Generation

Goal: Create minimal root + nested CLAUDE.md files.

Parallel Generation: When creating multiple nested CLAUDE.md files, generate them in parallel (multiple Write calls in one message).

Root CLAUDE.md Template (50-100 lines target)

# {Project Name}

{One-sentence description}

## Development

{Package manager line - ONLY if not npm}

{Non-standard commands - ONLY if provided}

## Where to Look

| Task | Location |
|------|----------|
| Add new API endpoint | src/api/ |
| Add UI component | src/components/ |
| Add utility function | src/utils/ |
| Write tests | tests/ |
| Add service integration | src/services/ |
| Modify build/deploy | scripts/ |

## Agent Workflow

Explore finds -> Librarian reads -> You plan -> Worker implements -> Validator checks

When delegating to agents:
- Use positive constraints ("ensure X") not negative ("don't do Y")
- Include context, expected output, acceptance criteria
- Launch independent tasks in parallel

## Guidance

Context-specific guidance lives in nested CLAUDE.md files throughout the repo.
These load automatically when you work in those directories.
Closest CLAUDE.md to the file being edited takes precedence.

Conditional Rules:

  • Omit "Package manager" if npm
  • Omit "Development" section if no non-standard info
  • Customize "Where to Look" table based on actual project structure
  • Never include coding conventions (put in src/CLAUDE.md or nested)

Nested CLAUDE.md Templates

Each nested file: 30-80 lines max. Telegraphic style. Domain-specific anti-patterns required.


tests/CLAUDE.md Template (30-50 lines):

# Testing

## Framework

{e.g., Jest, Vitest, pytest, Go testing}

## Patterns

- Test files: `*.test.ts` or `*.spec.ts`
- Describe blocks mirror module structure
- One assertion per test when practical

## Running Tests

{test command}


## Mocking

- Prefer real implementations over mocks
- Mock only: network, time, randomness, file system

## Coverage

Focus on behavior, not percentage. Critical paths need thorough coverage.

## Anti-Patterns

- Don't mock what you can test directly
- Don't test implementation details
- Don't share mutable state between tests
- Don't write tests that pass when code is broken

src/components/CLAUDE.md Template (30-50 lines):

# Components

## Structure

ComponentName/ index.ts # Re-export ComponentName.tsx # Implementation ComponentName.test.tsx

## Naming

- Components: PascalCase
- Props interface: `{ComponentName}Props`
- Files match component name

## Patterns

- Prefer composition over inheritance
- Extract hooks for reusable logic
- Props over context for explicit dependencies

## Exports

{Named exports / default exports preference}

## Anti-Patterns

- Don't use inline styles when CSS modules exist
- Don't prop-drill beyond 2 levels - use context
- Don't mix data fetching with presentation
- Don't create god components (>200 lines)

src/api/CLAUDE.md Template (30-50 lines):

# API Layer

## Design

- RESTful endpoints / GraphQL / tRPC
- Consistent error response format
- Request validation at boundary

## Patterns

- Controllers handle HTTP concerns only
- Business logic lives in services
- Validate input, sanitize output

## Error Handling

{error response format example}

## Authentication

{auth pattern if applicable}

## Anti-Patterns

- Don't expose internal errors to clients
- Don't skip input validation
- Don't leak sensitive data in responses
- Don't mix auth logic with business logic

src/hooks/CLAUDE.md Template (30-50 lines):

# Hooks

## Naming

- Prefix with `use`: `useAuth`, `useForm`, `useFetch`
- Name describes the capability, not implementation

## Patterns

- Single responsibility per hook
- Return stable references (useMemo, useCallback)
- Handle cleanup in useEffect

## Testing

- Test hooks via @testing-library/react-hooks
- Test state transitions, not implementation

## Common Hooks

{list project-specific hooks if established}

## Anti-Patterns

- Don't call hooks conditionally
- Don't create hooks with side effects on mount without cleanup
- Don't return unstable references
- Don't nest hooks more than 2 levels deep

src/utils/CLAUDE.md Template (30-50 lines):

# Utilities

## When to Create

Create a utility when:
- Logic is used in 3+ places
- Function is pure (no side effects)
- Behavior is well-defined and testable

## Patterns

- Pure functions preferred
- No dependencies on external state
- Comprehensive input validation
- Clear, descriptive names

## Naming

- Functions: camelCase, verb-first (`formatDate`, `parseInput`)
- Files: kebab-case or camelCase (match project convention)

## Testing

Every utility function needs tests. They're isolated and easy to test.

## Anti-Patterns

- Don't create utils for single-use logic
- Don't add side effects to pure functions
- Don't create "misc" or "helpers" grab-bags
- Don't depend on global state

src/services/CLAUDE.md Template (30-50 lines):

# Services

## Purpose

Services encapsulate external integrations and complex business logic.

## Patterns

- One service per external dependency
- Services are injectable/mockable
- Handle retries, timeouts, circuit breaking

## Structure

services/ userService.ts authService.ts emailService.ts

## Error Handling

- Wrap external errors in domain-specific errors
- Log at service boundary
- Never expose internal details to callers

## Anti-Patterns

- Don't call services from other services directly - use orchestrator
- Don't mix HTTP/DB concerns in same service
- Don't retry without backoff
- Don't swallow errors silently

src/CLAUDE.md Template (30-50 lines):

# Source Code

## Style

- {indent style}
- {semicolons yes/no}
- {quote style}

## Imports

// 1. External packages // 2. Internal aliases (@/) // 3. Relative imports // 4. Types (import type)


## Naming

- Files: {convention}
- Functions: camelCase
- Classes: PascalCase
- Constants: SCREAMING_SNAKE

## Patterns

- Prefer early returns
- Explicit over implicit
- Composition over inheritance

## Anti-Patterns

- Don't use `any` - use `unknown` and narrow
- Don't nest callbacks >2 levels
- Don't mutate function arguments
- Don't use magic numbers without constants

scripts/CLAUDE.md Template (30-50 lines):

# Scripts

## Purpose

Build, deployment, and development automation scripts.

## Conventions

- Scripts are executable: `chmod +x script.sh`
- Include usage comment at top
- Exit codes: 0 success, 1 error
- Use `set -euo pipefail` for bash scripts

## Running

./scripts/{script-name}.sh

or

npm run {script-name}


## Adding New Scripts

1. Create in scripts/ directory
2. Add npm script alias if frequently used
3. Document purpose in script header

## Anti-Patterns

- Don't hardcode paths - use variables
- Don't skip error handling
- Don't assume dependencies exist - check first
- Don't write scripts without idempotency

Phase 5: Execution

For Fresh Projects:

  1. Create root CLAUDE.md
  2. Create nested CLAUDE.md files in detected/selected directories (parallel writes)
  3. Report created files

For Migration:

  1. Create backup: cp CLAUDE.md CLAUDE.md.backup
  2. Create nested CLAUDE.md files with migrated content
  3. Rewrite root CLAUDE.md to minimal version
  4. If .claude/docs/ exists, offer to migrate or remove
  5. Present before/after comparison

For --fresh Flag:

  1. Find all existing CLAUDE.md files: find . -name "CLAUDE.md" -type f
  2. Delete all found CLAUDE.md files
  3. Run fresh project workflow

Deduplication Check (Required):

Before finalizing, review all generated files:

  1. List all rules in root CLAUDE.md
  2. Check each nested file for duplicates
  3. Remove any duplicated guidance from children
  4. Only domain-specific additions remain in nested files

Before/After Report:

## Migration Complete

### Before
- Root CLAUDE.md: 245 lines
- Nested CLAUDE.md: 0 files
- .claude/docs/: 3 files

### After
- Root CLAUDE.md: 85 lines (65% reduction)
- Nested CLAUDE.md: 4 files
  - tests/CLAUDE.md (35 lines)
  - src/components/CLAUDE.md (42 lines)
  - src/api/CLAUDE.md (38 lines)
  - src/CLAUDE.md (30 lines)

### Backup
Original preserved at CLAUDE.md.backup

### Benefit
Root context cost reduced from 245 to 85 lines.
Domain guidance loads only when working in those directories.

Behavior Rules

MUST DO

  • Detect existing CLAUDE.md before creating
  • Ask before overwriting any existing CLAUDE.md files
  • Create backup before modifying existing root CLAUDE.md
  • Keep root CLAUDE.md 50-150 lines
  • Keep nested CLAUDE.md files 30-80 lines each
  • Include domain-specific anti-patterns in each nested file
  • Run deduplication check before finalizing
  • Use parallel Task calls for exploration
  • Use parallel Write calls for generation

MUST NOT

  • Document hardcoded file paths (they go stale)
  • Include standard commands (npm test, npm run build)
  • Reference .claude/docs/ (old pattern)
  • Create overly comprehensive documentation
  • Create nested CLAUDE.md in directories that don't benefit
  • Duplicate parent guidance in child files
  • Execute agents sequentially when parallel is possible

SHOULD DO

  • Explain the auto-loading behavior
  • Explain "closest wins" precedence
  • Suggest which directories would benefit from nested CLAUDE.md
  • Offer to migrate .claude/docs/ content if it exists
  • Provide line counts in final report
  • Use scoring system for borderline directories

Content Location Decision

Content TypeLocation
Project purposeRoot
Package managerRoot
Non-standard commandsRoot
Where-to-look tableRoot
Agent workflow guidanceRoot
Testing philosophytests/CLAUDE.md
Component patternssrc/components/CLAUDE.md
API conventionssrc/api/CLAUDE.md
General code stylesrc/CLAUDE.md
Import orderingsrc/CLAUDE.md
Naming conventionssrc/CLAUDE.md or domain-specific

Error Handling

Directory Doesn't Exist

If selected directory doesn't exist:

  1. Ask: "Directory {dir} doesn't exist. Create it with CLAUDE.md, or skip?"
  2. Options: Create directory, Skip

Existing Nested CLAUDE.md

If nested CLAUDE.md already exists:

  1. Read current content
  2. Ask: "Found existing {dir}/CLAUDE.md. Merge, replace, or skip?"
  3. Options: Merge (append new patterns), Replace (backup first), Skip

Permission Denied

If cannot write files:

  1. Output generated content to chat
  2. Say: "Could not write files. Here's the content to add manually:"

Post-Generation Message

After creating files:

Created nested CLAUDE.md structure:

Root:
  - CLAUDE.md ({N} lines)

Nested:
  - tests/CLAUDE.md ({N} lines) - Testing patterns
  - src/components/CLAUDE.md ({N} lines) - Component patterns
  - src/api/CLAUDE.md ({N} lines) - API patterns

How it works:
Claude automatically loads CLAUDE.md from any directory it reads.
When you work in src/api/, the API patterns load automatically.
Closest file to your edit takes precedence ("closest wins").

Next steps:
1. Review each CLAUDE.md and customize for your project
2. Add patterns as they emerge during development
3. Keep files focused and minimal (30-80 lines nested, 50-150 root)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.6%
按下载量换算29

Claude

27.98%
按下载量换算23

Cursor

18.01%
按下载量换算15

Gemini CLI

8.84%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/techdufus/oh-my-claude --skill init-deep 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills