[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78FEWBE6VRV1NMAWBPZ03GC":3,"skill-same:01M78FEWBE6VRV1NMAWBPZ03GC":75},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M78FEWBE6VRV1NMAWBPZ03GC","lang-bash",null,"Production-grade Bash shell engineering, strict mode (set -euo pipefail), comprehensive quoting hygiene, trap-driven deterministic resource cleanup, safe file locking, and zero-eval security discipline.","poppyTM\u002Foride","poppyTM","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F339400917?v=4","01M78F6YNKFR5S5JQR27X9F09Z","Poppy Team","01M78F6YP8ZZTRES9X8Q2ZAD21",1,"MIT","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Flang-bash\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: lang-bash\ndescription: Production-grade Bash shell engineering, strict mode (set -euo pipefail), comprehensive quoting hygiene, trap-driven deterministic resource cleanup, safe file locking, and zero-eval security discipline.\n---\n\n# Bash Strict Defensive Engineering Contract\n\n## 1. Purpose\nDefine, author, and audit hardened, deterministic shell scripts in Bash, guaranteeing strict error propagation (`set -euo pipefail`), total quoting discipline to eliminate word splitting and globbing vulnerabilities, deterministic trap-driven cleanup of temporary resources, atomic file operations, and zero code injection risks (`eval` proscription).\n\n---\n\n## 2. Use When\n- Authoring CI\u002FCD pipeline automation, developer environment bootstrap scripts, or build runners.\n- Implementing local CLI wrappers, tooling orchestrators, or deployment hooks.\n- Automating file system maintenance, backup routines, or container entrypoints.\n- Managing low-level POSIX process orchestration where higher-level runtimes are unavailable.\n\n---\n\n## 3. Do Not Use When\n- Building complex domain logic, data models, or microservices (use Go, Rust, or Python).\n- Implementing mathematical calculations, 3D graphics, or raw memory allocations.\n- Complex multi-threaded concurrent applications requiring fine-grained synchronization.\n\n---\n\n## 4. Required Context\nBefore writing or refactoring Bash scripts, verify:\n1. **Target Shell Interpreter**: `bash` (version 4.0+) vs POSIX `\u002Fbin\u002Fsh` compatibility requirements.\n2. **Environment Constraints**: Operating system tools (GNU coreutils on Linux vs BSD coreutils on macOS).\n3. **Execution Privileges**: Unprivileged user execution vs elevated root\u002Fsudo operations.\n4. **Interactive vs Non-Interactive**: Terminal output (colors, progress indicators) vs automated headless CI.\n\n---\n\n## 5. Procedure\n\n### Step 1: Strict Execution Baseline\n1. Begin every Bash script with the standard shebang and strict safety flags:\n   ```bash\n   #!\u002Fusr\u002Fbin\u002Fenv bash\n   set -euo pipefail\n   IFS=$'\\n\\t'\n   ```\n   - `-e`: Exit immediately if any pipeline or command fails.\n   - `-u`: Treat unset variables and parameters as errors and exit immediately.\n   - `-o pipefail`: Return the exit status of the last command in the pipeline that failed, preventing silent intermediate pipe failures.\n   - `IFS=$'\\n\\t'`: Split only on newlines and tabs by default, avoiding dangerous word splitting on spaces.\n\n### Step 2: Parameter & Variable Expansion Discipline\n1. Quote every variable and command substitution without exception:\n   ```bash\n   # CORRECT\n   rm -rf -- \"${TARGET_DIR:?Target directory must be defined}\"\n   cp -- \"$source_file\" \"$dest_file\"\n\n   # PROHIBITED (Catastrophic vulnerability if TARGET_DIR is unset or contains spaces)\n   # rm -rf $TARGET_DIR\n   ```\n2. Distinguish array expansions:\n   - `\"${array[@]}\"`: Expands each element as a separate quoted word (REQUIRED).\n   - `\"${array[*]}\"`: Concatenates all elements into a single word separated by IFS.\n3. Use defensive parameter expansion:\n   - `${var:-default}`: Provide fallback default if unset.\n   - `${var:?error message}`: Abort with error message if unset or null.\n\n### Step 3: Trap-Driven Resource Cleanup\n1. Never leave temporary files or directories upon script termination or interruption.\n2. Pair every temporary creation (`mktemp`) with an immediate `trap` handler:\n   ```bash\n   WORK_DIR=\"$(mktemp -d -t \"prumo-runner-XXXXXX\")\"\n   cleanup() {\n       local exit_code=$?\n       trap - EXIT INT TERM HUP\n       rm -rf -- \"$WORK_DIR\"\n       exit \"$exit_code\"\n   }\n   trap cleanup EXIT INT TERM HUP\n   ```\n3. Ensure trap handlers preserve the original exit code of the failing command.\n\n### Step 4: Atomic Locking & Concurrency Defense\n1. When multiple scripts or background processes may access shared resources, use atomic directory creation or `flock`:\n   ```bash\n   LOCKDIR=\"\u002Ftmp\u002Fprumo-build.lock\"\n   if ! mkdir \"$LOCKDIR\" 2>\u002Fdev\u002Fnull; then\n       echo \"ERROR: Process is already running (locked by $LOCKDIR)\" >&2\n       exit 1\n   fi\n   trap 'rmdir \"$LOCKDIR\" 2>\u002Fdev\u002Fnull || true' EXIT\n   ```\n\n### Step 5: Input Parsing & Dependency Verification\n1. Validate external command dependencies before execution:\n   ```bash\n   for cmd in git jq curl; do\n       command -v \"$cmd\" >\u002Fdev\u002Fnull 2>&1 || {\n           echo \"ERROR: Required command '$cmd' is not installed or not in PATH.\" >&2\n           exit 1\n       }\n   done\n   ```\n2. Parse command-line flags defensively using POSIX `getopts` or explicit flag matching with full `--help` documentation.\n\n---\n\n## 6. Decision Rules\n1. **Absolute Eval Proscription**: Never call `eval` on dynamic, external, or user-supplied variables. Use arrays or bash indirect parameter expansions (`${!var}`) instead.\n2. **Never Ignore Exit Codes**: If a command is legitimately expected to fail, handle it explicitly:\n   ```bash\n   command_that_may_fail || true\n   # or\n   if ! result=$(command); then ...\n   ```\n3. **No Unchecked `cd`**: Never execute `cd` without an explicit guard:\n   ```bash\n   cd -- \"$target_dir\" || { echo \"Failed to enter $target_dir\" >&2; exit 1; }\n   ```\n4. **ShellCheck Compliance**: All scripts must pass ShellCheck without warnings when available.\n\n---\n\n## 7. Evidence Required\n- **Syntax Check**: `bash -n script.sh` exits with 0 errors.\n- **Strict Mode Verification**: `set -euo pipefail` confirmed at head of script.\n- **Trap Cleanup Execution**: Automated test asserting temporary directories are deleted upon exit.\n\n---\n\n## 8. Output Contract\nA production Bash artifact must provide:\n1. Hardened executable script (`chmod +x script.sh`) with `set -euo pipefail`.\n2. Fully quoted variable expansions and array handling.\n3. Clean error reporting with output directed to stderr (`>&2`).\n4. Trap signal handlers covering `EXIT`, `INT`, `TERM`, `HUP`.\n\n---\n\n## 9. Stop Conditions\n- Script syntax verified with `bash -n`.\n- All temporary directories cleaned up on both success and early error exits.\n- No unquoted parameter expansions.\n\n---\n\n## 10. Escalation Rules\n- Escalate to Lead Architect if script complexity exceeds 300 lines of procedural shell code; refactor into a compiled language (Go, Rust).\n- Escalate to Security Officer if a script requires root privileges or handles secrets\u002Fcredentials.\n","# Bash Strict Defensive Engineering Contract\n\n## 1. Purpose\nDefine, author, and audit hardened, deterministic shell scripts in Bash, guaranteeing strict error propagation (`set -euo pipefail`), total quoting discipline to eliminate word splitting and globbing vulnerabilities, deterministic trap-driven cleanup of temporary resources, atomic file operations, and zero code injection risks (`eval` proscription).\n\n---\n\n## 2. Use When\n- Authoring CI\u002FCD pipeline automation, developer environment bootstrap scripts, or build runners.\n- Implementing local CLI wrappers, tooling orchestrators, or deployment hooks.\n- Automating file system maintenance, backup routines, or container entrypoints.\n- Managing low-level POSIX process orchestration where higher-level runtimes are unavailable.\n\n---\n\n## 3. Do Not Use When\n- Building complex domain logic, data models, or microservices (use Go, Rust, or Python).\n- Implementing mathematical calculations, 3D graphics, or raw memory allocations.\n- Complex multi-threaded concurrent applications requiring fine-grained synchronization.\n\n---\n\n## 4. Required Context\nBefore writing or refactoring Bash scripts, verify:\n1. **Target Shell Interpreter**: `bash` (version 4.0+) vs POSIX `\u002Fbin\u002Fsh` compatibility requirements.\n2. **Environment Constraints**: Operating system tools (GNU coreutils on Linux vs BSD coreutils on macOS).\n3. **Execution Privileges**: Unprivileged user execution vs elevated root\u002Fsudo operations.\n4. **Interactive vs Non-Interactive**: Terminal output (colors, progress indicators) vs automated headless CI.\n\n---\n\n## 5. Procedure\n\n### Step 1: Strict Execution Baseline\n1. Begin every Bash script with the standard shebang and strict safety flags:\n   ```bash\n   #!\u002Fusr\u002Fbin\u002Fenv bash\n   set -euo pipefail\n   IFS=$'\\n\\t'\n   ```\n   - `-e`: Exit immediately if any pipeline or command fails.\n   - `-u`: Treat unset variables and parameters as errors and exit immediately.\n   - `-o pipefail`: Return the exit status of the last command in the pipeline that failed, preventing silent intermediate pipe failures.\n   - `IFS=$'\\n\\t'`: Split only on newlines and tabs by default, avoiding dangerous word splitting on spaces.\n\n### Step 2: Parameter & Variable Expansion Discipline\n1. Quote every variable and command substitution without exception:\n   ```bash\n   # CORRECT\n   rm -rf -- \"${TARGET_DIR:?Target directory must be defined}\"\n   cp -- \"$source_file\" \"$dest_file\"\n\n   # PROHIBITED (Catastrophic vulnerability if TARGET_DIR is unset or contains spaces)\n   # rm -rf $TARGET_DIR\n   ```\n2. Distinguish array expansions:\n   - `\"${array[@]}\"`: Expands each element as a separate quoted word (REQUIRED).\n   - `\"${array[*]}\"`: Concatenates all elements into a single word separated by IFS.\n3. Use defensive parameter expansion:\n   - `${var:-default}`: Provide fallback default if unset.\n   - `${var:?error message}`: Abort with error message if unset or null.\n\n### Step 3: Trap-Driven Resource Cleanup\n1. Never leave temporary files or directories upon script termination or interruption.\n2. Pair every temporary creation (`mktemp`) with an immediate `trap` handler:\n   ```bash\n   WORK_DIR=\"$(mktemp -d -t \"prumo-runner-XXXXXX\")\"\n   cleanup() {\n       local exit_code=$?\n       trap - EXIT INT TERM HUP\n       rm -rf -- \"$WORK_DIR\"\n       exit \"$exit_code\"\n   }\n   trap cleanup EXIT INT TERM HUP\n   ```\n3. Ensure trap handlers preserve the original exit code of the failing command.\n\n### Step 4: Atomic Locking & Concurrency Defense\n1. When multiple scripts or background processes may access shared resources, use atomic directory creation or `flock`:\n   ```bash\n   LOCKDIR=\"\u002Ftmp\u002Fprumo-build.lock\"\n   if ! mkdir \"$LOCKDIR\" 2>\u002Fdev\u002Fnull; then\n       echo \"ERROR: Process is already running (locked by $LOCKDIR)\" >&2\n       exit 1\n   fi\n   trap 'rmdir \"$LOCKDIR\" 2>\u002Fdev\u002Fnull || true' EXIT\n   ```\n\n### Step 5: Input Parsing & Dependency Verification\n1. Validate external command dependencies before execution:\n   ```bash\n   for cmd in git jq curl; do\n       command -v \"$cmd\" >\u002Fdev\u002Fnull 2>&1 || {\n           echo \"ERROR: Required command '$cmd' is not installed or not in PATH.\" >&2\n           exit 1\n       }\n   done\n   ```\n2. Parse command-line flags defensively using POSIX `getopts` or explicit flag matching with full `--help` documentation.\n\n---\n\n## 6. Decision Rules\n1. **Absolute Eval Proscription**: Never call `eval` on dynamic, external, or user-supplied variables. Use arrays or bash indirect parameter expansions (`${!var}`) instead.\n2. **Never Ignore Exit Codes**: If a command is legitimately expected to fail, handle it explicitly:\n   ```bash\n   command_that_may_fail || true\n   # or\n   if ! result=$(command); then ...\n   ```\n3. **No Unchecked `cd`**: Never execute `cd` without an explicit guard:\n   ```bash\n   cd -- \"$target_dir\" || { echo \"Failed to enter $target_dir\" >&2; exit 1; }\n   ```\n4. **ShellCheck Compliance**: All scripts must pass ShellCheck without warnings when available.\n\n---\n\n## 7. Evidence Required\n- **Syntax Check**: `bash -n script.sh` exits with 0 errors.\n- **Strict Mode Verification**: `set -euo pipefail` confirmed at head of script.\n- **Trap Cleanup Execution**: Automated test asserting temporary directories are deleted upon exit.\n\n---\n\n## 8. Output Contract\nA production Bash artifact must provide:\n1. Hardened executable script (`chmod +x script.sh`) with `set -euo pipefail`.\n2. Fully quoted variable expansions and array handling.\n3. Clean error reporting with output directed to stderr (`>&2`).\n4. Trap signal handlers covering `EXIT`, `INT`, `TERM`, `HUP`.\n\n---\n\n## 9. Stop Conditions\n- Script syntax verified with `bash -n`.\n- All temporary directories cleaned up on both success and early error exits.\n- No unquoted parameter expansions.\n\n---\n\n## 10. Escalation Rules\n- Escalate to Lead Architect if script complexity exceeds 300 lines of procedural shell code; refactor into a compiled language (Go, Rust).\n- Escalate to Security Officer if a script requires root privileges or handles secrets\u002Fcredentials.\n",{"name":5,"description":7},"main","1cd515630b8ceb57777d466bee4970fe7c2e30e0",".ai\u002Fskills\u002Flang-bash",0,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride","https:\u002F\u002Fgithub.com\u002FpoppyTM","https:\u002F\u002Fpoppy.lat","Construímos linguagens de programação e ferramentas para quem lê código com o mesmo cuidado com que escreve.","2026-09-30 10:15:52",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add poppyTM\u002Foride --skill lang-bash",{"tool":39,"command":40},"bunx","bunx skills add poppyTM\u002Foride --skill lang-bash",{"tool":42,"command":43},"pnpm","pnpm dlx skills add poppyTM\u002Foride --skill lang-bash","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Flang-bash\u002FSKILL.md",true,[47,53,59,63,67,71],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"checks\u002Fbash-rules.md","REFERENCE","参考文档",1573,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Flang-bash\u002Fchecks\u002Fbash-rules.md",{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"examples\u002Fsafe_runner.sh","SCRIPT","脚本",3087,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Flang-bash\u002Fexamples\u002Fsafe_runner.sh",{"path":60,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":61,"sourceHtmlUrl":62},"manifest.json",1759,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Flang-bash\u002Fmanifest.json",{"path":64,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Fbash-defensive.md",2531,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Flang-bash\u002Freferences\u002Fbash-defensive.md",{"path":68,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":69,"sourceHtmlUrl":70},"scripts\u002Fverify.sh",1982,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Flang-bash\u002Fscripts\u002Fverify.sh",{"path":72,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":73,"sourceHtmlUrl":74},"templates\u002Fbash-verification-report.md",1437,"https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Flang-bash\u002Ftemplates\u002Fbash-verification-report.md",[76,82,88,95,102,109],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M78FHQN254KEH0DETXT5JM29","zoom-reflow","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Fzoom-reflow\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M78FHP1880S695V8GQEE0RXK","wireframe-styleguide","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Fwireframe-styleguide\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M78FHHYM6AN2H819FABW01DZ","visual-regression","Pixel-by-pixel snapshot testing, Playwright integration, dynamic content masking, deterministic font rendering, and cross-browser CI gates","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Fvisual-regression\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M78FHE53D8DD0QVRY5C37DA4","ui-implementation","Component-driven UI implementation, multi-state matrix (default, hover, focus-visible, active, disabled, loading, empty, error), DTCG design tokens, responsive layout contracts, and accessibility tree mapping.","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Fui-implementation\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":19},"01M78FHBJ1KXFF734GFE509TBJ","tui-editor-engine","Text buffer and editing semantics for a terminal code editor — index conversion, transaction-first editing, multi-cursor invariants, undo grouping, and large-file behaviour.","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Ftui-editor-engine\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M78FH9X6CPJX1H61ZDWTTVW8","tree-sitter-context-indexing","https:\u002F\u002Fgithub.com\u002FpoppyTM\u002Foride\u002Fblob\u002Fmain\u002F.ai\u002Fskills\u002Ftree-sitter-context-indexing\u002FSKILL.md",[],[]]