codeberg-api
Skill2 starsChanged 9 days agoMITView on GitHub
Interact with Forgejo/Codeberg repositories via the REST API — read or write files, manage issues, create pull requests, list branches/tags, search repos, and automate CI/CD workflows. Use this skill when the user wants to interact with a Forgejo or Codeberg repository, even if they just say "read a file from Codeberg" or "create an issue on my Forgejo repo". Not for GitHub (use git-github-workflow) or GitLab (use cicd-pipeline).
- Reads credentials
- Installs packages
- Sends data out
In this repository63 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/avoid-ai-writing/AGENTS.mdAGENTS.md
- .agents/skills/do-web-doc-resolver/AGENTS.mdAGENTS.md
- .agents/skills/skill-evaluator/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- accessibility-auditorSkill
- agent-browserSkill
- agentic-abstentionSkill
- agents-mdSkill
- api-design-firstSkill
- architecture-diagramSkill
- avoid-ai-writingSkill
- cicd-pipelineSkill
- cloudflare-worker-apiSkill
- codacySkill
- code-review-assistantSkill
- css-render-performanceSkill
- database-devopsSkill
- debuggerSkill
- delegateSkill
- dependency-upgradesSkill
- dist-channel-selectionSkill
- docs-hookSkill
- document-rendering-and-locatorsSkill
- dogfoodSkill
- dora-reportSkill
- do-web-doc-resolverSkill
- durable-objectsSkill
- eu-ai-act-complianceSkill
- git-github-workflowSkill
- goap-agentSkill
- implementerSkill
- intent-classifierSkill
- iterative-refinementSkill
- jules-delegatorSkill
- learnSkill
- lifecycle-managementSkill
- local-context-sanitizationSkill
- memory-contextSkill
- migration-refactoringSkill
- nested-build-isolationSkill
- privacy-firstSkill
- progressive-deliverySkill
- pwa-offline-syncSkill
- reader-ui-uxSkill
- readme-best-practicesSkill
- secrets-managementSkill
- secure-invite-and-accessSkill
- security-code-auditorSkill
- shell-script-qualitySkill
- skill-creatorSkill
- skill-evaluatorSkill
- static-analysisSkill
- testing-strategySkill
- test-runnerSkill
- triz-solverSkill
- turso-dbSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Read or write files in a Forgejo/Codeberg repository
- Very specific: line 31
Create/update/close issues or pull requests
- Distinctive: line 33
Search repositories or users
- Very specific: line 168
Place workflows in .forgejo/workflows/ directory.
- Distinctive: line 189
Use matrix builds for parallel testing
- Distinctive: line 191
Use branch protection with required workflows
≈ “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.
Files
Forgejo/Codeberg API Skill
Automates Forgejo repository operations using the REST API (v1). Compatible with Codeberg and self-hosted Forgejo instances.
When to Use
Activate when you need to:
- Read or write files in a Forgejo/Codeberg repository
- Create/update/close issues or pull requests
- List branches, tags, commits, or releases
- Search repositories or users
- Trigger CI/CD via repository dispatch
- Automate any git-forge operation
Prerequisites
pip install httpx python-dotenvAuthentication
Set FORGEJO_TOKEN (or CODEBERG_TOKEN) in your environment or .env file.
Generate at: Forgejo/Codeberg → Settings → Applications → Generate Token.
Required scopes per operation:
| Operation | Scope needed |
| Read public repos | (none, token optional) |
| Read private repos | read:repository |
| Write files / create PRs | write:repository |
| Manage issues | write:issue |
| Read user info | read:user |
export FORGEJO_TOKEN=your_token_here
# or place in .env at project rootBase URL Configuration
The skill defaults to Codeberg (https://codeberg.org/api/v1). For self-hosted
Forgejo instances, set FORGEJO_BASE_URL:
export FORGEJO_BASE_URL=https://forgejo.example.com/api/v1Base URL & Headers
Base URL : https://codeberg.org/api/v1 (default)
Auth : Authorization: token <FORGEJO_TOKEN>
Content : Content-Type: application/jsonCommands
CLI Usage (from project root)
# List repos for a user
python .agents/skills/codeberg-api/scripts/forgejo_api.py repos --owner username
# Get file contents
python .agents/skills/codeberg-api/scripts/forgejo_api.py get-file \
--owner username --repo myrepo \
--path README.md --branch main
# Create an issue
python .agents/skills/codeberg-api/scripts/forgejo_api.py create-issue \
--owner username --repo myrepo \
--title "Bug: xyz" --body "Description"
# List open issues
python .agents/skills/codeberg-api/scripts/forgejo_api.py list-issues \
--owner username --repo myrepo --state open
# Create or update a file
python .agents/skills/codeberg-api/scripts/forgejo_api.py put-file \
--owner username --repo myrepo \
--path docs/test.md --content "# Hello" \
--message "docs: add test file" --branch mainStandalone Usage (from skill directory)
cd .agents/skills/codeberg-api
python scripts/forgejo_api.py --helpCommon API Patterns
Read a file
curl -H "Authorization: token $FORGEJO_TOKEN" \
"https://codeberg.org/api/v1/repos/{owner}/{repo}/contents/{filepath}?ref=main"Response contains content (base64-encoded) and sha (needed for updates).
Create/update a file
curl -X PUT -H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/json" \
"https://codeberg.org/api/v1/repos/{owner}/{repo}/contents/{filepath}" \
-d '{"message":"commit msg","content":"<base64>","sha":"<existing_sha_or_omit>"}'Create an issue
curl -X POST -H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/json" \
"https://codeberg.org/api/v1/repos/{owner}/{repo}/issues" \
-d '{"title":"Issue title","body":"Body text"}'List branches
curl "https://codeberg.org/api/v1/repos/{owner}/{repo}/branches"Error Handling
| HTTP Status | Meaning | Action |
| 401 | Unauthorized | Check FORGEJO_TOKEN |
| 403 | Forbidden | Check token scopes |
| 404 | Not found | Verify owner/repo/path |
| 409 | Conflict | SHA mismatch on file update — fetch current SHA first |
| 422 | Validation error | Check request body fields |
| 429 | Rate limited | Wait and retry with backoff |
Forgejo Actions (CI/CD)
Forgejo uses Forgejo Actions for CI/CD, fully compatible with GitHub Actions.
Workflow Location
Place workflows in .forgejo/workflows/ directory.
Example: Build Workflow
name: Build
version: "0.2.10"
on: [push, pull_request]
jobs:
build:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Run tests
run: npm test
- name: Build
run: npm run buildBest Practices (2026)
- Use matrix builds for parallel testing
- Enable caching for dependencies
- Use branch protection with required workflows
- Leverage secrets for API tokens (
FORGEJO_TOKEN)
Bundled Scripts
scripts/forgejo_api.py— Main CLI tool for Forgejo API operations
See Also
git-github-workflow— GitHub workflow and PR lifecyclecicd-pipeline— CI/CD pipeline design
Rationalizations
| Rationalization | Reality |
| "I'll hardcode the token in the script for convenience." | Hardcoded tokens leak into version control and logs; always use environment variables or .env files. |
| "The API is the same as GitHub — I'll just use GitHub patterns." | Forgejo/Codeberg API has different endpoints, auth scopes, and error codes; copying GitHub patterns silently fails. |
Red Flags
- Committing FORGEJO_TOKEN or any secrets to the repository
- Skipping SHA fetch before file updates — causes 409 Conflict errors
- Not checking token scopes when receiving 403 Forbidden responses
References
agents-docs/SKILLS.md- Skill authoring guide
Voice & Context
- Default:
professional+blog - Reference:
voice-profilesskill for definitions and auto-detection.
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
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.

