Claude Code - Architecture DOC

# Claude Code Architecture Framework
## Système de documentation et sub-agents pour projets complexes

**Version:** 1.0  
**Date:** 31 Octobre 2024  
**Auteur:** Greg (avec Claude)

---

## Table des Matières

1. [Vision & Principes](#vision--principes)
2. [Architecture Documentaire](#architecture-documentaire)
3. [Sub-agents Spécialisés](#sub-agents-spécialisés)
4. [Flux de Travail Complet](#flux-de-travail-complet)
5. [Templates](#templates)
6. [Exemples Concrets](#exemples-con

USER > WooCommerce edit account profile form to include ACF field group

https://stackoverflow.com/a/47602386
// Add the custom field "extra_company"
add_action( 'woocommerce_edit_account_form', 'add_extra_company_to_edit_account_form' );
function add_extra_company_to_edit_account_form() {
    $user = wp_get_current_user();
	?>
	<fieldset>
		<legend>Additional Information</legend>
		<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
			<label for="extra_company"><?php _e( 'Company Name', 'woocommerce' ); ?></label>
			<input type="text" class="woocommerce-Input w

SHORTCODE: 'display-all-wooc-product-attributes'

/* USAGE: [display-all-wooc-product-attributes]
 */
function shortcode__display_all_wooc_product_attributes($atts) {
	global $product;
	$attributes = $product->get_attributes();
	if ( ! $attributes ) {
		return;
	}

	$display_result = '';

	#<p><strong style="text-transform: uppercase;">Voltage</strong>: 115</p>
	#@wp_mail('nate@cybersprout.net','test Tanis PA',var_export($attributes,1));

	foreach ( $attributes as $attribute ) {
		if ( $attribute->get_variation() ) {
			continue

Change No. of Product Thumbnails Per Row

/**
 * @snippet       Change No. of Thumbnails per Row @ Product Gallery | WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=67117
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 3.0.5
 */
 
add_filter( 'woocommerce_single_product_image_gallery_classes', 'bbloomer_5_columns_product_gallery' );
 
function bbloomer_5_columns_product_gallery( $wrapper_classes ) {
$columns = 5; // change this to 2, 3, 5, 6 etc. Default

SHORTCODE: 'display-wooc-product-attribute'

/* TEMPLATE for creating a shortcode to query related data as a view
 * rename these 2 instances below: shortcode__display_wooc_product_attribute
 * renamed this below: display-wooc-product-attribute
 * USAGE: [display-wooc-product-attribute attribute="" postid=""]
 */
function shortcode__display_wooc_product_attribute($atts) {
	extract( shortcode_atts( array(
		'attribute' => '',
		'postid' => ''
	), $atts ) ); 
	

	$html = '';
	if($postid != '' and $attribute != '')
	{
		$taxono

Set last visited page as cookie

dl_downloads
// 18-07-2018
// Redirect user to last viewed page before logging in

function raj_login_redirect( $redirect_to, $request=false, $user=false )
{
	if (isset($_COOKIE['current_page'])) { $current_page = $_COOKIE['current_page']; }
	if (isset($_COOKIE['last_viewed_page'])) { $last_viewed_page = $_COOKIE['last_viewed_page']; }
	if (isset($_COOKIE['last_referring_page'])) { $last_referring_page = $_COOKIE['last_referring_page']; }
	if (!empty($current_page)) {
		$downloadable = strpos($curre

WooCommerce > Change subject line & heading of 'new order' email to admin based on "on-hold" status or not

add_filter( 'woocommerce_email_subject_new_order', 'custom_new_order_email_subject', 100, 2 );
function custom_new_order_email_subject( $subject, $order ) {
	if ( $order->has_status( 'on-hold' ) ) {
		// Change the subject for 'on-hold' orders
		$subject = 'New Purchase Request: #' . $order->get_id();
	} else {
		// Change the subject for all other orders
		$subject = 'New Order: #' . $order->get_id();
	}
	return $subject;
}


add_filter( 'woocommerce_email_heading_new_order', 'cust

WooCommerce > add USD suffix to prices

add_filter('woocommerce_currency_symbol', 'add_usd_to_price', 10, 2);
function add_usd_to_price($currency_symbol, $currency) {
    if ('USD' === $currency) {
        $currency_symbol = 'USD $ ';
    }
    return $currency_symbol;
}

WooCommerce > Payment Method Management based on shipping zones

Change default message for no payment gateways: https://wordpress.org/support/topic/edit-text-sorry-it-seems-that-there-are-no-available-payment-methods/ HIDE the Place Order button until a payment method is selected: https://stackoverflow.com/a/57325311 Hook to modify which gateways are available based on chosen shipping methods: https://www.wpbeginner.com/wp-tutorials/how-to-disable-payment-methods-in-woocommerce/#aioseo-how-to-disable-payment-methods-based-on-country Force COD Orders to status of On Hold: https://www.businessbloomer.com/woocommerce-payment-gateway-order-status/ Adding shipping expectation note to methods: ? Change Shipping Methods based on products in cart: AI response & https://developer.woocommerce.com/docs/code-snippets/free_shipping_customization/
/**
 * @snippet		Change default message for no payment gateways
 * @reference	https://wordpress.org/support/topic/edit-text-sorry-it-seems-that-there-are-no-available-payment-methods/
 */
add_filter ( 'woocommerce_no_available_payment_methods_message', 'custom_no_available_payment_methods_message' );
function custom_no_available_payment_methods_message( $message ) {
	return 'Payment methods will display once you have entered your shipping information.';
}


/**
 * @snippet		HIDE the P

WooCommerce > notices for Quoted Manually for International Shipping (zone) or forced products

https://stackoverflow.com/a/52748192
add_action( 'woocommerce_review_order_after_shipping' , 'shipping_zone__custom_notice' );
function shipping_zone__custom_notice() {
    // HERE DEFINE YOUR SHIPPING ZONE NAME(S)
    $targeted_zones_names = array('International Shipping'); // <======  <======  <======  <======  <======  

    // Get the customer shipping zone name
    $chosen_methods    = WC()->session->get( 'chosen_shipping_methods' ); // The chosen shipping method
    $chosen_method     = explode(':', reset($chosen_metho

WOOCOMMERCE > Change Stock Availability Message

/**
 * @snippet       Change Stock Availability Message
 * @testedwith    WooCommerce 5.6
 */
function filter_product_availability_text( $availability, $product ) {
	#if ($product->backorders_allowed()){
	if ($product->stock_status == 'onbackorder'){
		$availability = str_replace('Available on backorder', '<strong>Available on backorder</strong><br/><span class="bo-message">Currently available for purchase on backorder due to part shortages.</span>', $availability);
	}
	
    if (!$prod

SearchWP mods

add_filter( 'searchwp\utils\cron_operational', '__return_true');
add_filter( 'searchwp\query\partial_matches\wildcard_before', '__return_true' );
add_filter( 'searchwp\query\partial_matches\wildcard_after', '__return_true' );

// Force partial matches in SearchWP even when matches are found using provided search.
add_filter( 'searchwp\query\partial_matches\force', function( $force, $args ) {
	return true;
}, 10, 2 );


// Accept up to 30 search terms in SearchWP.
add_filter( 'searchwp

MEDIA > Custom filters to remove default image sizes from WordPress

/*
 * Custom filter to remove default image sizes from WordPress.
 * COMMENT out a line you want to KEEP in the 'cscleanup__remove_default_image_sizes()'
 * ADD to the array the sizes you want removed in the 'cscleanup__remove_extra_image_sizes()'
 */

/* Add the following code in the theme's functions.php and disable any unset function as required */
function cscleanup__remove_default_image_sizes( $sizes ) {
	/* Default WordPress */
	# unset( $sizes[ 'thumbnail' ] );       // Remove Th

3289. The Two Sneaky Numbers of Digitville

In the town of Digitville, there was a list of numbers called nums containing integers from 0 to n - 1. Each number was supposed to appear exactly once in the list, however, two mischievous numbers sneaked in an additional time, making the list longer than usual. As the town detective, your task is to find these two sneaky numbers. Return an array of size two containing the two numbers (in any order), so peace can return to Digitville.
/**
 * Finds the two "sneaky" numbers added to an array that originally contained all numbers from 0 to n-1.
 * The final array has length n + 2, and includes two unknown extra numbers.
 *
 * @param {number[]} nums - Array containing numbers from 0 to n-1 plus two extra unknowns.
 * @return {number[]} - The two extra numbers that were added.
 */
var getSneakyNumbers = function (nums) {
    const n = nums.length - 2; // Original range was 0 to n-1, so n = nums.length - 2
    let xorAll = 0;

    

gistfile1.txt

osc (20, 0.2,0)
.out (o0)

PNPM



> The default pnpm store is usually at `~/.local/share/pnpm/store`. 
> You can change it with: `pnpm config set store-dir /path/to/pnpm/store`

```sh
# Install pnpm globally (one time only)
npm install -g pnpm

# This will create (if not present): '~/node_modules/', '~/package.json', '~/pnpm-lock.yaml', '~/.local/share/pnpm/store'
pnpm add -D typescript nodemon @biomejs/biome

# Expose user-level Node binaries in your shell
echo 'export PATH="$HOME/node_modules/.bin:$PATH"' >> ~/.bashrc
```

>