agentleFS
Cogni-AI-OUCogni-AI-OU/cogni-ai-agent-skills/gh-codespace/SKILL.md

gh-codespace

Skill4 starsChanged 6 months agoMITView on GitHub

GitHub CLI (`gh codespace` or `gh cs`) operations for connecting to, managing, creating, or editing GitHub Codespaces. You MUST load this skill when working with the `gh codespace` command.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When managing, creating, or connecting to GitHub Codespaces natively from the CLI.

    line 49
  2. Distinctive:

    When you need to securely transfer files between the local machine and a Codespace without configuring SCP manually.

    line 50
  3. Distinctive:

    When attempting to perform automated Git commits (the agent should use native local git tools instead of proxying through a Codespace).

    line 56
  4. Distinctive:

    If the user explicitly asks to work locally and has not initialized a Codespace environment.

    line 57
  5. Very specific:

    Verify codespace status with gh codespace list or gh codespace view before attempting interactive connections.

    line 67
  6. Very specific:

    Use gh codespace cp for transferring files between the local machine and the codespace instead of manually configuring SCP.

    line 68
  7. Very specific:

    Connection Failures: If gh codespace ssh hangs or fails, check codespace logs: gh codespace logs -c <codespace-name>

    line 93
  8. Very specific:

    Rebuilding Environment: If the Devcontainer configuration is modified or corrupted, trigger a rebuild: gh codespace rebuild -c …

    line 95
  9. Very specific:

    Do not attempt to SSH manually without using gh codespace ssh as it requires specific key exchanges handled by the CLI.

    line 100
  10. Very specific:

    Avoid using interactive commands (like gh codespace code or gh codespace ssh) in automated agent workflows.

    line 101

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->

gh-codespace

Connect to and manage GitHub Codespaces natively from the CLI.

Mindmap of Commands

mindmap
  root((gh-codespace))
    code
      Open in VS Code
    cp
      Copy files
    create
      Create a codespace
    delete
      Delete codespaces
    edit
      Edit a codespace
    jupyter
      Open in JupyterLab
    list
      List codespaces
    logs
      Access codespace logs
    ports
      List and manage ports
    rebuild
      Rebuild a codespace
    ssh
      SSH into a codespace
    stop
      Stop a codespace
    view
      View details

When to Use

  • When managing, creating, or connecting to GitHub Codespaces natively from the CLI.
  • When you need to securely transfer files between the local machine and a Codespace without configuring SCP manually.
  • To handle port forwarding for local testing of applications running inside a Codespace.

When Not to Use

  • For managing local Docker containers or Devcontainers not hosted on GitHub's infrastructure (use docker or devcontainer skills instead).
  • When attempting to perform automated Git commits (the agent should use native local git tools instead of proxying through a Codespace).
  • If the user explicitly asks to work locally and has not initialized a Codespace environment.

Common Pitfalls

  • Interactive Hangs: Running gh codespace ssh in an automated agent session, which blocks execution by dropping the agent into an interactive TTY shell.
  • Dangling Port Forwards: Starting a port forward with gh codespace ports forward without backgrounding it (&), locking up the terminal.
  • Ignoring State: Attempting to execute commands against a Codespace that is currently in a "Stopped" or "Rebuilding" state, causing immediate connection failures.

Core Principles

  • Verify codespace status with gh codespace list or gh codespace view before attempting interactive connections.
  • Use gh codespace cp for transferring files between the local machine and the codespace instead of manually configuring SCP.
  • Manage port forwarding natively via gh codespace ports forward for local testing.

Commands / Usage Patterns

  • List Codespaces: View active codespaces to find the <codespace-name>: gh codespace list --json name,repository,state
  • Create a Codespace: gh codespace create --repo <repository-name> --branch <branch-name>
  • Copy Files: Transfer files from a codespace to the local machine: gh codespace cp -c <codespace-name> remote:/path/to/file local/path/ Transfer files from local to codespace: gh codespace cp -c <codespace-name> local/path/ remote:/path/to/file
  • Port Forwarding: Expose a port from the codespace to your local machine: gh codespace ports forward <remote-port>:<local-port> -c <codespace-name>
  • Stop/Delete Codespace: Clean up resources when done: gh codespace stop -c <codespace-name> gh codespace delete -c <codespace-name>

Diagnostics and Troubleshooting

  • Connection Failures: If gh codespace ssh hangs or fails, check codespace logs: gh codespace logs -c <codespace-name>
  • Rebuilding Environment: If the Devcontainer configuration is modified or corrupted, trigger a rebuild: gh codespace rebuild -c <codespace-name>

What to Avoid

  • Do not attempt to SSH manually without using gh codespace ssh as it requires specific key exchanges handled by the CLI.
  • Avoid using interactive commands (like gh codespace code or gh codespace ssh) in automated agent workflows. Use them only when providing instructions to the user.

Limitations

  • The CLI depends on active network connections and the GitHub Codespaces service availability.
  • Port forwarding gh codespace ports forward blocks the terminal and requires background execution (&) or a separate process in non-interactive environments.

References

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.