Skillpedia
الوكلاء48k · #3701

ai-coding-agent-guardrails

ما الذي تفعله

تساعد هذه المهارة على حماية فرق البرمجة عبر وضع قواعد واضحة لما يستطيع مساعدو الذكاء الاصطناعي فعله وما لا يستطيعون. تمنعهم من الوصول إلى المعلومات الحساسة، أو تشغيل الأوامر الخطيرة، أو تعديل أجزاء حساسة من الشيفرة دون إذن.

متى تستخدمها

  • ✓عند استخدام مساعدي الذكاء الاصطناعي في البرمجة ضمن فريق.
  • ✓عندما تريد منع الذكاء الاصطناعي من تسريب كلمات المرور أو مفاتيح الأسرار.
  • ✓للتأكد من أن الذكاء الاصطناعي لا يحذف بيانات مهمة ولا يُجري تغييرات غير مصرح بها.

رابط المهارة

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/ai-coding-agent-guardrails/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/ai-coding-agent-guardrails/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“اضبط مساعد الذكاء الاصطناعي بحيث لا يصل إلى ملفات .env ولا ينفذ أوامر الحذف.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تضع القواعد في ملفات الإعداد، وتحدد الملفات التي يستطيع الذكاء الاصطناعي قراءتها أو تعديلها، والأوامر التي يستطيع تشغيلها، والمعلومات الحساسة التي يتجاهلها. وهذا ينشئ بيئة عمل آمنة.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

AI Coding Agent Guardrails

Secure the use of AI coding agents across engineering teams. This skill covers permission boundaries, secret protection, sandbox isolation, code review gates, and audit trails for Claude Code, Cursor, Copilot, and Codex.


Permission Boundaries

CLAUDE.md Configuration

Create a CLAUDE.md at the repository root to restrict Claude Code behavior:

# CLAUDE.md

## Restrictions

- NEVER read or output contents of .env, .env.*, secrets.yaml, or any file matching *.pem, *.key
- NEVER execute `rm -rf`, `DROP TABLE`, `kubectl delete`, or `terraform destroy` commands
- NEVER push directly to main or master branches
- NEVER modify files in the infrastructure/, terraform/, or .github/workflows/ directories without explicit user approval
- NEVER install new dependencies without listing them first for review
- NEVER access or display API keys, tokens, passwords, or connection strings

## Allowed Operations

- Read and modify application source code in src/, lib/, and tests/
- Run test suites with `npm test`, `pytest`, `go test`
- Run linters with `eslint`, `ruff`, `golangci-lint`
- Create new branches with prefix `ai/` or `agent/`
- Create and modify files in docs/ directory

## Code Standards

- All new functions must include docstrings or JSDoc comments
- All new code must have corresponding unit tests
- Follow existing code style and patterns in the repository
- Maximum file length: 500 lines. Suggest splitting if exceeded.

Command Allowlists

For agents that execute shell commands, define an explicit allowlist:

# .agent-permissions.yaml
agent_permissions:
  allowed_commands:
    - "npm test"
    - "npm run lint"
    - "npm run build"
    - "pytest"
    - "ruff check"
    - "go test ./..."
    - "git status"
    - "git diff"
    - "git log"
    - "git checkout -b"
    - "git add"
    - "git commit"
    - "ls"
    - "cat"
    - "head"
    - "tail"

  blocked_commands:
    - "rm -rf"
    - "curl"
    - "wget"
    - "ssh"
    - "scp"
    - "kubectl"
    - "terraform"
    - "aws"
    - "gcloud"
    - "az"
    - "docker push"
    - "npm publish"

  blocked_paths:
    - ".env*"
    - "**/*.pem"
    - "**/*.key"
    - "**/secrets/**"
    - "infrastructure/**"
    - ".github/workflows/**"

  allowed_paths:
    - "src/**"
    - "lib/**"
    - "tests/**"
    - "docs/**"
    - "package.json"
    - "pyproject.toml"

