Update Search Year

Hookhook3,4171Verified

Automatically adds current year to WebSearch queries when no year is specified. This hook intercepts WebSearch tool usage and appends the current year to queries that don't already contain a year, ensuring search results are current and relevant.

Install CommandLocked
npx claude-code-templates@latest --skill ••••••••••••••••••••
Unlock to reveal command
ByCommunity
claude-code — hooks pre tool update search year
$

Interactive Terminal Locked

Unlock this skill to run and inspect the interactive installation sequence.

CookApps Fine Software Cuisine
CONTENT

{

"description": "Automatically adds current year to WebSearch queries when no year is specified. This hook intercepts WebSearch tool usage and appends the current year to queries that don't already contain a year, ensuring search results are current and relevant.",

"hooks": {

"PreToolUse": [

{

"matcher": "WebSearch",

"hooks": [

{

"type": "command",

"command": "python3 -c \"import json, sys, re; from datetime import datetime; input_data = json.load(sys.stdin); tool_input = input_data.get('tool_input', {}); query = tool_input.get('query', ''); current_year = str(datetime.now().year); has_year = re.search(r'\\\\b20\\\\d{2}\\\\b', query); has_temporal = any(word in query.lower() for word in ['latest', 'recent', 'current', 'new', 'now', 'today']); should_add_year = not has_year and not has_temporal; modified_query = f'{query} {current_year}' if should_add_year else query; output = {'hookSpecificOutput': {'hookEventName': 'PreToolUse', 'modifiedToolInput': {'query': modified_query}}}; print(json.dumps(output)); sys.exit(0)\"",

"timeout": 5

}

]

}

]

}

}

How to Use & Getting Started

Protected

# Step 1: Initialize skill agent setup

npx skills add Update Search Year --install-production

python -m pip install -r requirements.txt

codex plugin install Update Search Year@latest

export API_KEY=secret_token_key_here

Installation Runbook & Walkthrough Locked

Unlock this skill to reveal complete step-by-step setup guides, terminal commands, configuration recipes, repository links, and interactive installation video walkthroughs.

Unlock full access to Update Search Year

Get instant access to complete setup guides, repository source code, and integration assets.