agentleFS
Damon-Stewart-1Damon-Stewart-1/claude-skills-public/skills/preflight/SKILL.md

preflight

Skill3 starsChanged 7 months agoMITView on GitHub

Environment health check before starting session work. Tests Keychain secrets, env files, MCP servers, GCP auth, and GitHub identity. Outputs a green/red status table.

  • Reads credentials

19 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ship and review.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AWSSkill

    ship

    Finalize dev work on an issue branch — update docs, push, and open a PR.

    Also in 3 projects that use this

  • SentrySkill

    review

    Fixture review skill.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. 0 are common, 10 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run a full environment health check before starting session work.

    line 9
  2. Distinctive:

    No arguments: full check of everything in declared-state

    line 13
  3. Very specific:

    Create ~/.claude/preflight-state.json to declare what to check.

    line 19
  4. Distinctive:

    If the file is missing, Claude will tell you and offer to generate a default.

    line 49
  5. Very specific:

    Read ~/.claude/preflight-state.json.

    line 55
  6. Distinctive:

    Do NOT capture or display the key value: Only check existence.

    line 65
  7. Distinctive:

    Check file exists and has correct permissions:

    line 78
  8. Distinctive:

    Check required vars are present (existence only, never display values):

    line 83
  9. Distinctive:

    HTTP servers: Test with a HEAD request:

    line 97
  10. Distinctive:

    stdio servers: Check command availability:

    line 105
  11. Distinctive:

    All OK: "Preflight complete.

    line 146
  12. Distinctive:

    Never display, echo, or log any secret values.

    line 152
  13. Very specific:

    Never use cat, head, or Read on env files.

    line 153
  14. Very specific:

    If a check category is missing from preflight-state.json, skip it silently.

    line 155

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Preflight Check

Run a full environment health check before starting session work. Reads a declared-state file and verifies each entry.

Arguments

  • No arguments: full check of everything in declared-state
  • --fix: enable auto-fix mode (confirms before each fix)
  • --quiet: only show failures, skip green rows

Setup

Create ~/.claude/preflight-state.json to declare what to check. Example:

{
  "keychain_keys": [
    { "service": "GEMINI_API_KEY", "label": "Gemini API Key" },
    { "service": "FIGMA_ACCESS_TOKEN", "label": "Figma Token", "expires": "2026-06-24", "warn_days_before": 30 }
  ],
  "env_files": [
    {
      "path": "~/.claude/my-project.env.local",
      "required_vars": ["API_TOKEN", "PROJECT_ID"],
      "expected_perms": "600"
    }
  ],
  "mcp_servers": [
    { "name": "slack", "type": "http", "url": "http://localhost:PORT/health" },
    { "name": "google-calendar", "type": "stdio", "command": "npx" }
  ],
  "gcp": {
    "expected_account": "you@yourdomain.com",
    "expected_project": "your-gcp-project-id"
  },
  "github": {
    "expected_user": "your-github-username",
    "expected_email": "you@yourdomain.com"
  }
}

If the file is missing, Claude will tell you and offer to generate a default.

Execution Steps

Step 0: Load Declared State

Read ~/.claude/preflight-state.json. Parse it and extract all check categories. Initialize a results array to collect status for the final table.

Step 1: Keychain Keys

For each entry in keychain_keys, run:

security find-generic-password -a "$USER" -s "SERVICE_NAME" -w >/dev/null 2>&1 && echo "OK" || echo "MISSING"

Do NOT capture or display the key value. Only check existence.

For keys with an expires field, calculate days until expiry from today. If within warn_days_before, mark as WARN with the expiry date.

Record result:

  • OK: key exists in Keychain
  • WARN: key exists but approaching expiry
  • FAIL: key missing from Keychain

Step 2: Env Files

For each entry in env_files:

  1. Check file exists and has correct permissions:
[ -f FILE_PATH ] && stat -f "%Lp" FILE_PATH
  1. Check required vars are present (existence only, never display values):
grep -q '^VAR_NAME=.\+' FILE_PATH && echo "SET" || echo "EMPTY"

Never cat, head, or display env file contents.

Auto-fix wrong permissions (if --fix):

chmod 600 FILE_PATH

Step 3: MCP Server Connectivity

HTTP servers: Test with a HEAD request:

curl -s -o /dev/null -w "%{http_code}" --max-time 5 URL
  • 200-399: OK
  • 401/403: WARN (reachable, auth issue)
  • 0 or 5xx: FAIL

stdio servers: Check command availability:

command -v COMMAND >/dev/null 2>&1 && echo "OK" || echo "MISSING"

Step 4: GCP Auth

gcloud auth list --filter=status:ACTIVE --format="value(account)" 2>/dev/null
gcloud config get-value project 2>/dev/null

Compare against gcp.expected_account and gcp.expected_project.

Step 5: GitHub Identity

gh auth status 2>&1
git config --global user.email

Compare against github.expected_user and github.expected_email.

Step 6: Output Status Table

## Preflight Results - [DATE]

| #  | Check                     | Status | Detail                          |
|----|---------------------------|--------|---------------------------------|
| 1  | Keychain: GEMINI_API_KEY  | OK     | Present                         |
| 2  | Keychain: FIGMA_TOKEN     | WARN   | Expires 2026-06-24 (84 days)   |
| 3  | Env: my-project.env.local | OK     | Exists, perms 600, vars set     |
| 4  | MCP: slack                | OK     | HTTP 200                        |
| 5  | GCP: auth                 | OK     | you@domain.com / project-id     |
| 6  | GitHub: identity          | OK     | username / you@domain.com       |

Status: OK = passed, WARN = caveats, FAIL = blocked.

Summary line:

  • All OK: "Preflight complete. All N checks passed."
  • Warnings: "Preflight complete. N passed, W warnings."
  • Failures: "Preflight BLOCKED. F failures must be resolved before starting work."

Rules

  • Never display, echo, or log any secret values. Check existence via exit codes only.
  • Never use cat, head, or Read on env files. Use grep -q only.
  • Auto-fixes require user confirmation before executing.
  • If a check category is missing from preflight-state.json, skip it silently.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.