I am a lawyer and this is the type of work I do. This isn't a pitch, 'cos my bio doesn't even show where I work, so please don't think this reply is submitted out of self-interest. Of course you will get a better agreement if you use a lawyer and a post like this isn't going to replace that advice. But if you are fixed on doing it yourself, this email will at least help you.
The biggest problem with this sort of agreement is failing to sort out who ends up owning the intellectual property rights in the work product. Just because you pay for it and commission it doesn't mean you get to own it. Unfortunately, this gap has a nasty habit of coming to light a long time after the event and it often proves tricky (ie costly) to put right.
I'm not aware of any publicly agreements of the type you need. Lawyers working in this field will have precedents but they're unlikley to make them freely available. The concept of open source has yet to hit the legal community.
If it's any consolation, I think the skills you have as a programmer would probably make you good at drafting agreements if you had more familiarty with the content. If you decide to draft something yourself, don't feel the need to make it look like legal wording. Just use plain english and break down the document into bullet points. Use the following as a checklist of some key points:
- Ownership of the IP (see above). Unless your client is lax, you need to own it, and that also means you need to avoid the complications of your subcontractor using open source code
- Define the deliverables - you should be good at this. If it's fixed cost, make sure the outcome is clearly defined. If it's time & materials, make sure you get to control the consumption
- Are there are any fixed dates or milestones which you need to pass on?
- Can you define the quality standards?
- Obligation to correct defects
- Look at the contract you have with your client and consider what terms you need to pass on
- Give yourself the right to terminate at any time (but you'd pay for work done until that date). If it's a big project, tone this down with some notice period
- Require that your subcontractor does the work personally, ie no further subcontracting
- Always handy to have a general requirement to 'promote the goodwill and reputation of...'
- Include a warranty that the work will be done with reasonable care and skill and in accordance with good industry practice
Keep in mind that the value of the contract is limited if you are giving the work to someone of limited financial means and no insurance. As an intermediary, you're going to have some risk whatever you do. That risk goes up if the subcontractor is not based in your country.
Another common arrangement is not to subcontract the work at all, but to introduce the contractor to your client and let them do a deal with each other, and you charge a 'finders fee'. There are advantages and disadvantages to this.