File System Access Controls

Use filesystem permissions to enforce boundaries at the OS level:

#!/bin/bash
# setup-agent-workspace.sh
# Create a restricted workspace for agent execution

AGENT_USER="ai-agent"
REPO_DIR="/workspace/repo"

# Create agent user with limited permissions
useradd --system --shell /bin/bash --no-create-home "$AGENT_USER"

# Set ownership: developers own everything, agent gets read on most
chown -R root:developers "$REPO_DIR"
chmod -R 750 "$REPO_DIR"

# Grant agent write access only to safe directories
setfacl -R -m u:${AGENT_USER}:rwx "${REPO_DIR}/src"
setfacl -R -m u:${AGENT_USER}:rwx "${REPO_DIR}/tests"
setfacl -R -m u:${AGENT_USER}:rwx "${REPO_DIR}/docs"

# Deny agent access to sensitive files
setfacl -m u:${AGENT_USER}:--- "${REPO_DIR}/.env"
setfacl -R -m u:${AGENT_USER}:--- "${REPO_DIR}/infrastructure"
setfacl -R -m u:${AGENT_USER}:--- "${REPO_DIR}/.github/workflows"

echo "Agent workspace permissions configured."

Secret Protection

Pre-commit Hooks with git-secrets

#!/bin/bash
# install-secret-scanning.sh

# Install git-secrets
git clone https://github.com/awslabs/git-secrets.git /tmp/git-secrets
cd /tmp/git-secrets && make install

# Initialize in repository
cd /path/to/repo
git secrets --install

# Register common secret patterns
git secrets --register-aws

# Add custom patterns for common credential formats
git secrets --add '-----BEGIN (RSA |EC |DSA )?PRIVATE KEY-----'
git secrets --add 'AKIA[0-9A-Z]{16}'
git secrets --add 'ghp_[a-zA-Z0-9]{36}'
git secrets --add 'sk-[a-zA-Z0-9]{48}'
git secrets --add 'xox[baprs]-[0-9a-zA-Z-]{10,}'
git secrets --add 'password\s*[:=]\s*["\x27][^\s]{8,}'
git secrets --add 'api[_-]?key\s*[:=]\s*["\x27][^\s]{8,}'

# Add allowed patterns (false positive exclusions)
git secrets --add --allowed 'EXAMPLE_KEY'
git secrets --add --allowed 'your-api-key-here'

Agent Output Scanning

Scan agent-generated output before it reaches version control:

#!/usr/bin/env python3
"""scan_agent_output.py - Scan AI agent output for leaked secrets."""


…
الأسئلة الشائعة

ما هي «حدود الصلاحيات»؟

هي حدود محددة تقيّد الأفعال التي يستطيع مساعد الذكاء الاصطناعي تنفيذها، مثل الوصول إلى ملفات معينة أو تشغيل أوامر محددة.

كيف يُمنع الذكاء الاصطناعي من الوصول إلى الأسرار؟

عبر قواعد تعلّمه ألا يقرأ أو يعرض كلمات المرور ومفاتيح الواجهات البرمجية أو أي بيانات حساسة، وكذلك عبر أدوات تفحص الشيفرة قبل حفظها.

هل يمكنني السماح للذكاء الاصطناعي بتعديل أي ملف؟

لا، يمكنك تحديد المجلدات والملفات التي يُسمح له بتغييرها بدقة، مثل الشيفرة المصدرية الرئيسية أو التوثيق، مع تقييد الوصول إلى المناطق الحساسة.

التفاصيل

الوصف الأصلي من المؤلف

Secure AI coding agents (Claude Code, Cursor, Codex, Copilot) with permission boundaries, secret protection, code review gates, and safe sandbox configurations for team environments.

repo: sickn33/agentic-awesome-skills

الشعبية

نجوم GitHub
48k
الترتيب
#3701
الترخيص
MIT
آخر تحديث
15‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة