From coding-workflows
Criteria for analyzing codebases to inform agent and skill generation. Encodes signal hierarchy, specialist indicators, and domain significance evaluation. Use when: generating agents, generating skills, or evaluating project setup.
How this skill is triggered — by the user, by Claude, or both
Slash command
/coding-workflows:codebase-analysisThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Criteria for understanding a project's domain, patterns, and conventions before proposing agents or skills. This skill teaches what makes a good analysis, not how to perform one step-by-step.
Criteria for understanding a project's domain, patterns, and conventions before proposing agents or skills. This skill teaches what makes a good analysis, not how to perform one step-by-step.
Boundary with stack-detection: Stack-detection answers WHAT technologies exist. Codebase-analysis evaluates HOW they're used and WHETHER they warrant specialists.
Related skills:
coding-workflows:stack-detection -- Technology identification (WHAT). Reference its Analysis Guidance section for per-stack deep analysis criteriacoding-workflows:asset-discovery -- Overlap detection and provenance-aware discovery. Check BEFORE proposing new agents/skillscoding-workflows:agent-patterns -- Agent metadata spec (name, domains, role) and provenance fields. For formatting proposals
Naming constraints for agent names are documented in project-level validation skills when available.What's high-signal vs low-signal when building a project mental model:
High-signal: Project identity docs reveal intent and settled decisions.
planning.reference_docs (documented in workflow.yaml).Medium-signal: Existing assets reveal what's already covered.
.claude/agents/ show what domains have specialist coverage..claude/skills/ and plugin skills show what patterns are encoded.planning.reference_docs from workflow.yaml lists additional project docs worth reading.Lower-signal: Code structure validates or contradicts stated intent.
Missing file handling: If a reference_doc is listed but missing, warn user and continue. If CLAUDE.md is absent, note "limited convention context" in analysis output.
How to select representative source files for deeper analysis:
Codebase signals that suggest an agent or skill is warranted. Each includes a counter-example and validation criterion to prevent false positives.
| Signal | Suggests | Counter-Example | Validation |
|---|---|---|---|
| Background job dir (jobs/, workers/) with multiple classes | Async/queue specialist | Single job class -- not enough complexity | Count job files; 3+ suggests specialist |
| Payment models + service objects | Payments specialist | Test fixtures referencing Stripe -- not real usage | Grep for payment processing in services, not just models |
| ML model dirs, training scripts | ML specialist | Pre-trained model loaded but never fine-tuned | Check for training config or custom training code |
| Custom middleware directory | API/middleware specialist | Single logging middleware file | Count middleware files; 2+ custom middleware suggests specialist |
| Multi-service integration layer | Integration specialist | Single external API call wrapped in a service | Count distinct external service integrations; 3+ suggests specialist |
| Signal | Suggests | Counter-Example | Validation |
|---|---|---|---|
| Consistent error handling across 5+ modules | Error handling patterns skill | All using framework defaults | Grep for custom exception classes or result wrappers |
| Standardized API response format | API conventions skill | Single controller with format | Check 3+ controllers for same pattern |
| Shared test utilities and custom assertions | Testing patterns skill | Standard framework test helpers only | Look for project-specific test base classes or helpers |
| Custom validation layer | Validation patterns skill | Framework's built-in validators only | Check for custom validator classes or validation modules |
A domain warrants a specialist agent or skill when it matters, not just when it exists. Evaluate on these criteria:
Threshold: A domain warrants a specialist agent if it scores on 2+ of these criteria. A single criterion is insufficient -- a high-risk module touched by one file is better served by documentation than an agent.
What to extract from CLAUDE.md and code as pre-population material for agents and skills:
Language guidance: Use "appears to", "observed in N files" for code-derived conventions. Reserve definitive language for CLAUDE.md quotes and explicit config values. This prevents hallucinated conventions from being treated as authoritative.
Indicators for when web search is warranted during analysis:
Anti-pattern: Don't research well-established frameworks (React, Rails, Django), standard library usage, or generic patterns (REST, CRUD, MVC).
Prioritization (when flags exceed search budget): direct dependency > usage frequency in sampled files > domain criticality (auth/payments > logging/metrics).
Conditions where deeper analysis won't help -- fall back to coding-workflows:stack-detection declarative tables:
When falling back, present to the user: "Using stack detection (limited project context available)."
Quality criteria for analysis output consumed by generator commands.
Minimum viable analysis: 2+ domains with file path evidence. If fewer domains found, fall back to coding-workflows:stack-detection. If domains found but no conventions, flag: "Limited context -- recommend adding CLAUDE.md."
Good analysis includes:
src/billing/webhooks.py, app/jobs/*.rb (12 files))Note: When generating both asset types in a single pass (via /coding-workflows:generate-assets), run analysis once and extract both deliverable sets.
See references/generation-deliverables.md for generator-specific deliverable requirements. Read it when running /coding-workflows:generate-assets to understand what the generation phase needs from analysis.
What constitutes meaningful staleness when comparing current analysis against an existing generated asset (see coding-workflows:agent-patterns for provenance field definitions):
| Change | Stale? | Rationale |
|---|---|---|
| New domain detected that overlaps asset's coverage area | Yes | May warrant expanding asset's domains or content |
Domain in asset's domains array no longer detected | Yes | Asset covers removed domain |
| Framework change | Yes | Fundamental shift in what assets need to know |
| New convention observed | No | Refines existing assets, doesn't invalidate them |
| New library detected | No (usually) | Within-domain change |
| File count changes within a domain | No | Quantity is noise |
Staleness is evaluated per-asset by comparing the asset's domains array against current analysis domains. A project gaining a new domain does not make existing assets stale unless the new domain overlaps with their coverage area.
| Anti-Pattern | Why It's Wrong | Do This Instead |
|---|---|---|
| Count files to determine importance | 3 files could be high-value or trivial | Assess integration breadth, risk, active development |
| Assume framework = domain | Misses application-specific complexity | Read business logic, not just framework boilerplate |
| Generate for unused features | Detected library does not equal active domain | Validate usage count via grep |
| Duplicate CLAUDE.md into agents | Creates maintenance burden and drift | Reference CLAUDE.md, don't copy it |
| Skip reading existing assets | Leads to duplicate agents/skills | Always check coding-workflows:asset-discovery before proposing |
| Claim confidence without evidence | LLM hallucination risk | Cite file paths for every convention claimed |
| Research everything | Wastes search budget on known frameworks | Only research genuinely unfamiliar libraries/domains |
coding-workflows:stack-detection -- Technology identification (WHAT exists). Reference its Analysis Guidance section for per-stack deep analysis criteriacoding-workflows:asset-discovery -- Overlap detection and provenance-aware discovery. Check BEFORE proposing new agents/skills. References this skill's staleness criteria during domain-comparison staleness detection.coding-workflows:agent-patterns -- Agent metadata spec (name, domains, role, skills) and provenance fields (generated_by, generated_at). For formatting proposals and staleness detection
Naming constraints for agent names are documented in project-level validation skills when available.coding-workflows:knowledge-freshness -- staleness triage for evaluating when training data is reliablenpx claudepluginhub kiwi-home/ai-coding-resources --plugin coding-workflowsExtracts the conceptual DNA of a codebase — roles, procedures, coordination patterns — as generalized agent/team definitions. Use for onboarding, bootstrapping agentic systems, or creating skill libraries.
Assesses codebase for AI agent readiness by detecting stacks, monorepos, git setup, and evaluating style, testing, code quality, secrets, and file sizes.