conditional-docs-setup
Set up conditional documentation loading to prevent context pollution. Use when organizing project docs, implementing progressive disclosure, or reducing CLAUDE.md token consumption with on-demand loading.
What this skill does
# Conditional Docs Setup Skill
Set up conditional documentation loading to prevent context pollution.
## When to Use
- Setting up documentation for a new project
- Reducing context pollution in existing projects
- Creating just-in-time documentation loading
- Optimizing agent context usage
## Core Concept
Load documentation only when conditions match the current task.
> "IMPORTANT: Only read the documentation if any one of the conditions match your task."
## Setup Workflow
### Step 1: Inventory Documentation
List all documentation files in the project:
```bash
# Find documentation files
find . -name "*.md" -path "*/docs/*"
find . -name "README*"
find . -name "CONTRIBUTING*"
```
### Step 2: Categorize by Purpose
Group documentation by what it helps with:
| Category | Examples |
| --- | --- |
| Setup | README, INSTALL, CONTRIBUTING |
| API | api-reference, endpoints, schemas |
| Architecture | design-docs, system-overview |
| Features | feature-specific guides |
| Testing | test-patterns, fixtures |
### Step 3: Define Loading Conditions
For each document, identify when it's relevant:
```markdown
- docs/api-reference.md
- Conditions:
- When working with API endpoints
- When adding new routes
- When modifying request/response formats
- docs/database-schema.md
- Conditions:
- When modifying database tables
- When adding new models
- When writing migrations
```
### Step 4: Create Conditional Docs File
Create the conditional documentation manifest:
```markdown
# Conditional Documentation
This helps determine what documentation to read based on
the specific changes you need to make in the codebase.
IMPORTANT: Only read documentation if conditions match your task.
---
- README.md
- Conditions:
- When first understanding the project
- When setting up the development environment
- docs/api/endpoints.md
- Conditions:
- When working with REST endpoints
- When adding new API routes
- docs/database/schema.md
- Conditions:
- When modifying database tables
- When creating migrations
- docs/testing/patterns.md
- Conditions:
- When writing new tests
- When debugging test failures
```
### Step 5: Integrate with Commands
Add conditional docs check to planning commands:
```markdown
## Relevant Documentation
Read `.claude/commands/conditional_docs.md` to check if your task
requires additional documentation. If your task matches any conditions
listed, include those documentation files.
```
## Condition Writing Guidelines
### Be Specific
```markdown
# Good - Specific conditions
- When adding a new API endpoint
- When modifying user authentication
# Bad - Vague conditions
- When doing backend work
- When coding
```
### Cover Common Scenarios
```markdown
- docs/auth.md
- Conditions:
- When implementing login/logout
- When adding new permissions
- When debugging auth issues
- When integrating OAuth
- When working with sessions
```
### Avoid Overlap
Each document should have distinct conditions:
```markdown
# Good - Distinct conditions
- api-reference.md → API endpoints
- database-schema.md → Database tables
# Bad - Overlapping conditions
- api-reference.md → When doing backend work
- database-schema.md → When doing backend work
```
## Maintenance Workflow
### When Documentation is Added
1. Create the new documentation file
2. Add entry to conditional_docs.md
3. Define appropriate loading conditions
### When Documentation is Updated
1. Review existing conditions
2. Add/remove conditions as needed
3. Update documentation content
### When Documentation is Removed
1. Delete the documentation file
2. Remove entry from conditional_docs.md
## Template: Conditional Docs File
```markdown
# Conditional Documentation
This helps determine what documentation to read based on
the specific changes you need to make in the codebase.
IMPORTANT: Only read documentation if conditions match your task.
Excessive documentation loading wastes context and reduces focus.
---
## Project Setup
- README.md
- Conditions:
- When first understanding the project
- When setting up development environment
- When learning available commands
## Backend
- docs/api/reference.md
- Conditions:
- When working with API endpoints
- When adding new routes
- docs/database/schema.md
- Conditions:
- When modifying database tables
- When writing migrations
## Frontend
- docs/components/guide.md
- Conditions:
- When creating new components
- When modifying UI patterns
## Testing
- docs/testing/patterns.md
- Conditions:
- When writing tests
- When debugging test failures
```
## Memory References
- @conditional-docs-pattern.md - Full pattern documentation
- @minimum-context-principle.md - Why this matters
- @one-agent-one-purpose.md - Context affects focus
## Version History
- **v1.0.0** (2025-12-26): Initial release
---
## Last Updated
**Date:** 2025-12-26
**Model:** claude-opus-4-5-20251101
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.