ericrisco/rsc-harness / skills/connect-tool
connect-tool
VerifiedUse when the user names a specific tool to connect to the agent (an ERP, accounting or desktop program, CRM, WhatsApp, a spreadsheet, a database): research its real docs first, and when none exist, diagnose the program with the user and keep going. Picks the safest route, builds `01-TOOLS/<TOOL>/` with a test that proves it. NOT a full typed API client (that is `api-connector-builder`), NOT a whole-workspace tooling scan (that is `harness`).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 16.4 KB |
| THIRD_PARTY.md | markdown | 2.8 KB |
| bridge-kit/01-TOOLS-plantilla/test_connection.shexecutable | script | 1.6 KB |
| bridge-kit/LICENSE | other | 1.2 KB |
| bridge-kit/README.md | markdown | 4.1 KB |
| bridge-kit/UPSTREAM.json | config | 219 B |
| bridge-kit/access/access_a_sqlite.pyexecutable | script | 3.5 KB |
| bridge-kit/dbhub/dbhub.toml.ejemplo | other | 2.5 KB |
| bridge-kit/red/cloudflared-config.yml.ejemplo | other | 1.1 KB |
| bridge-kit/red/tailscale-grants.hujson | other | 930 B |
| bridge-kit/sqlserver/01-login-servidor.sql | other | 1.1 KB |
| bridge-kit/sqlserver/02-usuario-y-vistas.sql | other | 2.9 KB |
| bridge-kit/sqlserver/03-prueba-solo-lectura.sql | other | 2.0 KB |
| bridge-kit/sqlserver/copia-nocturna.ps1 | script | 3.3 KB |
| evals/cases.yaml | config | 8.4 KB |
| references/connect-or-migrate.md | markdown | 5.8 KB |
| references/database-bridge.md | markdown | 9.7 KB |
| references/file-exchange.md | markdown | 7.9 KB |
| references/messages.md | markdown | 5.9 KB |
| references/program-types.md | markdown | 5.8 KB |
| references/spain.md | markdown | 7.1 KB |
| references/what-to-find-out.md | markdown | 4.0 KB |
bridge-kit/sqlserver/copia-nocturna.ps1
View on GitHub<#
Kit puente · Copia nocturna de la base del programa a "ERP_IA" (SQL Server, Express incluido).
Qué hace, en este orden:
1. BACKUP ... WITH COPY_ONLY de la base de producción. COPY_ONLY no rompe la cadena
de copias del programa.
2. RESTORE en ERP_IA (la sobrescribe), moviendo los ficheros a la carpeta de datos.
3. Vuelve a crear el usuario, el esquema "ia" y las vistas con 02-usuario-y-vistas.sql,
porque la restauración los borra.
4. Pasa la prueba de solo lectura (03-prueba-solo-lectura.sql) y deja un registro.
SQL Server Express no tiene SQL Server Agent: se programa con el Programador de tareas
de Windows (ver el README del kit). Se ejecuta con una cuenta de Windows que sea
administradora de SQL Server, NUNCA con ia_lectura.
Uso:
powershell -ExecutionPolicy Bypass -File copia-nocturna.ps1 -Origen "<BD_DEL_PROGRAMA>"
#>
param(
[Parameter(Mandatory = $true)][string]$Origen,
[string]$Servidor = ".\SQLEXPRESS",
[string]$Copia = "ERP_IA",
[string]$CarpetaBackup = "C:\KitPuente\backups",
[string]$CarpetaDatos = "C:\KitPuente\datos",
[string]$CarpetaScripts = $PSScriptRoot,
[int]$DiasRetencion = 3
)
$ErrorActionPreference = "Stop"
New-Item -ItemType Directory -Force -Path $CarpetaBackup, $CarpetaDatos | Out-Null
$registro = Join-Path $CarpetaBackup "copia-nocturna.log"
function Log($texto) { "$(Get-Date -Format s) $texto" | Tee-Object -FilePath $registro -Append }
$bak = Join-Path $CarpetaBackup ("{0}-{1}.bak" -f $Origen, (Get-Date -Format yyyyMMdd))
Log "Backup de [$Origen] a $bak"
sqlcmd -S $Servidor -E -b -Q "BACKUP DATABASE [$Origen] TO DISK = N'$bak' WITH COPY_ONLY, INIT, CHECKSUM"
if ($LASTEXITCODE -ne 0) { Log "ERROR en el backup"; exit 1 }
# Nombres lógicos de los ficheros para el MOVE.
$lista = sqlcmd -S $Servidor -E -b -h -1 -W -s "|" -Q "SET NOCOUNT ON; RESTORE FILELISTONLY FROM DISK = N'$bak'"
$moves = @()
foreach ($linea in $lista) {
$campos = $linea -split "\|"
if ($campos.Count -lt 3) { continue }
$logico = $campos[0].Trim(); $tipo = $campos[2].Trim()
$ext = if ($tipo -eq "L") { "ldf" } else { "mdf" }
$moves += "MOVE N'$logico' TO N'$(Join-Path $CarpetaDatos "$Copia-$logico.$ext")'"
}
if ($moves.Count -eq 0) { Log "ERROR: no se han leído los ficheros del backup"; exit 1 }
Log "Restaurando en [$Copia]"
$restore = "IF DB_ID(N'$Copia') IS NOT NULL ALTER DATABASE [$Copia] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; " +
"RESTORE DATABASE [$Copia] FROM DISK = N'$bak' WITH REPLACE, RECOVERY, " + ($moves -join ", ") + "; " +
"ALTER DATABASE [$Copia] SET MULTI_USER;"
sqlcmd -S $Servidor -E -b -Q $restore
if ($LASTEXITCODE -ne 0) { Log "ERROR en la restauración"; exit 1 }
Log "Usuario, esquema ia y vistas"
sqlcmd -S $Servidor -E -b -d $Copia -i (Join-Path $CarpetaScripts "02-usuario-y-vistas.sql")
if ($LASTEXITCODE -ne 0) { Log "ERROR al crear usuario o vistas"; exit 1 }
Log "Prueba de solo lectura"
$prueba = sqlcmd -S $Servidor -E -b -d $Copia -i (Join-Path $CarpetaScripts "03-prueba-solo-lectura.sql")
$prueba | ForEach-Object { Log $_ }
if (-not ($prueba -match "RESULTADO: OK")) { Log "ERROR: la prueba de solo lectura no ha dado OK"; exit 1 }
Get-ChildItem $CarpetaBackup -Filter "$Origen-*.bak" |
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-$DiasRetencion) } | Remove-Item -Force
Log "OK — copia lista en [$Copia]"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |