AGENT SKILL

llm-setup-audit

Use when reviewing or hardening Claude Code agent configuration (.claude/settings.json / settings.local.json) — before committing config changes or onboarding a repo. Covers permissions, sandbox, hooks, MCP servers, plugins, committed secrets, and secrets-file gitignore. For application/infra security use web-security-audit.

License 许可
MIT
最近更新
2026-11-12
Stars
★ 0
Forks
0

01 前言 Front Matter

name
llm-setup-audit
tags
[ "security", "audit", "claude-code", "configuration" ]
type
skill
agents
[ "claude", "codex", "cursor", "gemini", "copilot" ]
version
0.1.0
description
Use when reviewing or hardening Claude Code agent configuration (.claude/settings.json / settings.local.json) — before committing config changes or onboarding a repo. Covers permissions, sandbox, hooks, MCP servers, plugins, committed secrets, and secrets-file gitignore. For application/infra security use web-security-audit.
user-invocable
true
disable-model-invocation
false

03 SKILL.md 正文

Agent Setup Audit (.claude/settings.json)

Overview

Checks the Claude Code harness configuration for permission-bypass and supply-chain risk: who can run what, what runs automatically (hooks), what code is pulled in (MCP servers, plugins), and whether secrets leaked into a committed file. Run each from the repo root, report PASS or FLAG, investigate every FLAG.

This audits how the agent is allowed to act. For the security of the code/infra you ship, use web-security-audit.

When to use

  • Before committing changes to .claude/settings.json / settings.local.json.
  • When onboarding or reviewing a repo whose agent config you didn't write.
  • When an automated commit-review flags a permission/bypass issue.

Checks

1. No blanket Bash allow

jq -e '.permissions.allow[]? | select(. == "Bash" or . == "Bash(*)")' .claude/settings.json

PASS: exit ≠ 0 (no match). Bash should be a narrow toolchain allowlist (Bash(git *), Bash(dotnet *), …). FLAG: Bash(*) / Bash — any-command bypass.

2. Permission mode isn't silently permissive

jq -r '.permissions.defaultMode // "default"' .claude/settings.json

FLAG (unless deliberate + documented): bypassPermissions or dontAsk / acceptEdits as the standing default.

3. Deny list is present (but not relied upon)

jq -e '.permissions.deny' .claude/settings.json     # exists = ok

A literal-prefix deny list (Bash(rm -rf*)) is best-effort only — bypassed by spacing, chaining (&&), or aliasing. It's defense-in-depth, never the primary control. FLAG: a deny list used instead of an allowlist.

4. Sandbox state is intentional

jq -r '.sandbox.enabled // "unset"' .claude/settings.json

The value must be deliberate and documented (commit/CLAUDE.md/memory). If false, the Bash allowlist (check 1) is the guardrail. If true, confirm it actually engages on this host (it can silently fall back to unsandboxed without bwrap/socat).

5. No secrets in the committed settings

jq -e '(.env // {}) | to_entries[] | select(.value|test("(?i)(secret|token|api[_-]?key|password)"))' .claude/settings.json
git check-ignore .claude/settings.json    # PASS: NOT ignored → it's committed → must hold no secrets

settings.json is git-tracked. FLAG: secrets in .env, in a hook command, or in mcpServers args. Real secrets belong in .claude/settings.local.json (which must be gitignored).

For agent behavioral rules around reading and echoing secrets at runtime, see secrets-safety.

6. Hooks are safe (they run automatically = RCE surface)

jq -r '(.hooks // {}) | to_entries[] | .key as $e | .value[].hooks[] | "\($e): \(.command // .url // .type)"' .claude/settings.json

Review each: does it write outside the repo, curl/exfiltrate, or pipe untrusted tool input into a shell? A hook fires on every matching event — a hostile one is silent code execution. FLAG: network calls to unknown hosts, writes to ~/system paths, or eval of tool output.

7. MCP servers are from trusted sources

jq -r '(.mcpServers // {}) | to_entries[] | "\(.key): \(.value.command) \(.value.args|join(" "))"' .claude/settings.json
jq -r '.enableAllProjectMcpServers // false' .claude/settings.json

FLAG: a server pulling from an unpinned/untrusted source, or enableAllProjectMcpServers: true (auto-approves every server in .mcp.json) without having reviewed .mcp.json.

8. Plugins / marketplaces are trusted

jq -r '(.enabledPlugins // {}) | keys[]' .claude/settings.json
jq -r '(.extraKnownMarketplaces // {}) | to_entries[] | "\(.key): \(.value.source)"' .claude/settings.json

FLAG: a plugin from a marketplace you don't recognize/control.

9. The file is valid JSON

jq -e . .claude/settings.json >/dev/null && echo PASS
[ -f .claude/settings.local.json ] && jq -e . .claude/settings.local.json >/dev/null

Invalid JSON silently disables every setting in that file — including your permission and hook config. Always validate after editing.

10. Secrets source is gitignored

The user's secrets may live as a single file, a folder, or a file pattern. Check whichever applies (ask the user if unsure):

# Single file (default: config.conf)
git check-ignore -v config.conf

# Folder
git check-ignore -v secrets/

# File pattern (e.g. .env.*)
git ls-files --others --exclude-standard | grep -E '^\.env\.' | head -5
# All matches should be untracked (gitignored); any tracked file is a FLAG

PASS: the secrets source is fully gitignored. FLAG: any file, folder, or pattern match that is not gitignored — it can be committed and leaked. The sandbox filesystem restriction is a runtime guardrail, not a substitute for keeping secrets out of version control.

Report format

List checks 1–10 as PASS / FLAG with the offending key for any FLAG and a one-line fix.

Common mistakes

Mistake Why it's wrong
Bash(*) "for a smooth dev loop" Any-command bypass — narrow to a toolchain allowlist
Trusting the deny list to block rm -rf Prefix denies are bypassable; only an allowlist actually constrains
Secrets in .claude/settings.json It's committed — put secrets in gitignored settings.local.json
A broad hook with no matcher/path guard Fires on everything; perf cost + a standing execution surface
enableAllProjectMcpServers: true unreviewed Auto-trusts arbitrary servers declared in .mcp.json
Secrets source (file/folder/.env.*) not gitignored Sandbox blocks runtime reads; git doesn't — can be committed

04 同仓库更多 Skills

Aliendreamer
Aliendreamer/ai.skills

setup-git-credentials

Use when the user wants Git to stop using a PAT in the remote URL or a plain-text credential store, wants Git Credential Manager (GCM) with OAuth for GitHub, GitLab or Azure DevOps on Ubuntu/Debian or WSL2, or sees 'cannot persist Microsoft authentication token cache securely' / 'using plain-text fallback token cache'. Asks whether this is WSL, which Git hosts and which parts to set up, checks what is already done, sets git config itself after confirmation and hands every sudo or interactive step (apt, gpg, pass init, secret-tool, first sign-in) to the user. Bundles gcm-keyring-session.sh to start or reuse a D-Bus + GNOME Keyring session without systemd. Trigger terms - git credentials, PAT in URL, token in remote, git credential manager, gcm, github auth, gitlab auth, azure devops auth, pass, gpg store, secret service, gnome keyring, msal token cache, wsl git auth.

★ 0
Aliendreamer
Aliendreamer/ai.skills

setup-flow

Use when onboarding a repository or agent to the standard development workflow — installs the required skills from the ai.skills store, installs or updates a MANDATORY workflow block in the agent's instruction file (CLAUDE.md, AGENTS.md, GEMINI.md, Copilot or Cursor rules), AND configures .claude/settings.json with Serena MCP, sandbox, permissions, hooks, and plugins. Hooks are wired to the context-hooks kit, which speaks once per session instead of injecting text on every turn; re-running replaces earlier inline hooks rather than adding to them. Also writes .vscode/settings.json to hide the empty shell dotfiles an agent sandbox leaves in the repo root. Use when setting up a new repo, switching agents, or refreshing the workflow rules.

★ 0
Aliendreamer
Aliendreamer/ai.skills

developer-flow

Use when starting, implementing, or completing any feature, change, or fix in any software project — at feature start, before writing code, and before claiming a change is done, fixed, working, or green. A strict ordered flow with a gate per phase; stack-agnostic and repo-agnostic (OpenSpec optional, gates discovered).

★ 0
Aliendreamer
Aliendreamer/ai.skills

daily-log-check

Use to check whether everyone on duty filed their Azure DevOps time-log Tasks for a given day, per platform — reports tickets, hours and activities per person against the headcount you give. Fires on "did everyone log yesterday", "check web 4 mobile 3", "who is missing for 8.09", "daily log check". Read-only. Org and project come from configuration.

★ 0
Aliendreamer
Aliendreamer/ai.skills

daily-activity-log

Use at end of day to file the Azure DevOps time-log Tasks — one closed Task per Activity worked that day, Original Estimate in decimal hours, parented to the current sprint's Feature. Fires on "log my day", "fill my tasks", "close my daily tasks", "I had 2h meetings and 4h development". Org and project come from configuration.

★ 0
Aliendreamer
Aliendreamer/ai.skills

conventional-commits

Write commit messages that follow the Conventional Commits specification so tooling can derive versions and changelogs.

★ 0