CLAUDE_PROMPT_ENGINEERING_FOUNDATION_AI_OPTIMIZED_V2025.07.27
AI_AGENT_REFERENCE TOKEN_EFFICIENCY WORDPRESS_PUBLICATION 2025.07.27 claude-opus-4
PROJECT_CONTEXT,TEMPLATES,RULES USER_INPUT,CALCULATIONS,REAL_TIME_DATA 5 true 30 XML_STRUCTURED
72.5 20-30 50-70 70-85 90
200000 50000 5 3600 8
20 30 85 100
true true true true true
8 4 architecture,large_refactoring
8 multi_step,uncertain,creative
1 50
5_accounts true priority_based
60 40 50
- EXECUTION_TEMPLATES
- OPTIMIZATION_PATTERNS
- TASK_ROUTING
- ERROR_PATTERNS
- MEMORY_SCHEMA
- CLAUDE_MD_TEMPLATE
- PERFORMANCE_METRICS
- EXTENDED_THINKING_TRIGGER
- QUALITY_VALIDATION
- COMMAND_SHORTCUTS
- API_REFERENCE
- EXECUTION_PRIORITY
- SUCCESS_PATTERNS
- FAILURE_AVOIDANCE
- RESOURCE_LIMITS
- INTEGRATION_HOOKS
- VERSION_CONTROL
- QUICK_START
- BENCHMARK_BASELINE
- COMPLIANCE
- END_OF_DOCUMENT
EXECUTION_TEMPLATES
TEXT_EDITING
<editor role="expert_15y">
<task>improve</task>
<doc>[TARGET]</doc>
<req>grammar,clarity,tone,logic</req>
<o>revised+reason</o>
</editor>
WEB_SEARCH
<search mode="parallel">
<q1>main_keyword</q1>
<q2>academic_source</q2>
<q3>latest_news</q3>
<q4>official_docs</q4>
<q5>community</q5>
<synthesis>integrate_all</synthesis>
</search>
CODE_GENERATION
<code>
<lang>[LANGUAGE]</lang>
<pattern>[ARCHITECTURE]</pattern>
<constraints>perf<200ms,coverage>80%,complexity<10</constraints>
<parallel>impl,test,docs</parallel>
</code>
REFACTORING
<refactor duration="7h">
<analyze>structure,debt,priority</analyze>
<plan>migration,risk,rollback</plan>
<execute mode="parallel">modules</execute>
<validate>regression,performance,metrics</validate>
</refactor>
FILE_ORGANIZATION
<organize>
<scan mode="parallel"/>
<classify>content,context,relation</classify>
<structure>
/active/[HIGH_FREQ]
/reference/[MID_FREQ]
/archive/[LOW_FREQ]
</structure>
</organize>
DOCUMENTATION_UPDATE
<doc_update>
<triggers>commit,pr,release,issue</triggers>
<pipeline>
detect_changes
impact_analysis
auto_update
generate_review
</pipeline>
<metrics>coverage=100,freshness<24h,accuracy=verified</metrics>
</doc_update>
OPTIMIZATION_PATTERNS
CACHING_HIERARCHY
<cache_layers>
<L1 type="memory">immediate</L1>
<L2 type="prompt_cache" ttl="3600">session</L2>
<L3 type="claude_md">persistent</L3>
</cache_layers>
PARALLEL_EXECUTION_MATRIX
<parallel_tasks>
<independent>
search:[q1,q2,q3,q4,q5]
generate:[code,test,docs]
analyze:[perf,security,quality]
</independent>
<sequential>
fetch->process->validate
plan->execute->verify
</sequential>
</parallel_tasks>
TOKEN_COMPRESSION
<compress>
<from tokens="150">verbose_instruction</from>
<to tokens="45">
<r>[ROLE]</r>
<t>[TASK]</t>
<f>[FOCUS]</f>
</to>
</compress>
TASK_ROUTING
<router>
<opus4 if="complexity>8 OR duration>4h OR type=architecture"/>
<sonnet4 if="complexity<8 AND type IN [coding,review,docs]"/>
<parallel if="independent_tasks>1"/>
</router>
ERROR_PATTERNS
<avoid>
<cache_misuse>dynamic_in_static</cache_misuse>
<parallel_misuse>dependent_as_independent</parallel_misuse>
<context_overflow>unnecessary_data</context_overflow>
</avoid>
MEMORY_SCHEMA
<project_memory>
<architecture>{pattern,services,communication}</architecture>
<decisions>{date,choice,rationale}</decisions>
<patterns>{success:[],failure:[]}</patterns>
<preferences>{language,testing,documentation}</preferences>
</project_memory>
CLAUDE_MD_TEMPLATE
# PROJECT_CONFIG
## RULES
- naming:[camelCase|snake_case]
- indent:2
- line_max:80
## ARCHITECTURE
- pattern:MVC
- db:PostgreSQL
- cache:Redis
## FORBIDDEN
- console.log_production
- hardcoded_credentials
- unused_imports
## TARGETS
- response<200ms
- coverage>80%
- complexity<10
PERFORMANCE_METRICS
<targets>
<token_reduction>30%</token_reduction>
<parallel_success>100%</parallel_success>
<cache_hit>85%</cache_hit>
<response_time>
<simple><2s</simple>
<complex><10s</complex>
<autonomous><7h</autonomous>
</response_time>
</targets>
EXTENDED_THINKING_TRIGGER
<extended_thinking activate_if="complexity>8">
<process>
problem_decomposition
hypothesis_generation
simulation
optimal_selection
</process>
</extended_thinking>
QUALITY_VALIDATION
<validate>
<accuracy>instruction_match>95%</accuracy>
<efficiency>token_usage<baseline*0.7</efficiency>
<performance>latency<target</performance>
<reliability>success_rate>95%</reliability>
</validate>
COMMAND_SHORTCUTS
# EFFICIENCY_COMMANDS
claude analyze-changes --since=last
claude impact-analysis --scope=all
claude update-docs --auto
claude prompt-test --regression
claude ab-test --metrics=all
claude cache-stats --verbose
API_REFERENCE
<models>
<opus4 id="claude-opus-4-1-20250805" use="complex"/>
<sonnet4 id="claude-sonnet-4" use="standard"/>
</models>
<tools>
<claude_code status="GA"/>
<text_editor status="active"/>
<web_search max="5"/>
<parallel_exec max="100"/>
</tools>
EXECUTION_PRIORITY
<priority_queue>
<P0>user_blocking</P0>
<P1>performance_critical</P1>
<P2>standard_request</P2>
<P3>background_task</P3>
</priority_queue>
SUCCESS_PATTERNS
<proven_patterns>
<parallel_search queries="5" speedup="70%"/>
<cache_static savings="90%"/>
<memory_persist consistency="100%"/>
<extended_think accuracy_boost="25%"/>
</proven_patterns>
FAILURE_AVOIDANCE
<anti_patterns>
<avoid_1>caching_user_input</avoid_1>
<avoid_2>parallel_dependent_tasks</avoid_2>
<avoid_3>context_overload</avoid_3>
<avoid_4>synchronous_batch</avoid_4>
</anti_patterns>
RESOURCE_LIMITS
<limits>
<context_window>200000</context_window>
<optimal_context>50000</optimal_context>
<cache_ttl>3600</cache_ttl>
<parallel_max>5</parallel_max>
<batch_size>100</batch_size>
</limits>
INTEGRATION_HOOKS
<integrations>
<ide>vscode,jetbrains</ide>
<vcs>git,github</vcs>
<ci_cd>github_actions,jenkins</ci_cd>
<monitoring>datadog,newrelic</monitoring>
</integrations>
VERSION_CONTROL
<versioning>
<current>2025.07.27</current>
<compatibility>claude-4.x</compatibility>
<deprecation_notice>none</deprecation_notice>
<next_update>2025.08.27</next_update>
</versioning>
QUICK_START
<quickstart>
<step1>load_configuration</step1>
<step2>set_cache_strategy</step2>
<step3>enable_parallel</step3>
<step4>execute_task</step4>
<step5>validate_output</step5>
</quickstart>
BENCHMARK_BASELINE
<baseline>
<token_per_request>50000->35000</token_per_request>
<cost_per_day>100->10</cost_per_day>
<response_seconds>5->0.75</response_seconds>
<accuracy_percent>85->95</accuracy_percent>
</baseline>
COMPLIANCE
<compliance>
<data_privacy>GDPR,CCPA</data_privacy>
<security>SOC2,ISO27001</security>
<accessibility>WCAG2.1</accessibility>
</compliance>


コメント