[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AKDD7XQMV5YGFFJNKDFV55":3,"skill-same:01M7AKDD7XQMV5YGFFJNKDFV55":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7AKDD7XQMV5YGFFJNKDFV55","perl-patterns",null,"堅牢でメンテナブルなPerlアプリケーションを構築するためのModern Perl 5.36+のイディオム、ベストプラクティス、規約。","Cyrilthetecchieee\u002Fcyril-code-","Cyrilthetecchieee","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219787998?v=4","01M7AF0MMMKRAA0H61XMJPV92H","Julian Cyril D ","01M7AF0MQ10AVG6QJQ1C2BC0F5",2,"MIT","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fdocs\u002Fja-JP\u002Fskills\u002Fperl-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: perl-patterns\ndescription: 堅牢でメンテナブルなPerlアプリケーションを構築するためのModern Perl 5.36+のイディオム、ベストプラクティス、規約。\norigin: ECC\n---\n\n# モダンPerl開発パターン\n\n堅牢でメンテナブルなアプリケーションを構築するためのイディオマティックなPerl 5.36+パターンとベストプラクティス。\n\n## アクティベートするタイミング\n\n- 新しいPerlコードまたはモジュールを書くとき\n- イディオム準拠のためにPerlコードをレビューするとき\n- レガシーPerlをモダンな標準にリファクタリングするとき\n- PerlモジュールのアーキテクチャをDesignするとき\n- 5.36以前のコードをモダンなPerlに移行するとき\n\n## 仕組み\n\nこれらのパターンをModern Perl 5.36+のデフォルトへのバイアスとして適用する: シグネチャ、明示的なモジュール、集中的なエラー処理、テスト可能な境界。以下の例は出発点としてコピーし、目の前の実際のアプリ、依存スタック、デプロイモデルに合わせて締め付けることを意図している。\n\n## コア原則\n\n### 1. `v5.36`プラグマの使用\n\n単一の`use v5.36`が古い定型文を置き換え、strict、warnings、サブルーチンシグネチャを有効化する。\n\n```perl\n# Good: モダンなプリアンブル\nuse v5.36;\n\nsub greet($name) {\n    say \"Hello, $name!\";\n}\n\n# Bad: レガシーな定型文\nuse strict;\nuse warnings;\nuse feature 'say', 'signatures';\nno warnings 'experimental::signatures';\n\nsub greet {\n    my ($name) = @_;\n    say \"Hello, $name!\";\n}\n```\n\n### 2. サブルーチンシグネチャ\n\n明確さと自動アリティチェックのためにシグネチャを使用する。\n\n```perl\nuse v5.36;\n\n# Good: デフォルト値付きシグネチャ\nsub connect_db($host, $port = 5432, $timeout = 30) {\n    # $hostは必須、その他はデフォルトあり\n    return DBI->connect(\"dbi:Pg:host=$host;port=$port\", undef, undef, {\n        RaiseError => 1,\n        PrintError => 0,\n    });\n}\n\n# Good: 可変引数のためのスラーピーパラメータ\nsub log_message($level, @details) {\n    say \"[$level] \" . join(' ', @details);\n}\n\n# Bad: 手動引数アンパック\nsub connect_db {\n    my ($host, $port, $timeout) = @_;\n    $port    \u002F\u002F= 5432;\n    $timeout \u002F\u002F= 30;\n    # ...\n}\n```\n\n### 3. コンテキスト感度\n\nスカラーvsリストコンテキストを理解する — Perlのコアコンセプト。\n\n```perl\nuse v5.36;\n\nmy @items = (1, 2, 3, 4, 5);\n\nmy @copy  = @items;            # リストコンテキスト: すべての要素\nmy $count = @items;            # スカラーコンテキスト: カウント (5)\nsay \"Items: \" . scalar @items; # スカラーコンテキストを強制\n```\n\n### 4. 後置逆参照\n\nネストされた構造で読みやすさのために後置逆参照構文を使用する。\n\n```perl\nuse v5.36;\n\nmy $data = {\n    users => [\n        { name => 'Alice', roles => ['admin', 'user'] },\n        { name => 'Bob',   roles => ['user'] },\n    ],\n};\n\n# Good: 後置逆参照\nmy @users = $data->{users}->@*;\nmy @roles = $data->{users}[0]{roles}->@*;\nmy %first = $data->{users}[0]->%*;\n\n# Bad: 前置逆参照（チェーンで読みにくい）\nmy @users = @{ $data->{users} };\nmy @roles = @{ $data->{users}[0]{roles} };\n```\n\n### 5. `isa`演算子（5.32+）\n\n中置型チェック — `blessed($o) && $o->isa('X')`を置き換える。\n\n```perl\nuse v5.36;\nif ($obj isa 'My::Class') { $obj->do_something }\n```\n\n## エラー処理\n\n### eval\u002Fdieパターン\n\n```perl\nuse v5.36;\n\nsub parse_config($path) {\n    my $content = eval { path($path)->slurp_utf8 };\n    die \"Config error: $@\" if $@;\n    return decode_json($content);\n}\n```\n\n### Try::Tiny（信頼性の高い例外処理）\n\n```perl\nuse v5.36;\nuse Try::Tiny;\n\nsub fetch_user($id) {\n    my $user = try {\n        $db->resultset('User')->find($id)\n            \u002F\u002F die \"User $id not found\\n\";\n    }\n    catch {\n        warn \"Failed to fetch user $id: $_\";\n        undef;\n    };\n    return $user;\n}\n```\n\n### ネイティブtry\u002Fcatch（5.40+）\n\n```perl\nuse v5.40;\n\nsub divide($x, $y) {\n    try {\n        die \"Division by zero\" if $y == 0;\n        return $x \u002F $y;\n    }\n    catch ($e) {\n        warn \"Error: $e\";\n        return;\n    }\n}\n```\n\n## MooによるモダンOO\n\n軽量でモダンなOOにはMooを優先する。メタプロトコルが必要な場合のみMooseを使用する。\n\n```perl\n# Good: Mooクラス\npackage User;\nuse Moo;\nuse Types::Standard qw(Str Int ArrayRef);\nuse namespace::autoclean;\n\nhas name  => (is => 'ro', isa => Str, required => 1);\nhas email => (is => 'ro', isa => Str, required => 1);\nhas age   => (is => 'ro', isa => Int, default  => sub { 0 });\nhas roles => (is => 'ro', isa => ArrayRef[Str], default => sub { [] });\n\nsub is_admin($self) {\n    return grep { $_ eq 'admin' } $self->roles->@*;\n}\n\nsub greet($self) {\n    return \"Hello, I'm \" . $self->name;\n}\n\n1;\n\n# 使用法\nmy $user = User->new(\n    name  => 'Alice',\n    email => 'alice@example.com',\n    roles => ['admin', 'user'],\n);\n\n# Bad: ブレスされたhashref（バリデーションなし、アクセサなし）\npackage User;\nsub new {\n    my ($class, %args) = @_;\n    return bless \\%args, $class;\n}\nsub name { return $_[0]->{name} }\n1;\n```\n\n### Mooロール\n\n```perl\npackage Role::Serializable;\nuse Moo::Role;\nuse JSON::MaybeXS qw(encode_json);\nrequires 'TO_HASH';\nsub to_json($self) { encode_json($self->TO_HASH) }\n1;\n\npackage User;\nuse Moo;\nwith 'Role::Serializable';\nhas name  => (is => 'ro', required => 1);\nhas email => (is => 'ro', required => 1);\nsub TO_HASH($self) { { name => $self->name, email => $self->email } }\n1;\n```\n\n### ネイティブ`class`キーワード（5.38+、Corinna）\n\n```perl\nuse v5.38;\nuse feature 'class';\nno warnings 'experimental::class';\n\nclass Point {\n    field $x :param;\n    field $y :param;\n    method magnitude() { sqrt($x**2 + $y**2) }\n}\n\nmy $p = Point->new(x => 3, y => 4);\nsay $p->magnitude;  # 5\n```\n\n## 正規表現\n\n### 名前付きキャプチャと`\u002Fx`フラグ\n\n```perl\nuse v5.36;\n\n# Good: 読みやすさのための\u002Fxを使った名前付きキャプチャ\nmy $log_re = qr{\n    ^ (?\u003Ctimestamp> \\d{4}-\\d{2}-\\d{2} \\s \\d{2}:\\d{2}:\\d{2} )\n    \\s+ \\[ (?\u003Clevel> \\w+ ) \\]\n    \\s+ (?\u003Cmessage> .+ ) $\n}x;\n\nif ($line =~ $log_re) {\n    say \"Time: $+{timestamp}, Level: $+{level}\";\n    say \"Message: $+{message}\";\n}\n\n# Bad: 位置キャプチャ（メンテが難しい）\nif ($line =~ \u002F^(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})\\s+\\[(\\w+)\\]\\s+(.+)$\u002F) {\n    say \"Time: $1, Level: $2\";\n}\n```\n\n### プリコンパイルパターン\n\n```perl\nuse v5.36;\n\n# Good: 1回コンパイル、複数回使用\nmy $email_re = qr\u002F^[A-Za-z0-9._%+-]+\\@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$\u002F;\n\nsub validate_emails(@emails) {\n    return grep { $_ =~ $email_re } @emails;\n}\n```\n\n## データ構造\n\n### リファレンスと安全な深いアクセス\n\n```perl\nuse v5.36;\n\n# ハッシュと配列リファレンス\nmy $config = {\n    database => {\n        host => 'localhost',\n        port => 5432,\n        options => ['utf8', 'sslmode=require'],\n    },\n};\n\n# 安全な深いアクセス（どのレベルが欠落してもundefを返す）\nmy $port = $config->{database}{port};           # 5432\nmy $missing = $config->{cache}{host};           # undef、エラーなし\n\n# ハッシュスライス\nmy %subset;\n@subset{qw(host port)} = @{$config->{database}}{qw(host port)};\n\n# 配列スライス\nmy @first_two = $config->{database}{options}->@[0, 1];\n\n# 複数変数のforループ（5.36で実験的、5.40で安定）\nuse feature 'for_list';\nno warnings 'experimental::for_list';\nfor my ($key, $val) (%$config) {\n    say \"$key => $val\";\n}\n```\n\n## ファイルI\u002FO\n\n### 3引数open\n\n```perl\nuse v5.36;\n\n# Good: autodieを使った3引数open（コアモジュール、'or die'を排除）\nuse autodie;\n\nsub read_file($path) {\n    open my $fh, '\u003C:encoding(UTF-8)', $path;\n    local $\u002F;\n    my $content = \u003C$fh>;\n    close $fh;\n    return $content;\n}\n\n# Bad: 2引数open（シェルインジェクションリスク、perl-securityを参照）\nopen FH, $path;            # 絶対にしない\nopen FH, \"\u003C $path\";        # まだ悪い — モード文字列のユーザーデータ\n```\n\n### ファイル操作のPath::Tiny\n\n```perl\nuse v5.36;\nuse Path::Tiny;\n\nmy $file = path('config', 'app.json');\nmy $content = $file->slurp_utf8;\n$file->spew_utf8($new_content);\n\n# ディレクトリを反復\nfor my $child (path('src')->children(qr\u002F\\.pl$\u002F)) {\n    say $child->basename;\n}\n```\n\n## モジュール構成\n\n### 標準プロジェクトレイアウト\n\n```text\nMyApp\u002F\n├── lib\u002F\n│   └── MyApp\u002F\n│       ├── App.pm           # メインモジュール\n│       ├── Config.pm        # 設定\n│       ├── DB.pm            # データベース層\n│       └── Util.pm          # ユーティリティ\n├── bin\u002F\n│   └── myapp                # エントリーポイントスクリプト\n├── t\u002F\n│   ├── 00-load.t            # コンパイルテスト\n│   ├── unit\u002F                # ユニットテスト\n│   └── integration\u002F         # インテグレーションテスト\n├── cpanfile                 # 依存関係\n├── Makefile.PL              # ビルドシステム\n└── .perlcriticrc            # リンティング設定\n```\n\n### エクスポーターパターン\n\n```perl\npackage MyApp::Util;\nuse v5.36;\nuse Exporter 'import';\n\nour @EXPORT_OK   = qw(trim);\nour %EXPORT_TAGS = (all => \\@EXPORT_OK);\n\nsub trim($str) { $str =~ s\u002F^\\s+|\\s+$\u002F\u002Fgr }\n\n1;\n```\n\n## ツーリング\n\n### perltidy設定（.perltidyrc）\n\n```text\n-i=4        # 4スペースインデント\n-l=100      # 100文字行長\n-ci=4       # 継続インデント\n-ce         # cuddled else\n-bar        # 同じ行に開き括弧\n-nolq       # 長い引用文字列のアウトデントをしない\n```\n\n### perlcritic設定（.perlcriticrc）\n\n```ini\nseverity = 3\ntheme = core + pbp + security\n\n[InputOutput::RequireCheckedSyscalls]\nfunctions = :builtins\nexclude_functions = say print\n\n[Subroutines::ProhibitExplicitReturnUndef]\nseverity = 4\n\n[ValuesAndExpressions::ProhibitMagicNumbers]\nallowed_values = 0 1 2 -1\n```\n\n### 依存関係管理（cpanfile + carton）\n\n```bash\ncpanm App::cpanminus Carton   # ツールをインストール\ncarton install                 # cpanfileから依存関係をインストール\ncarton exec -- perl bin\u002Fmyapp  # ローカル依存関係で実行\n```\n\n```perl\n# cpanfile\nrequires 'Moo', '>= 2.005';\nrequires 'Path::Tiny';\nrequires 'JSON::MaybeXS';\nrequires 'Try::Tiny';\n\non test => sub {\n    requires 'Test2::V0';\n    requires 'Test::MockModule';\n};\n```\n\n## クイックリファレンス: モダンPerlイディオム\n\n| レガシーパターン | モダンな置き換え |\n|---|---|\n| `use strict; use warnings;` | `use v5.36;` |\n| `my ($x, $y) = @_;` | `sub foo($x, $y) { ... }` |\n| `@{ $ref }` | `$ref->@*` |\n| `%{ $ref }` | `$ref->%*` |\n| `open FH, \"\u003C $file\"` | `open my $fh, '\u003C:encoding(UTF-8)', $file` |\n| `blessed hashref` | 型付きの`Moo`クラス |\n| `$1, $2, $3` | `$+{name}`（名前付きキャプチャ） |\n| `eval { }; if ($@)` | `Try::Tiny`またはネイティブ`try\u002Fcatch`（5.40+） |\n| `BEGIN { require Exporter; }` | `use Exporter 'import';` |\n| 手動ファイル操作 | `Path::Tiny` |\n| `blessed($o) && $o->isa('X')` | `$o isa 'X'`（5.32+） |\n| `builtin::true \u002F false` | `use builtin 'true', 'false';`（5.36+、実験的） |\n\n## アンチパターン\n\n```perl\n# 1. 2引数open（セキュリティリスク）\nopen FH, $filename;                     # 絶対にしない\n\n# 2. 間接オブジェクト構文（あいまいな解析）\nmy $obj = new Foo(bar => 1);            # Bad\nmy $obj = Foo->new(bar => 1);           # Good\n\n# 3. $_への過度の依存\nmap { process($_) } grep { validate($_) } @items;  # 追うのが難しい\nmy @valid = grep { validate($_) } @items;           # より良い: 分割する\nmy @results = map { process($_) } @valid;\n\n# 4. strictリファレンスの無効化\nno strict 'refs';                        # ほぼ常に間違い\n${\"My::Package::$var\"} = $value;         # 代わりにhashを使用\n\n# 5. グローバル変数を設定として使用\nour $TIMEOUT = 30;                       # Bad: 可変グローバル\nuse constant TIMEOUT => 30;              # Better: 定数\n# Best: デフォルト付きのMoo属性\n\n# 6. モジュールロードのための文字列eval\neval \"require $module\";                  # Bad: コードインジェクションリスク\neval \"use $module\";                      # Bad\nuse Module::Runtime 'require_module';    # Good: 安全なモジュールロード\nrequire_module($module);\n```\n\n**忘れないこと**: モダンなPerlはクリーン、読みやすく、安全である。`use v5.36`に定型文を処理させ、オブジェクトにはMooを使用し、手作りのソリューションよりCPANの実績あるモジュールを優先する。\n","# モダンPerl開発パターン\n\n堅牢でメンテナブルなアプリケーションを構築するためのイディオマティックなPerl 5.36+パターンとベストプラクティス。\n\n## アクティベートするタイミング\n\n- 新しいPerlコードまたはモジュールを書くとき\n- イディオム準拠のためにPerlコードをレビューするとき\n- レガシーPerlをモダンな標準にリファクタリングするとき\n- PerlモジュールのアーキテクチャをDesignするとき\n- 5.36以前のコードをモダンなPerlに移行するとき\n\n## 仕組み\n\nこれらのパターンをModern Perl 5.36+のデフォルトへのバイアスとして適用する: シグネチャ、明示的なモジュール、集中的なエラー処理、テスト可能な境界。以下の例は出発点としてコピーし、目の前の実際のアプリ、依存スタック、デプロイモデルに合わせて締め付けることを意図している。\n\n## コア原則\n\n### 1. `v5.36`プラグマの使用\n\n単一の`use v5.36`が古い定型文を置き換え、strict、warnings、サブルーチンシグネチャを有効化する。\n\n```perl\n# Good: モダンなプリアンブル\nuse v5.36;\n\nsub greet($name) {\n    say \"Hello, $name!\";\n}\n\n# Bad: レガシーな定型文\nuse strict;\nuse warnings;\nuse feature 'say', 'signatures';\nno warnings 'experimental::signatures';\n\nsub greet {\n    my ($name) = @_;\n    say \"Hello, $name!\";\n}\n```\n\n### 2. サブルーチンシグネチャ\n\n明確さと自動アリティチェックのためにシグネチャを使用する。\n\n```perl\nuse v5.36;\n\n# Good: デフォルト値付きシグネチャ\nsub connect_db($host, $port = 5432, $timeout = 30) {\n    # $hostは必須、その他はデフォルトあり\n    return DBI->connect(\"dbi:Pg:host=$host;port=$port\", undef, undef, {\n        RaiseError => 1,\n        PrintError => 0,\n    });\n}\n\n# Good: 可変引数のためのスラーピーパラメータ\nsub log_message($level, @details) {\n    say \"[$level] \" . join(' ', @details);\n}\n\n# Bad: 手動引数アンパック\nsub connect_db {\n    my ($host, $port, $timeout) = @_;\n    $port    \u002F\u002F= 5432;\n    $timeout \u002F\u002F= 30;\n    # ...\n}\n```\n\n### 3. コンテキスト感度\n\nスカラーvsリストコンテキストを理解する — Perlのコアコンセプト。\n\n```perl\nuse v5.36;\n\nmy @items = (1, 2, 3, 4, 5);\n\nmy @copy  = @items;            # リストコンテキスト: すべての要素\nmy $count = @items;            # スカラーコンテキスト: カウント (5)\nsay \"Items: \" . scalar @items; # スカラーコンテキストを強制\n```\n\n### 4. 後置逆参照\n\nネストされた構造で読みやすさのために後置逆参照構文を使用する。\n\n```perl\nuse v5.36;\n\nmy $data = {\n    users => [\n        { name => 'Alice', roles => ['admin', 'user'] },\n        { name => 'Bob',   roles => ['user'] },\n    ],\n};\n\n# Good: 後置逆参照\nmy @users = $data->{users}->@*;\nmy @roles = $data->{users}[0]{roles}->@*;\nmy %first = $data->{users}[0]->%*;\n\n# Bad: 前置逆参照（チェーンで読みにくい）\nmy @users = @{ $data->{users} };\nmy @roles = @{ $data->{users}[0]{roles} };\n```\n\n### 5. `isa`演算子（5.32+）\n\n中置型チェック — `blessed($o) && $o->isa('X')`を置き換える。\n\n```perl\nuse v5.36;\nif ($obj isa 'My::Class') { $obj->do_something }\n```\n\n## エラー処理\n\n### eval\u002Fdieパターン\n\n```perl\nuse v5.36;\n\nsub parse_config($path) {\n    my $content = eval { path($path)->slurp_utf8 };\n    die \"Config error: $@\" if $@;\n    return decode_json($content);\n}\n```\n\n### Try::Tiny（信頼性の高い例外処理）\n\n```perl\nuse v5.36;\nuse Try::Tiny;\n\nsub fetch_user($id) {\n    my $user = try {\n        $db->resultset('User')->find($id)\n            \u002F\u002F die \"User $id not found\\n\";\n    }\n    catch {\n        warn \"Failed to fetch user $id: $_\";\n        undef;\n    };\n    return $user;\n}\n```\n\n### ネイティブtry\u002Fcatch（5.40+）\n\n```perl\nuse v5.40;\n\nsub divide($x, $y) {\n    try {\n        die \"Division by zero\" if $y == 0;\n        return $x \u002F $y;\n    }\n    catch ($e) {\n        warn \"Error: $e\";\n        return;\n    }\n}\n```\n\n## MooによるモダンOO\n\n軽量でモダンなOOにはMooを優先する。メタプロトコルが必要な場合のみMooseを使用する。\n\n```perl\n# Good: Mooクラス\npackage User;\nuse Moo;\nuse Types::Standard qw(Str Int ArrayRef);\nuse namespace::autoclean;\n\nhas name  => (is => 'ro', isa => Str, required => 1);\nhas email => (is => 'ro', isa => Str, required => 1);\nhas age   => (is => 'ro', isa => Int, default  => sub { 0 });\nhas roles => (is => 'ro', isa => ArrayRef[Str], default => sub { [] });\n\nsub is_admin($self) {\n    return grep { $_ eq 'admin' } $self->roles->@*;\n}\n\nsub greet($self) {\n    return \"Hello, I'm \" . $self->name;\n}\n\n1;\n\n# 使用法\nmy $user = User->new(\n    name  => 'Alice',\n    email => 'alice@example.com',\n    roles => ['admin', 'user'],\n);\n\n# Bad: ブレスされたhashref（バリデーションなし、アクセサなし）\npackage User;\nsub new {\n    my ($class, %args) = @_;\n    return bless \\%args, $class;\n}\nsub name { return $_[0]->{name} }\n1;\n```\n\n### Mooロール\n\n```perl\npackage Role::Serializable;\nuse Moo::Role;\nuse JSON::MaybeXS qw(encode_json);\nrequires 'TO_HASH';\nsub to_json($self) { encode_json($self->TO_HASH) }\n1;\n\npackage User;\nuse Moo;\nwith 'Role::Serializable';\nhas name  => (is => 'ro', required => 1);\nhas email => (is => 'ro', required => 1);\nsub TO_HASH($self) { { name => $self->name, email => $self->email } }\n1;\n```\n\n### ネイティブ`class`キーワード（5.38+、Corinna）\n\n```perl\nuse v5.38;\nuse feature 'class';\nno warnings 'experimental::class';\n\nclass Point {\n    field $x :param;\n    field $y :param;\n    method magnitude() { sqrt($x**2 + $y**2) }\n}\n\nmy $p = Point->new(x => 3, y => 4);\nsay $p->magnitude;  # 5\n```\n\n## 正規表現\n\n### 名前付きキャプチャと`\u002Fx`フラグ\n\n```perl\nuse v5.36;\n\n# Good: 読みやすさのための\u002Fxを使った名前付きキャプチャ\nmy $log_re = qr{\n    ^ (?\u003Ctimestamp> \\d{4}-\\d{2}-\\d{2} \\s \\d{2}:\\d{2}:\\d{2} )\n    \\s+ \\[ (?\u003Clevel> \\w+ ) \\]\n    \\s+ (?\u003Cmessage> .+ ) $\n}x;\n\nif ($line =~ $log_re) {\n    say \"Time: $+{timestamp}, Level: $+{level}\";\n    say \"Message: $+{message}\";\n}\n\n# Bad: 位置キャプチャ（メンテが難しい）\nif ($line =~ \u002F^(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})\\s+\\[(\\w+)\\]\\s+(.+)$\u002F) {\n    say \"Time: $1, Level: $2\";\n}\n```\n\n### プリコンパイルパターン\n\n```perl\nuse v5.36;\n\n# Good: 1回コンパイル、複数回使用\nmy $email_re = qr\u002F^[A-Za-z0-9._%+-]+\\@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$\u002F;\n\nsub validate_emails(@emails) {\n    return grep { $_ =~ $email_re } @emails;\n}\n```\n\n## データ構造\n\n### リファレンスと安全な深いアクセス\n\n```perl\nuse v5.36;\n\n# ハッシュと配列リファレンス\nmy $config = {\n    database => {\n        host => 'localhost',\n        port => 5432,\n        options => ['utf8', 'sslmode=require'],\n    },\n};\n\n# 安全な深いアクセス（どのレベルが欠落してもundefを返す）\nmy $port = $config->{database}{port};           # 5432\nmy $missing = $config->{cache}{host};           # undef、エラーなし\n\n# ハッシュスライス\nmy %subset;\n@subset{qw(host port)} = @{$config->{database}}{qw(host port)};\n\n# 配列スライス\nmy @first_two = $config->{database}{options}->@[0, 1];\n\n# 複数変数のforループ（5.36で実験的、5.40で安定）\nuse feature 'for_list';\nno warnings 'experimental::for_list';\nfor my ($key, $val) (%$config) {\n    say \"$key => $val\";\n}\n```\n\n## ファイルI\u002FO\n\n### 3引数open\n\n```perl\nuse v5.36;\n\n# Good: autodieを使った3引数open（コアモジュール、'or die'を排除）\nuse autodie;\n\nsub read_file($path) {\n    open my $fh, '\u003C:encoding(UTF-8)', $path;\n    local $\u002F;\n    my $content = \u003C$fh>;\n    close $fh;\n    return $content;\n}\n\n# Bad: 2引数open（シェルインジェクションリスク、perl-securityを参照）\nopen FH, $path;            # 絶対にしない\nopen FH, \"\u003C $path\";        # まだ悪い — モード文字列のユーザーデータ\n```\n\n### ファイル操作のPath::Tiny\n\n```perl\nuse v5.36;\nuse Path::Tiny;\n\nmy $file = path('config', 'app.json');\nmy $content = $file->slurp_utf8;\n$file->spew_utf8($new_content);\n\n# ディレクトリを反復\nfor my $child (path('src')->children(qr\u002F\\.pl$\u002F)) {\n    say $child->basename;\n}\n```\n\n## モジュール構成\n\n### 標準プロジェクトレイアウト\n\n```text\nMyApp\u002F\n├── lib\u002F\n│   └── MyApp\u002F\n│       ├── App.pm           # メインモジュール\n│       ├── Config.pm        # 設定\n│       ├── DB.pm            # データベース層\n│       └── Util.pm          # ユーティリティ\n├── bin\u002F\n│   └── myapp                # エントリーポイントスクリプト\n├── t\u002F\n│   ├── 00-load.t            # コンパイルテスト\n│   ├── unit\u002F                # ユニットテスト\n│   └── integration\u002F         # インテグレーションテスト\n├── cpanfile                 # 依存関係\n├── Makefile.PL              # ビルドシステム\n└── .perlcriticrc            # リンティング設定\n```\n\n### エクスポーターパターン\n\n```perl\npackage MyApp::Util;\nuse v5.36;\nuse Exporter 'import';\n\nour @EXPORT_OK   = qw(trim);\nour %EXPORT_TAGS = (all => \\@EXPORT_OK);\n\nsub trim($str) { $str =~ s\u002F^\\s+|\\s+$\u002F\u002Fgr }\n\n1;\n```\n\n## ツーリング\n\n### perltidy設定（.perltidyrc）\n\n```text\n-i=4        # 4スペースインデント\n-l=100      # 100文字行長\n-ci=4       # 継続インデント\n-ce         # cuddled else\n-bar        # 同じ行に開き括弧\n-nolq       # 長い引用文字列のアウトデントをしない\n```\n\n### perlcritic設定（.perlcriticrc）\n\n```ini\nseverity = 3\ntheme = core + pbp + security\n\n[InputOutput::RequireCheckedSyscalls]\nfunctions = :builtins\nexclude_functions = say print\n\n[Subroutines::ProhibitExplicitReturnUndef]\nseverity = 4\n\n[ValuesAndExpressions::ProhibitMagicNumbers]\nallowed_values = 0 1 2 -1\n```\n\n### 依存関係管理（cpanfile + carton）\n\n```bash\ncpanm App::cpanminus Carton   # ツールをインストール\ncarton install                 # cpanfileから依存関係をインストール\ncarton exec -- perl bin\u002Fmyapp  # ローカル依存関係で実行\n```\n\n```perl\n# cpanfile\nrequires 'Moo', '>= 2.005';\nrequires 'Path::Tiny';\nrequires 'JSON::MaybeXS';\nrequires 'Try::Tiny';\n\non test => sub {\n    requires 'Test2::V0';\n    requires 'Test::MockModule';\n};\n```\n\n## クイックリファレンス: モダンPerlイディオム\n\n| レガシーパターン | モダンな置き換え |\n|---|---|\n| `use strict; use warnings;` | `use v5.36;` |\n| `my ($x, $y) = @_;` | `sub foo($x, $y) { ... }` |\n| `@{ $ref }` | `$ref->@*` |\n| `%{ $ref }` | `$ref->%*` |\n| `open FH, \"\u003C $file\"` | `open my $fh, '\u003C:encoding(UTF-8)', $file` |\n| `blessed hashref` | 型付きの`Moo`クラス |\n| `$1, $2, $3` | `$+{name}`（名前付きキャプチャ） |\n| `eval { }; if ($@)` | `Try::Tiny`またはネイティブ`try\u002Fcatch`（5.40+） |\n| `BEGIN { require Exporter; }` | `use Exporter 'import';` |\n| 手動ファイル操作 | `Path::Tiny` |\n| `blessed($o) && $o->isa('X')` | `$o isa 'X'`（5.32+） |\n| `builtin::true \u002F false` | `use builtin 'true', 'false';`（5.36+、実験的） |\n\n## アンチパターン\n\n```perl\n# 1. 2引数open（セキュリティリスク）\nopen FH, $filename;                     # 絶対にしない\n\n# 2. 間接オブジェクト構文（あいまいな解析）\nmy $obj = new Foo(bar => 1);            # Bad\nmy $obj = Foo->new(bar => 1);           # Good\n\n# 3. $_への過度の依存\nmap { process($_) } grep { validate($_) } @items;  # 追うのが難しい\nmy @valid = grep { validate($_) } @items;           # より良い: 分割する\nmy @results = map { process($_) } @valid;\n\n# 4. strictリファレンスの無効化\nno strict 'refs';                        # ほぼ常に間違い\n${\"My::Package::$var\"} = $value;         # 代わりにhashを使用\n\n# 5. グローバル変数を設定として使用\nour $TIMEOUT = 30;                       # Bad: 可変グローバル\nuse constant TIMEOUT => 30;              # Better: 定数\n# Best: デフォルト付きのMoo属性\n\n# 6. モジュールロードのための文字列eval\neval \"require $module\";                  # Bad: コードインジェクションリスク\neval \"use $module\";                      # Bad\nuse Module::Runtime 'require_module';    # Good: 安全なモジュールロード\nrequire_module($module);\n```\n\n**忘れないこと**: モダンなPerlはクリーン、読みやすく、安全である。`use v5.36`に定型文を処理させ、オブジェクトにはMooを使用し、手作りのソリューションよりCPANの実績あるモジュールを優先する。\n",{"name":5,"origin":24,"description":7},"ECC","main","57e7aa6b6e03bce1a7d7862ba9c2ec312f7f19b5","src\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fdocs\u002Fja-JP\u002Fskills\u002Fperl-patterns",0,"https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee","https:\u002F\u002Fwithcyril.me\u002F","Hi, I’m Julian Cyril D, a Computer Science and Business Systems student at PSNACET.\r\nI’m passionate about full-stack development, UI\u002FUX design, and building sma","2026-11-04 23:28:50",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add Cyrilthetecchieee\u002Fcyril-code- --skill perl-patterns",{"tool":40,"command":41},"bunx","bunx skills add Cyrilthetecchieee\u002Fcyril-code- --skill perl-patterns",{"tool":43,"command":44},"pnpm","pnpm dlx skills add Cyrilthetecchieee\u002Fcyril-code- --skill perl-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fdocs\u002Fja-JP\u002Fskills\u002Fperl-patterns\u002FSKILL.md",true,[],[49,58,65,73,80,87],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":54,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7AQV6CYX8RMC78420V9WZ62","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7AQV2895N3S1MEX6K76G6G2","youtube-downloader","Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fvideo-downloader\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":69,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7AQTRNX62DNKVZ5GXEHRBKB","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7AQTNNVHAAN9H6DA8T6ZVE0","template-skill","Replace with description of the skill and when Claude should use it.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftemplate-skill\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7AQTJ3MQ6AKX152MEX2MYCC","tailored-resume-generator","Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftailored-resume-generator\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":91,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7AQTD7D5MYET2YWG7HG9WM3","slack-gif-creator","Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like \"make me a GIF for Slack of X doing Y\".","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FSKILL.md",[],[]]