Gradle-mcp gradle_mcp_caching_expert
install
source · Clone the upstream repo
git clone https://github.com/rnett/gradle-mcp
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/rnett/gradle-mcp "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.agents/skills/gradle_mcp_caching_expert" ~/.claude/skills/rnett-gradle-mcp-gradle-mcp-caching-expert && rm -rf "$T"
manifest:
.agents/skills/gradle_mcp_caching_expert/SKILL.mdsource content
Skill: Gradle MCP Caching Expert
This skill provides expert guidance on the heavy caching infrastructure used for Gradle sources and dependency resolution within the Gradle MCP project.
Caching Strategy
- Heavy Caching: This workspace uses extensive caching for Gradle sources. Use
andinspect_dependencies
withsearch_dependency_sources
only when dependencies change.fresh = true - Flexible Path Abstractions: When representing filesystem structures for caches (like
), prefer interfaces with flexible implementations (e.g.,SourcesDir
,MergedSourcesDir
) over rigid data classes.SingleDependencySourcesDir - Cache Invalidation: When implementing re-extraction or re-indexing logic with
, explicitly propagate the flag to all underlying services (likeforceDownload
) to ensure stale caches are invalidated.IndexService - Expensive Operations: In
(and similar cached operations), perform expensive external calls (like GradlewithSources
) exactly once under an exclusive lock, and only after checking a shared lock for a fresh cache.resolve() - Lock File Naming: Include the group name or a hash of the full path in global lock file names for shared resources to prevent collisions across different organizations.
- Granular Locking Strategy: For multi-stage resource processing (like source extraction -> indexing), employ a two-level locking strategy: a 'Base' lock for shared initialization and Facet-specific 'Provider' locks for independent parallel work. This maximizes concurrent throughput.
- Fail-Fast via Shared Locks: Use a shared lock acquisition on a 'Base' lock file to detect when an exclusive worker (e.g., source downloader) has released its lock. Then, check for a success marker (like a
) to distinguish a successful completion from a process crash or failure.manifest.json
Multi-Layer Filtering
- Discrepancy Documentation: When implementing filtering across multiple layers (e.g., init script vs service), document discrepancies in filtering capabilities (e.g., G:A:V vs G:A:V:Variant).
- Verification: Ensure the final layer provides precise verification to safely handle over-fetching from limited earlier layers while maintaining correctness and performance.
Examples
Implementing a new cached operation
- Check for a fresh cache under a shared lock.
- If stale, acquire an exclusive lock.
- Perform the expensive operation (e.g., Gradle resolve) exactly once.
- Update the cache and release the lock.
Handling multi-layer filters
- Apply the G:A:V filter in the init script.
- In the service layer, verify the exact G:A:V:Variant to handle over-fetching.
- Document why the two-stage process is necessary for performance.