From Skill & Agent Dev
Provides patterns for optimizing context usage and minimizing token footprint: progressive disclosure, semantic compression, structured references, delta context, and contract-based context.
How this skill is triggered — by the user, by Claude, or both
Slash command
/skill-dev:context-engineeringThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Advanced patterns for optimizing context usage and minimizing token footprint.
Advanced patterns for optimizing context usage and minimizing token footprint.
Load context incrementally, not all at once:
Level 1: File names and structure
Level 2: Function signatures and docstrings
Level 3: Implementation details (on demand)
Compress information without losing meaning:
❌ Verbose:
"The function calculateTotalPrice takes a list of items as input,
iterates through each item, multiplies the price by quantity,
and returns the sum of all calculations."
✅ Compressed:
"calculateTotalPrice(items[]) → sum(price * qty)"
Use compact references instead of full content:
❌ Copy entire file
✅ Reference: "See auth.py:authenticate() lines 45-60"
<context>
<summary>
E-commerce app: FastAPI backend, React frontend, PostgreSQL.
Key files: api/routes.py, models/product.py, services/cart.py
</summary>
<current_task>
Fix cart total calculation bug
</current_task>
<relevant_code>
[Only the specific functions needed]
</relevant_code>
</context>
<architecture>
┌─────────────────────────────────────┐
│ API Layer: FastAPI routes │
├─────────────────────────────────────┤
│ Service Layer: Business logic │
├─────────────────────────────────────┤
│ Data Layer: SQLAlchemy models │
└─────────────────────────────────────┘
</architecture>
<focus_layer>Service</focus_layer>
<adjacent_interfaces>
- API: POST /cart/add → add_to_cart(user_id, product_id, qty)
- Data: Cart.add_item(), Product.get_by_id()
</adjacent_interfaces>
Only include what changed:
<previous_state>
Cart total: sum of item prices
</previous_state>
<change>
Added: discount codes support
Modified: calculateTotal() now applies discounts
</change>
<current_issue>
Discount not applied to already-added items
</current_issue>
Define interfaces instead of implementations:
// Instead of full implementation, show contracts:
interface CartService {
addItem(userId: string, productId: string, qty: number): Promise<Cart>;
removeItem(userId: string, itemId: string): Promise<Cart>;
getTotal(userId: string): Promise<{ subtotal: number; discount: number; total: number }>;
}
func → function
param → parameter
ret → return
impl → implementation
❌ "The user wants to implement a feature that allows users to..."
✅ "Implement: user feature for..."
❌ "The function takes three parameters: name which is a string,
age which is a number, and active which is a boolean"
✅ params: name(str), age(int), active(bool)
# CONTEXT: Part of auth flow, called after OAuth callback
# DEPS: UserService, TokenService
# RETURNS: JWT token or raises AuthError
def complete_oauth(code: str) -> str:
...
{
"session_context": {
"project": "e-commerce",
"current_branch": "feature/discounts",
"recent_files": ["cart.py", "discount.py"],
"decisions": [
"Using percentage-based discounts",
"Max one code per order"
]
}
}
After each major interaction, create a compact summary:
[Session 5 Summary]
- Fixed: cart total bug (missing tax calc)
- Added: discount code validation
- TODO: implement stacking discounts
- Key insight: discounts apply pre-tax
npx claudepluginhub jhamidun/claude-code-config-pack --plugin skill-devProvides C# and .NET testing patterns using xUnit, FluentAssertions, NSubstitute, Testcontainers, and WebApplicationFactory for unit and integration tests.