agentleFS
truefoundrytruefoundry/tfy-deploy-skills/skills/monitor/SKILL.md

truefoundry-monitor

Skill1 starsChanged 8 months agoMITView on GitHub

Monitors TrueFoundry deployment rollouts after deploy/apply. Polls status, checks pod health and readiness, fetches logs on failure, and reports a final summary. Use after deploying or applying a manifest to track rollout progress.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 5 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After tfy apply or tfy deploy to track rollout progress

    line 19
  2. Distinctive:

    Before monitoring, you need:

    line 43
  3. Distinctive:

    If invoked right after a deploy, both should already be known from the deploy context.

    line 47
  4. Very specific:

    If MCP tool calls are unavailable, fall back to direct API via tfy-api.sh.

    line 56
  5. Very specific:

    When using direct API, set TFY_API_SH to the full path of this skill's scripts/tfy-api.sh.

    line 58
  6. Distinctive:

    After 5 minutes: check every 60 seconds

    line 110
  7. Distinctive:

    Between polls, tell the user what you're waiting for: Do not silently loop. Do NOT ask "should I continue?" — just continue.

    line 113
  8. Very specific:

    When state.isTerminalState is true and status is DEPLOY_SUCCESS:

    line 117
  9. Very specific:

    When status is BUILD_FAILED, DEPLOY_FAILED, FAILED, or CANCELLED:

    line 133
  10. Distinctive:

    Use a consistent format for each status update:

    line 162
  11. Very specific:

    Before monitoring: Use deploy skill to deploy, then monitor

    line 213
  12. Very specific:

    On failure: Use logs skill for deeper log analysis

    line 214
  13. Very specific:

    Check app details: Use applications skill for full app info

    line 215
  14. Very specific:

    Fix and redeploy: Use deploy skill to apply fixes

    line 216

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “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

Routing note: For ambiguous user intents, use the shared clarification templates in references/intent-clarification.md.

<objective>

Monitor Deployment

Track a TrueFoundry deployment rollout to completion, reporting status at each stage and diagnosing failures automatically.

When to Use

  • After tfy apply or tfy deploy to track rollout progress
  • User says "monitor", "watch deployment", "is my deploy done", "check rollout"
  • Called automatically by the deploy skill after a successful apply/deploy

When NOT to Use

  • User wants to deploy → prefer deploy skill; ask if the user wants another valid path
  • User wants to list all apps → prefer applications skill; ask if the user wants another valid path
  • User wants to read historical logs → prefer logs skill; ask if the user wants another valid path
</objective><instructions>

CRITICAL BEHAVIOR RULES

RULE 1: Once monitoring starts, you MUST poll until a terminal state or timeout. Do NOT stop early. Do NOT ask the user "should I keep checking?" — just keep checking.

RULE 2: Do NOT end your response while the deployment is in a non-terminal state (BUILDING, INITIALIZED, ROLLOUT_STARTED). If you are about to stop and the status is non-terminal, you are violating this rule — continue polling.

RULE 3: Between each poll, briefly tell the user what you're waiting for. Do NOT silently loop, but also do NOT ask for permission to continue.

Required Information

Before monitoring, you need:

  1. Workspace FQN (TFY_WORKSPACE_FQN) — HARD RULE: Never auto-pick. Always ask the user to confirm.
  2. Application name — the service or job name being deployed

If invoked right after a deploy, both should already be known from the deploy context.

Execution Priority

For all status checks, use MCP tool calls first:

tfy_applications_list(filters={"workspace_fqn": "WORKSPACE_FQN", "application_name": "APP_NAME"})

If MCP tool calls are unavailable, fall back to direct API via tfy-api.sh.

When using direct API, set TFY_API_SH to the full path of this skill's scripts/tfy-api.sh. See references/tfy-api-setup.md for paths per agent.

Monitoring Flow

Step 1: Initial Status Check

TFY_API_SH=~/.claude/skills/truefoundry-monitor/scripts/tfy-api.sh
bash $TFY_API_SH GET '/api/svc/v1/apps?workspaceFqn=WORKSPACE_FQN&applicationName=APP_NAME'

Extract from the response at data[0] (the application object):

  • deployment.currentStatus.status — the deployment status enum
  • deployment.currentStatus.transition — current transition (e.g., BUILDING, DEPLOYING)
  • deployment.currentStatus.state.isTerminalState — boolean, most reliable terminal check
  • deployment.currentStatus.state.display — human-readable state

Step 2: Poll Until Terminal State

The API response has two key fields: status (the deployment status) and transition (what's happening now). Use state.isTerminalState as the authoritative check for whether to stop polling.

Status values (from deployment.currentStatus.status):

StatusTerminal?Action
INITIALIZEDNoReport "Deployment initialized, waiting...", continue polling
BUILDINGNoReport "Build in progress", continue polling
BUILD_SUCCESSNoReport "Build succeeded, deploying...", continue polling
BUILD_FAILEDYesFetch build logs, report failure
ROLLOUT_STARTEDNoReport "Rollout started", continue polling
DEPLOY_SUCCESSYesReport success with endpoint URL
DEPLOY_FAILEDYesFetch pod logs, diagnose failure
DEPLOY_FAILED_WITH_RETRYNoReport "Deploy failed, retrying...", continue polling
PAUSEDYesReport paused/stopped
FAILEDYesReport general failure
CANCELLEDYesReport cancelled

Transition values (from deployment.currentStatus.transition):

TransitionMeaning
BUILDINGImage build is in progress
DEPLOYINGPods are being created/updated
REUSING_EXISTING_BUILDSkipping build, reusing cached image
COMPONENTS_DEPLOYINGMulti-component deployment in progress
WAITINGWaiting for resources

Best practice: Always check deployment.currentStatus.state.isTerminalState === true to decide whether to stop polling, rather than matching individual status strings. The state.display field gives a human-friendly label.

Polling schedule:

  • First 2 minutes: check every 15 seconds
  • Minutes 2-5: check every 30 seconds
  • After 5 minutes: check every 60 seconds
  • Timeout after 10 minutes — report current state and suggest the user check manually

Between polls, tell the user what you're waiting for. Do not silently loop. Do NOT ask "should I continue?" — just continue.

Step 3: On Success

When state.isTerminalState is true and status is DEPLOY_SUCCESS:

  1. Report the final status
  2. Show replicas ready (e.g., "2/2 replicas ready")
  3. Show the endpoint URL if the service has an exposed port
  4. Optionally run a quick health check on the endpoint:
# Only if the service exposes an HTTP port
curl -sf -o /dev/null -w '%{http_code}' "https://ENDPOINT_URL/health" || true

Report the HTTP status code. Do not fail the monitor if the health check fails — just report it.

Step 4: On Failure

When status is BUILD_FAILED, DEPLOY_FAILED, FAILED, or CANCELLED:

  1. Fetch recent logs using the logs skill or direct API:
# Get the app ID first from the status response
TFY_API_SH=~/.claude/skills/truefoundry-monitor/scripts/tfy-api.sh

# Fetch recent logs (last 5 minutes)
bash $TFY_API_SH GET '/api/svc/v1/logs/WORKSPACE_ID/download?applicationFqn=APP_FQN&startTs=START_TS&endTs=END_TS'
  1. Identify the failure cause from the logs (OOMKilled, CrashLoopBackOff, ImagePullBackOff, port mismatch, etc.)
  2. Suggest a fix based on the error:
Error PatternSuggested Fix
OOMKilledIncrease memory_limit in manifest
CrashLoopBackOffCheck startup command and logs for crash reason
ImagePullBackOffVerify image URI and registry credentials
Port mismatchEnsure manifest port matches what the app listens on
Readiness probe failedCheck health probe path and startup time
Build errorCheck Dockerfile and build logs
  1. Report summary with: error type, relevant log excerpt (max 20 lines), and suggested fix
  2. Do NOT auto-retry. Present the diagnosis and let the user decide next steps.

Presenting Status Updates

Use a consistent format for each status update:

Monitoring: my-service in cluster:workspace
Status: ROLLOUT_STARTED | Transition: DEPLOYING
Display: Deploying (1/2 replicas ready)
Elapsed: 45s
Next check in 15s...

Final summary on success:

Deployment complete: my-service
Status: DEPLOY_SUCCESS
Replicas: 2/2 ready
Endpoint: https://my-service-ws.example.com
Health check: 200 OK
Total time: 1m 32s

Final summary on failure:

Deployment failed: my-service
Status: DEPLOY_FAILED
Error: CrashLoopBackOff — container exited with code 1
Log excerpt:
  > ModuleNotFoundError: No module named 'flask'
Suggested fix: Add 'flask' to requirements.txt and redeploy
</instructions>

<success_criteria>

Success Criteria

  • Deployment status is tracked from current state to a terminal state
  • User sees clear progress updates at each polling interval
  • On success: replicas, endpoint URL, and optional health check are reported
  • On failure: logs are fetched, root cause is identified, and a fix is suggested
  • Monitor times out gracefully after 10 minutes with a status summary
  • The user is never left waiting without feedback

</success_criteria>

<references>

Composability

  • Before monitoring: Use deploy skill to deploy, then monitor
  • On failure: Use logs skill for deeper log analysis
  • Check app details: Use applications skill for full app info
  • Fix and redeploy: Use deploy skill to apply fixes
</references><troubleshooting>

Error Handling

Application Not Found

Application "APP_NAME" not found in workspace "WORKSPACE_FQN".
Check:
- Application name is spelled correctly
- The deploy/apply command completed successfully
- You're checking the correct workspace

Timeout

Monitoring timed out after 10 minutes.
Current status: ROLLOUT_STARTED | Transition: DEPLOYING
The deployment is still in progress. Check manually:
- TrueFoundry dashboard: TFY_BASE_URL
- Or run this skill again to resume monitoring

Permission Denied

Cannot access this application. Check your API key permissions for this workspace.
</troubleshooting>

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.